Repository navigation
feat(go): Add DeepSeek models and Gitee alias metadata tests - #15885
Conversation
📝 WalkthroughWalkthroughThis PR extends the model registry by adding DeepSeek base variants and expanded aliases, then introduces comprehensive tests validating Gitee provider model listing with proper alias-to-metadata mapping and metadata field propagation. ChangesDeepSeek Model Registry and Gitee Provider Tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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/gitee_test.go`:
- Around line 107-109: In the httptest handler in
internal/entity/models/gitee_test.go replace the call to t.Fatalf("encode
response: %v", err) inside the goroutine with t.Errorf("encode response: %v",
err) and return immediately after logging the error to stop further handler
work; locate the json.NewEncoder(w).Encode(resp) call in the
httptest.NewServer(http.HandlerFunc(...)) handler and swap t.Fatalf for t.Errorf
plus a return so the test failure is reported from the handler goroutine without
calling Fatalf.
🪄 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: 7e3a5f37-735e-46fa-bc61-b0e1a27adfbb
📒 Files selected for processing (2)
conf/all_models.jsoninternal/entity/models/gitee_test.go
| if err := json.NewEncoder(w).Encode(resp); err != nil { | ||
| t.Fatalf("encode response: %v", err) | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify handler-goroutine Fatal* usage in model tests.
rg -nP --type=go 'httptest\.NewServer\(http\.HandlerFunc\(' internal/entity/models -C4
rg -nP --type=go 't\.Fatalf\(' internal/entity/models/*_test.go -C2Repository: infiniflow/ragflow
Length of output: 50375
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the specific location mentioned in the review comment
sed -n '90,130p' internal/entity/models/gitee_test.go
# Confirm whether any t.Fatalf exists anywhere under internal/entity/models/*_test.go
rg -n --type=go 't\.Fatalf\(' internal/entity/models/*_test.goRepository: infiniflow/ragflow
Length of output: 42745
Avoid t.Fatalf in net/http handler goroutines (use t.Errorf instead).
internal/entity/models/gitee_test.go calls t.Fatalf("encode response: %v", err) inside the httptest.NewServer(http.HandlerFunc(...)) handler. Replace it so the test failure is reported reliably from that handler goroutine.
Suggested patch
- 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)
+ }📝 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 := 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) | |
| } |
🤖 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, In the httptest
handler in internal/entity/models/gitee_test.go replace the call to
t.Fatalf("encode response: %v", err) inside the goroutine with t.Errorf("encode
response: %v", err) and return immediately after logging the error to stop
further handler work; locate the json.NewEncoder(w).Encode(resp) call in the
httptest.NewServer(http.HandlerFunc(...)) handler and swap t.Fatalf for t.Errorf
plus a return so the test failure is reported from the handler goroutine without
calling Fatalf.
Source: Learnings
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15885 +/- ##
=======================================
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:
|
This PR expands conf/all_models.json with DeepSeek model entries and provider aliases.
Changes:
V4,V3.2,V3.1,V3,R1,Coder,Math,VL,OCR,Prover,MoE, andLLMseries.Test:
/usr/local/go/bin/go clean -cache
/usr/local/go/bin/go test ./internal/entity/models -run 'TestGiteeListModels(MapsAllDeepSeekAliasesToModelMetadata|KeepsOwnedBySuffixAfterAliasMetadataLookup| Integration)'
#15853