Repository navigation
Go: add tools for gitee, volcengine and zhipuAI - #17091
Conversation
|
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 (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughGitee, VolcEngine, and Zhipu chat models now serialize tool calls, accept tool configuration, parse non-streaming tool-call responses, and collect streamed tool-call fragments. Zhipu adds SSE integration coverage, while comments are clarified in model types and handler code. ChangesTool-call support across chat providers
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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: 6
🧹 Nitpick comments (1)
internal/entity/models/gitee.go (1)
412-417: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueConcatenating
idacross fragments can corrupt the tool-call id.OpenAI-style streaming emits
idonly in the first fragment, but if an upstream ever repeats it,existing["id"] = eid + idyields e.g.call-1call-1.idshould be set-once, not concatenated (unlikearguments). Same pattern exists involcengine.goandzhipu-ai.go.🤖 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.go` around lines 412 - 417, Update the tool-call fragment merging logic in gitee.go so the `id` field is set only when no existing ID is present, never concatenated across fragments. Apply the same set-once behavior to the corresponding tool-call merge logic in volcengine.go and zhipu-ai.go, while preserving argument concatenation.
🤖 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.go`:
- Around line 212-229: Update the non-streaming response parsing in the
content-extraction logic of internal/entity/models/gitee.go (site 212-229) and
internal/entity/models/volcengine.go (site 226-233) so missing or non-string
message content defaults to an empty string instead of returning an error;
preserve the existing tool_calls extraction so tool-only responses populate
ToolCalls in both drivers.
- Around line 128-131: Forward chatModelConfig.ToolChoice in the Gitee request
body wherever chatModelConfig.Tools is forwarded, including both non-streaming
and streaming request construction paths. Preserve the existing conditional
handling and use the same request key expected by the other providers.
In `@internal/entity/models/types.go`:
- Line 69: Update the documentation comment for the TokenUsage type to remove
the stale “ChatUsage” name, so the comment begins with “TokenUsage” and
accurately describes the current type.
In `@internal/entity/models/volcengine.go`:
- Around line 320-343: Update the streaming effort switch in the
request-building logic to handle "xhigh" consistently with the non-streaming
switch, enabling it with the appropriate reasoning_effort value. Keep existing
handling for all other effort levels and avoid routing "xhigh" to the
invalid-effort default.
In `@internal/entity/models/zhipu-ai.go`:
- Around line 485-488: In the OpenAI-compatible end-of-stream block, replace the
invalid new("[DONE]") expression with a string variable initialized to "[DONE]"
and pass its pointer to sender. Preserve the existing error return behavior in
the surrounding stream completion logic.
In `@internal/handler/models.go`:
- Around line 27-32: Update the GoDoc comments for ModelHandler and
NewModelHandler to start with their current symbol names and describe the model
handler directly; remove the stale ProviderHandler and NewProviderHandler
references without changing the implementation.
---
Nitpick comments:
In `@internal/entity/models/gitee.go`:
- Around line 412-417: Update the tool-call fragment merging logic in gitee.go
so the `id` field is set only when no existing ID is present, never concatenated
across fragments. Apply the same set-once behavior to the corresponding
tool-call merge logic in volcengine.go and zhipu-ai.go, while preserving
argument concatenation.
🪄 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: d91fe8f4-cc36-4494-bce6-8ddc4d83cb7e
📒 Files selected for processing (6)
internal/entity/models/gitee.gointernal/entity/models/types.gointernal/entity/models/volcengine.gointernal/entity/models/zhipu-ai.gointernal/entity/models/zhipu_ai_test.gointernal/handler/models.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Haruko386
left a comment
There was a problem hiding this comment.
done, forget to push
Summary
As title