Skip to content

[codex] 修改config的bug#30

Closed
ASIWU wants to merge 1 commit into
guifrom
codex/modify-config-bug
Closed

[codex] 修改config的bug#30
ASIWU wants to merge 1 commit into
guifrom
codex/modify-config-bug

Conversation

@ASIWU

@ASIWU ASIWU commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve existing model router config files instead of overwriting manual edits.
  • Add Basics controls for saving/resetting API key, provider URL, and default model name together.
  • Persist only targeted default text reasoner URL/model changes while keeping manual config fields intact.

Validation

  • npx vitest run src/renderer/src/components/settings-section-general.test.ts src/main/model-router-sidecar.test.ts
  • npm run typecheck

@ASIWU
ASIWU marked this pull request as ready for review July 6, 2026 05:06
Copilot AI review requested due to automatic review settings July 6, 2026 05:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 modelRouter is treated as a dedicated patch field (avoiding type conflicts with Partial<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 thread src/main/index.ts
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)
})
})
@gaozhangyang

Copy link
Copy Markdown
Contributor

已由本轮实现取代:Model Router 的文本/视觉/图片生成/科学翻译配置已统一放入 GUI,GUI 与 model-router/config.json 做双向同步,并移除了旧的配置旁路与空文本模型仍可对话的问题。当前本地验证已通过 npm run typecheck、npm test、npm run model-router:test,因此关闭此 PR。

@ASIWU
ASIWU deleted the codex/modify-config-bug branch July 7, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants