[codex] 修改config的bug#30
Closed
ASIWU wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts how SciForge persists and updates the local Model Router configuration, aiming to avoid overwriting user-edited config files while still allowing “Basics” settings (API key, provider URL, default model name) to be saved from the UI.
Changes:
- Update settings patch typing so
modelRouteris treated as a dedicated patch field (avoiding type conflicts withPartial<AppSettingsV1>). - Add “Basics” save/reset controls and draft state in the General settings section for provider API key/base URL + default model name.
- Preserve existing Model Router config files (don’t rewrite on sidecar start), and add a targeted updater that only updates
profiles.default.textReasoner.{baseUrl,model}.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/app-settings-types.ts | Adjusts AppSettingsPatch typing to omit modelRouter from the generic partial and expose it as a patch field. |
| src/renderer/src/locales/zh/settings.json | Adds new i18n strings for Basics model config controls/messages. |
| src/renderer/src/locales/en/settings.json | Adds new i18n strings for Basics model config controls/messages. |
| src/renderer/src/components/SettingsView.tsx | Adds saveBasicsModelConfig to persist provider + default model in one settings write. |
| src/renderer/src/components/settings-section-general.tsx | Adds draft state + Save/Reset UI for provider credentials and default model name. |
| src/renderer/src/components/settings-section-general.test.ts | Updates rendering test to include the new Basics controls/labels. |
| src/renderer/src/components/settings-controls.tsx | Extends SettingsCard to support an optional header action area (used for Save/Reset buttons). |
| src/main/model-router-sidecar.ts | Stops overwriting existing router config; adds a targeted updater for default textReasoner URL/model. |
| src/main/model-router-sidecar.test.ts | Updates tests to reflect “don’t overwrite” behavior and validates targeted default textReasoner updates. |
| src/main/index.ts | Triggers targeted config update when default textReasoner URL/model changes via settings updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+488
to
+492
| "defaultModelNameSave": "Save", | ||
| "defaultModelNameSaving": "Saving…", | ||
| "defaultModelNameReset": "Reset", | ||
| "defaultModelNameSaved": "Default model name saved.", | ||
| "defaultModelNameRequired": "Enter a model name before saving.", |
Comment on lines
+488
to
+492
| "defaultModelNameSave": "保存", | ||
| "defaultModelNameSaving": "正在保存…", | ||
| "defaultModelNameReset": "重置", | ||
| "defaultModelNameSaved": "默认模型名称已保存。", | ||
| "defaultModelNameRequired": "请先填写模型名称再保存。", |
Comment on lines
+37
to
+41
| defaultModelNameSave: 'Save', | ||
| defaultModelNameSaving: 'Saving', | ||
| defaultModelNameReset: 'Reset', | ||
| defaultModelNameSaved: 'Default model name saved.', | ||
| defaultModelNameRequired: 'Enter a model name before saving.', |
Comment on lines
+110
to
+114
| const modelConfigChanged = | ||
| draftApiKey !== savedApiKey || | ||
| draftBaseUrl !== savedBaseUrl || | ||
| draftDefaultModelName !== defaultModelName | ||
| const saveModelConfigDraft = async (): Promise<void> => { |
Comment on lines
+1719
to
+1725
| await updateModelRouterConfigDefaultTextReasoner(saved, { | ||
| userDataDir: app.getPath('userData') | ||
| }).catch((error) => { | ||
| logWarn('model-router', 'Failed to update Model Router default text provider config.', { | ||
| message: error instanceof Error ? error.message : String(error) | ||
| }) | ||
| }) |
Contributor
|
已由本轮实现取代:Model Router 的文本/视觉/图片生成/科学翻译配置已统一放入 GUI,GUI 与 model-router/config.json 做双向同步,并移除了旧的配置旁路与空文本模型仍可对话的问题。当前本地验证已通过 npm run typecheck、npm test、npm run model-router:test,因此关闭此 PR。 |
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
Validation
npx vitest run src/renderer/src/components/settings-section-general.test.ts src/main/model-router-sidecar.test.tsnpm run typecheck