-
Notifications
You must be signed in to change notification settings - Fork 55
feat: OpenRouter #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Junyi-99
wants to merge
14
commits into
main
Choose a base branch
from
feat-switch-to-completion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: OpenRouter #50
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Yiwei Gong <imwithye@gmail.com>
Junyi-99
commented
Dec 15, 2025
Junyi-99
commented
Dec 15, 2025
Junyi-99
commented
Dec 15, 2025
internal/services/chat.go
Outdated
| ProjectID: projectID, | ||
| Title: DefaultConversationTitle, | ||
| LanguageModel: languageModel, | ||
| ModelSlug: modelSlug, |
Member
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compatible
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Junyi-99
commented
Dec 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a significant refactor to how language models are referenced and handled across the codebase, moving from a legacy enum-based approach to a more flexible string-based "model slug" system. It also upgrades the OpenAI client library to v3 and updates configuration to use a new inference service. Additionally, several new models are now supported, and the handling of conversation history has been modernized for better compatibility and extensibility.
Key changes include:
Model Handling and API Changes:
Replaced the use of the deprecated
LanguageModelenum throughout the API with a newmodelSlugstring field, updating all relevant function signatures and data structures to use the new approach. This includes fallback logic for backward compatibility. (internal/api/chat/create_conversation_message_stream.go,internal/api/chat/create_conversation_message_stream_helper.go,internal/models/conversation.go,internal/api/mapper/conversation.go) [1] F51da0ccL99, F51da0ccL165, F51da0ccL208, F51da0ccL236, [2] [3]Upgraded the OpenAI client from v2 to v3 and refactored all usages and data types accordingly, including the way chat history is stored and sent. (
go.mod,internal/api/chat/create_conversation_message_stream_helper.go,internal/models/conversation.go,internal/api/chat/list_supported_models.go) [1] [2] [3] F51da0ccL53, F51da0ccL70, F51da0ccL114, F51da0ccL154, [4] [5] [6] [7]Supported Models Expansion:
openai/gpt-4o). (internal/api/chat/list_supported_models.go)Configuration Refactor:
OpenAIBaseURL,OpenAIAPIKey) to more generic inference service fields (PDInferenceBaseURL,PDInferenceAPIKey) throughout the codebase and tests. (internal/libs/cfg/cfg.go,internal/libs/cfg/cfg_test.go) [1] F5f06866L19, F5f06866L29, [2]Codebase Cleanup:
CreateConversationMessagemethod and its supporting code, consolidating all conversation message creation through the streaming API. (internal/api/chat/create_conversation_message_stream_helper.go)These changes modernize the model selection process, improve extensibility for future models and providers, and align the codebase with the latest OpenAI client and internal infrastructure.