Repository navigation
Go: implement Xiaomi chat provider - #15626
Conversation
|
Complex PR? Review this PR in Change Stack to move by importance, not file order. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughAdds Xiaomi provider entries and model config, registers ChangesXiaomi model integration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/entity/models/xiaomi.go`:
- Around line 76-93: The code currently replaces empty region with "default" in
XiaomiModel.endpointURL which prevents using a configured empty-string override;
restore the raw region value and implement a fallback lookup in baseURLForRegion
so it checks keys in this order: exact region -> "" -> "default". Concretely,
keep the original region string (do not rewrite "" to "default") in endpointURL
and call baseURLForRegion(region); then modify baseURLForRegion to try
m.BaseURL[region], then m.BaseURL[""], then m.BaseURL["default"], returning the
first non-empty result or the existing error if none found.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf9334b4-6af8-48e0-86fc-f55157e3ce6d
📒 Files selected for processing (5)
conf/llm_factories.jsonconf/models/xiaomi.jsoninternal/entity/models/factory.gointernal/entity/models/xiaomi.gointernal/entity/models/xiaomi_test.go
|
@tmimmanuel We r refactoring model provider, I shall review code later |
1a9112b to
2d7eb6a
Compare
|
@tmimmanuel please refer #15627 for model provider refactor and commit it later |
|
@tmimmanuel will you implement Xiaomi provider? |
|
I will submit now. |
2d7eb6a to
6c075dd
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/entity/models/xiaomi.go`:
- Around line 350-368: The loop that reads SSE lines via scanner.Scan() treats
only line == "" as an event separator, but CRLF separators produce a line of
"\r" so frames never flush; update the handling in the scanner loop (the block
using variable line, strings.HasPrefix checks, dataLines and dispatchEvent()) to
normalize CRLF by trimming a trailing '\r' (e.g., line =
strings.TrimSuffix(line, "\r") or test strings.TrimSpace(line) == "") before
checking emptiness or "data:" prefix so that "\r" is treated as an empty
separator and data: lines are parsed correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0ecceeab-7e9a-4a4b-9931-1d9b78324042
📒 Files selected for processing (5)
conf/llm_factories.jsonconf/models/xiaomi.jsoninternal/entity/models/factory.gointernal/entity/models/xiaomi.gointernal/entity/models/xiaomi_test.go
💤 Files with no reviewable changes (1)
- internal/entity/models/xiaomi_test.go
✅ Files skipped from review due to trivial changes (1)
- conf/models/xiaomi.json
6c075dd to
cad7295
Compare
Haruko386
left a comment
There was a problem hiding this comment.
Hi @tmimmanuel
LGTM, but would you provide your test result in RAGflow CLI?
|
Hi @Haruko386, I ran live testing through Environment:
Commands executed: Also re-ran the focused unit tests: |
Haruko386
left a comment
There was a problem hiding this comment.
@tmimmanuel LGTM
Thank you for your contribution
What problem does this PR solve?
Implements the Xiaomi MiMo chat provider for the Go model provider layer.
Reference issue: #14736
Official docs used:
This PR adds:
XiaomiModelwith non-streaming and streaming chat completions.api-keyauth andmax_completion_tokens.reasoning_contentpassthrough for thinking responses and streaming deltas.mimo-v2.5-pro,mimo-v2.5, andmimo-v2-flash.Unsupported methods return the standard
no such methodsentinel for embedding, rerank, audio, OCR, balance, tasks, and model listing because this PR is scoped to the chat provider surface.Type of change
Tests: