Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes chat model selection provider-aware and improves how Azure OpenAI prompts are initialized, fixing ambiguous model IDs and odd Azure responses.
Changes:
- Extend the chat settings schema with a
defaultProviderfield, update defaults, and normalizedefaultProvider/defaultModelon load inSettingsService. - Update
AIServiceto resolve the active provider/model using bothdefaultProvideranddefaultModel, with sensible fallbacks and clearer error handling. - Fix the ChatPopup model selector to use unique per-provider model keys and persist both provider and model; plumb
defaultProviderthroughmain.tsintoTextSelectionServiceso Azure OpenAI gets an appropriate initial message role.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/types/setting.d.ts |
Adds chat.defaultProvider to the settings type so provider choice is tracked alongside the default model. |
settings.default.json |
Adds defaultProvider to the default chat config and initializes it to null for backwards compatibility. |
electron/SettingsService.ts |
Normalizes settings on startup to ensure chat.defaultProvider/defaultModel always point to a valid provider/model pair, falling back to the first available model when necessary. |
src/services/AIService.ts |
Uses defaultProvider + defaultModel to select the active provider/model, with fallback resolution by model ID and finally the first configured provider/model, and throws a single consolidated error when resolution fails. |
src/pages/ChatPopup/ChatPopup.tsx |
Constructs unique model selection keys from providerId::modelId, computes a consistent selected key from defaultProvider/defaultModel, and updates both values on selection change. |
main.ts |
Passes the current chat.defaultProvider into TextSelectionService.handleTextSelection for both hotkey execution and manual text selection triggers. |
electron/TextSelectionService.ts |
Accepts an optional providerId and sets the initial prompt message role to user specifically for the azure-openai provider, otherwise keeping it as system. |
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
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.
Pull Request Template
Description
Related Issue
Closes #15
Type of Change
Checklist