Repository navigation
Conversation
…iflow#15853) - voyage: Voyage AI exposes no live model-list endpoint (only /v1/embeddings and /v1/rerank), so replace the "no such method" stub with a static-catalog listing sourced from the loaded provider definition, carrying each model's max_tokens, model_types, and embedding dimensions. "list models from voyage" now returns the 13-model catalog instead of erroring. - fishaudio: route the existing /model voice listing through the shared ParseListModel helper for consistency, keep the human-readable title as the model name, and fall back to _id when a title is blank. Also includes the shared gitee_test.go DSModelList->ModelList compile fix (infiniflow#15900 rename); it auto-resolves against the sibling infiniflow#15853 PRs. Tests: voyage static-catalog test asserts the catalog + metadata; fishaudio httptest covers the happy path, title->_id fallback, missing key, and HTTP errors. go build and go vet are clean.
|
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 (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthrough
FishAudio ListModels Refactor and Test Updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/entity/models/gitee_test.go (1)
107-109:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUse
t.Errorfinside thehttptesthandler goroutineAt Line 108,
t.Fatalfis called insidehttp.HandlerFunc. In this goroutine context, prefert.Errorfso test failure is reliably recorded without goroutine-localGoexit.Suggested fix
- if err := json.NewEncoder(w).Encode(resp); err != nil { - t.Fatalf("encode response: %v", err) - } + if err := json.NewEncoder(w).Encode(resp); err != nil { + t.Errorf("encode response: %v", err) + }Based on learnings, in
httptesthandler goroutines uset.Errorf(...)instead oft.Fatalf(...)becauset.Fatalfmay only stop that goroutine and can miss failing the overall test.🤖 Prompt for 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. In `@internal/entity/models/gitee_test.go` around lines 107 - 109, The handler goroutine currently calls t.Fatalf when encoding the response (json.NewEncoder(w).Encode(resp)) which only exits that goroutine; change that to t.Errorf to record the test failure reliably, and after calling t.Errorf return from the http.HandlerFunc to avoid further writes; specifically replace the t.Fatalf(...) call inside the httptest handler with t.Errorf(...) and an immediate return.Source: Learnings
🤖 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/voyage_test.go`:
- Around line 63-65: The test reinitializes the package-global providerManager
via InitProviderManager(dir) and doesn't restore the previous global, causing
order-dependent failures; before calling InitProviderManager in the test save
the existing providerManager value to a local variable and register a t.Cleanup
closure that restores it (or re-calls InitProviderManager with the previous
config) so the global providerManager is restored after the test; reference the
InitProviderManager call and the providerManager global when making the change
and use t.Cleanup to perform restoration.
---
Outside diff comments:
In `@internal/entity/models/gitee_test.go`:
- Around line 107-109: The handler goroutine currently calls t.Fatalf when
encoding the response (json.NewEncoder(w).Encode(resp)) which only exits that
goroutine; change that to t.Errorf to record the test failure reliably, and
after calling t.Errorf return from the http.HandlerFunc to avoid further writes;
specifically replace the t.Fatalf(...) call inside the httptest handler with
t.Errorf(...) and an immediate return.
🪄 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: 3574966b-be6e-4266-b9b0-0e41c994f11c
📒 Files selected for processing (5)
internal/entity/models/fishaudio.gointernal/entity/models/fishaudio_test.gointernal/entity/models/gitee_test.gointernal/entity/models/voyage.gointernal/entity/models/voyage_test.go
Haruko386
left a comment
There was a problem hiding this comment.
@hunnyboy1217 please show your output in RAGFlow CLI for your code tests
There was a problem hiding this comment.
@hunnyboy1217 please refer Voyage api reference for more info
… to stub (infiniflow#15853) Per review: Voyage AI's public API exposes only /v1/embeddings and /v1/rerank, with no model-list endpoint (https://docs.voyageai.com/reference). The previous static-catalog ListModels misrepresented a capability the API does not have, so revert it to the not-supported stub used by other endpoint-less providers. Also removes the static-catalog test (and its global ProviderManager mutation, which CodeRabbit flagged as order-dependent) in favour of a small test asserting ListModels returns a not-supported error. FishAudio (which does have a /model endpoint) is unchanged.
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/voyage_test.go`:
- Around line 56-57: The test in voyage_test.go for the ListModels method
currently only checks that an error is returned, but does not verify the
specific error message. Enhance the assertion to ensure that the error returned
contains the exact "no such method" text by checking that err.Error() contains
this string. This will prevent regressions where ListModels might fail with an
unrelated error instead of the expected unsupported-method error.
🪄 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: 90c90fc1-0017-48de-93c1-123307cc7631
📒 Files selected for processing (2)
internal/entity/models/voyage.gointernal/entity/models/voyage_test.go
✅ Files skipped from review due to trivial changes (1)
- internal/entity/models/voyage.go
| if _, err := newVoyageForTest("http://unused").ListModels(&APIConfig{}); err == nil { | ||
| t.Fatal("ListModels: expected not-supported error, got nil") |
There was a problem hiding this comment.
Assert the exact unsupported-method contract, not just non-nil error.
On Line 56, this test currently passes for any failure mode. Please assert that err.Error() contains "no such method" so regressions to unrelated errors don’t go undetected.
Suggested patch
func TestVoyageListModelsNotSupported(t *testing.T) {
// Voyage has no model-list endpoint, so ListModels returns a not-supported error.
- if _, err := newVoyageForTest("http://unused").ListModels(&APIConfig{}); err == nil {
- t.Fatal("ListModels: expected not-supported error, got nil")
+ if _, err := newVoyageForTest("http://unused").ListModels(&APIConfig{}); err == nil ||
+ !strings.Contains(err.Error(), "no such method") {
+ t.Fatalf("ListModels: expected no such method error, got %v", err)
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if _, err := newVoyageForTest("http://unused").ListModels(&APIConfig{}); err == nil { | |
| t.Fatal("ListModels: expected not-supported error, got nil") | |
| func TestVoyageListModelsNotSupported(t *testing.T) { | |
| // Voyage has no model-list endpoint, so ListModels returns a not-supported error. | |
| if _, err := newVoyageForTest("http://unused").ListModels(&APIConfig{}); err == nil || | |
| !strings.Contains(err.Error(), "no such method") { | |
| t.Fatalf("ListModels: expected no such method error, got %v", err) | |
| } | |
| } |
🤖 Prompt for 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.
In `@internal/entity/models/voyage_test.go` around lines 56 - 57, The test in
voyage_test.go for the ListModels method currently only checks that an error is
returned, but does not verify the specific error message. Enhance the assertion
to ensure that the error returned contains the exact "no such method" text by
checking that err.Error() contains this string. This will prevent regressions
where ListModels might fail with an unrelated error instead of the expected
unsupported-method error.
|
@Haruko386, Updated. Thank you! |
Removed outdated comments regarding Fish Audio model parsing.
Removed unsupported ListModels test for Voyage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15957 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What problem does this PR solve?
Part of #15853 (provider model-list refactor). Final two providers.
/v1/embeddingsand/v1/rerank— so the previousListModelswas ano such methodstub. Replace it with a static-catalog listing sourced from the loaded provider definition, carrying each model'smax_tokens,model_types, and embeddingdimensions.list models from voyagenow returns the 13-model catalog instead of erroring./modelvoice listing through the sharedParseListModelhelper for consistency; keep the human-readabletitleas the model name and fall back to_idwhen a title is blank.Drive-by fix
Shared gitee_test.go
DSModelList->ModelListcompile fix (renamed in #15900); auto-resolves against the sibling #15853 PRs.Type of change
How has this been tested?