Repository navigation
Go: update chat URL - #14453
Go: update chat URL#14453
Conversation
Signed-off-by: Jin Hai <[email protected]>
📝 WalkthroughWalkthroughThe PR refactors the chat-to-model endpoint from a provider-instance-specific path to a unified Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/router/router.go`:
- Line 221: Add a deprecated compatibility alias that keeps the old POST
/api/v1/providers/:provider_name/instances/:instance_name/models route pointing
to the same handler as the new route; i.e., register a v1.POST for
"/providers/:provider_name/instances/:instance_name/models" that calls
r.providerHandler.ChatToModel so existing CLI/clients continue to work while you
roll out the new POST "/chat/completions" endpoint.
🪄 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: e68da0dc-117c-4660-b4ce-30f9cdc4fd71
📒 Files selected for processing (3)
internal/cli/user_command.gointernal/handler/providers.gointernal/router/router.go
| provider.GET("/:provider_name/instances/:instance_name/models", r.providerHandler.ListInstanceModels) | ||
| provider.PATCH("/:provider_name/instances/:instance_name/models/*model_name", r.providerHandler.EnableOrDisableModel) | ||
| provider.POST("/:provider_name/instances/:instance_name/models", r.providerHandler.ChatToModel) | ||
| v1.POST("/chat/completions", r.providerHandler.ChatToModel) |
There was a problem hiding this comment.
Keep a compatibility alias for the old chat route.
This replaces the existing POST /api/v1/providers/:provider_name/instances/:instance_name/models contract with POST /api/v1/chat/completions. The CLI and frontend in this PR are updated, but any other /api/v1 clients will break immediately. Please keep the legacy route as a deprecated alias, or version the API change explicitly.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@internal/router/router.go` at line 221, Add a deprecated compatibility alias
that keeps the old POST
/api/v1/providers/:provider_name/instances/:instance_name/models route pointing
to the same handler as the new route; i.e., register a v1.POST for
"/providers/:provider_name/instances/:instance_name/models" that calls
r.providerHandler.ChatToModel so existing CLI/clients continue to work while you
roll out the new POST "/chat/completions" endpoint.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14453 +/- ##
==========================================
- Coverage 96.72% 95.30% -1.43%
==========================================
Files 10 10
Lines 703 703
Branches 112 112
==========================================
- Hits 680 670 -10
- Misses 12 16 +4
- Partials 11 17 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
### What problem does this PR solve? Update the URL to: /api/v1/chat/completions ### Type of change - [x] Refactoring Signed-off-by: Jin Hai <[email protected]>
### What problem does this PR solve? Update the URL to: /api/v1/chat/completions ### Type of change - [x] Refactoring Signed-off-by: Jin Hai <[email protected]>
What problem does this PR solve?
Update the URL to: /api/v1/chat/completions
Type of change