Skip to content

Commit 0b17c05

Browse files
nullskymcclaude
andcommitted
fix: sync health.provider and auto-add model to enabledModels after settings save
When saving settings from the main settings panel: 1. health.provider wasn't updated, so the composer chip still showed "未配置" (providerUnconfigured) and the send button was disabled. 2. enabledModels wasn't included in the save payload, so the model quick-select drawer opened empty even though a model was configured. Now handleSaveSettings() directly sets health.provider after save and auto-merges the current model into enabledModels. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 27fce9f commit 0b17c05

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

apps/desktop/src/App.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,18 @@ function App() {
773773
}
774774

775775
function handleSaveSettings(draft: SettingsDraft): void {
776+
// Ensure current model is auto-added to quick-select list so the drawer isn't empty
777+
const currentEnabled = runtimeSettings?.llm.enabledModels ?? [];
778+
const mergedEnabled = currentEnabled.includes(draft.model)
779+
? currentEnabled
780+
: [draft.model, ...currentEnabled];
781+
776782
const body: UpdateRuntimeSettingsRequest = {
777783
llm: {
778784
provider: "openai",
779785
baseUrl: draft.baseUrl,
780786
model: draft.model,
787+
enabledModels: mergedEnabled,
781788
temperature: draft.temperature,
782789
timeoutMs: draft.timeoutMs,
783790
...(draft.apiKey ? { apiKey: draft.apiKey } : {}),
@@ -791,6 +798,9 @@ function App() {
791798
void updateSettings(body)
792799
.then((next) => {
793800
setRuntimeSettings(next);
801+
setHealth((previous) =>
802+
previous ? { ...previous, provider: `${next.llm.provider}:${next.llm.model}` } : previous,
803+
);
794804
setNotice(t("notice.settingsSaved"));
795805
return refreshSettings();
796806
})

0 commit comments

Comments
 (0)