feat: configurable embedding/description models via TUI settings menu#9
Merged
Conversation
- Extend runtime overrides with embedding.provider/model/baseUrl and description.provider/model/baseUrl fields - Add string value support to saveRuntimeOverride() - Add Embedding category and extend LLM Descriptions category in the TUI settings dialog (Ctrl+Shift+R) - Model picker populates from api.state.provider (OpenCode providers), grouped by provider name matching native look & feel - Include 'Custom...' option for manual model entry - Show re-index warning when embedding model changes - Apply runtime overrides at plugin startup so saved settings take effect on next plugin reload - Resolve OpenAI API keys from OpenCode provider config - 13 new tests for runtime-override fields
There was a problem hiding this comment.
Pull request overview
This PR adds TUI-driven configuration of embedding and description LLM models by storing runtime overrides in the workspace vectorstore directory, and ensures those overrides are applied during plugin startup so changes take effect on reload.
Changes:
- Extended the TUI settings dialog with select-style entries (including a model picker and custom entry) for embedding and description models.
- Expanded runtime overrides to support embedding/description provider, model, and baseUrl, including string-valued overrides.
- Updated plugin startup to apply runtime overrides earlier and attempt to resolve missing OpenAI API keys from OpenCode provider config files.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/tui.ts | Adds model-picker UI and string-based settings entries for embedding and description model selection. |
| src/plugin.ts | Applies runtime overrides before service construction and adds OpenCode config API-key resolution helper. |
| src/core/runtime-overrides.ts | Extends override schema and merge logic to include embedding/description provider/model/baseUrl and string values. |
| src/tests/core/runtime-overrides.test.ts | Adds unit tests for string overrides and new embedding/description override merge behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+675
to
+677
| function stripJsoncComments(text: string): string { | ||
| return text.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, ""); | ||
| } |
Comment on lines
+225
to
+226
| for (const provider of providers) { | ||
| if (!provider.models) continue; |
Comment on lines
+310
to
+314
| function displayModel(roProvider: unknown, roModel: unknown, cfgProvider: unknown, cfgModel: unknown, defaultProvider: string, defaultModel: string): string { | ||
| const p = (roProvider as string) ?? (cfgProvider as string) ?? defaultProvider; | ||
| const m = (roModel as string) ?? (cfgModel as string) ?? defaultModel; | ||
| return `${p}/${m}`; | ||
| } |
Comment on lines
+665
to
+669
| /** | ||
| * Resolve missing API keys from OpenCode provider config files. | ||
| * Reads the workspace and global OpenCode config to find the provider | ||
| * and extract its apiKey. Falls back to env vars. | ||
| */ |
Comment on lines
+746
to
+752
| // Apply runtime overrides before creating services | ||
| const overrides = loadRuntimeOverrides(storePath); | ||
| const effectiveCfg = applyRuntimeOverrides(cfg, overrides); | ||
|
|
||
| // Resolve API keys from OpenCode provider config if not set in opencode-rag.json | ||
| resolveApiKeyFromProviderConfig(effectiveCfg, input.directory, logFilePath); | ||
|
|
…ution, and manifest schema versioning
Owner
Author
|
Still needs some more testing before merging it... |
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.
Summary
Embedding and description models can now be configured via the OpenCode TUI settings dialog (Ctrl+Shift+R), without editing opencode-rag.json.
Changes
TUI settings (src/tui.ts)
Runtime overrides (src/core/runtime-overrides.ts)
Plugin startup (src/plugin.ts)
Tests