fix(ai): restore default model configuration

This commit is contained in:
zipg 2026-08-02 10:09:01 +08:00 committed by GitHub
parent 8379f0d048
commit 2dffbb9286
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -5540,6 +5540,12 @@ onUnmounted(cleanupPreviewEditor);
</div>
</div>
<!-- Default Model -->
<div v-if="!aiIsCliProvider" class="grid grid-cols-3 items-center gap-3">
<Label class="text-right text-xs">{{ t("ai.defaultModel") }}</Label>
<Input v-model="aiEditModel" autocomplete="off" class="col-span-2 h-8 text-xs" :placeholder="t('ai.manualModelPlaceholder')" />
</div>
<!-- Context Window -->
<div v-if="!aiIsCliProvider" class="grid grid-cols-3 items-start gap-3">
<Label class="text-right text-xs">{{ t("ai.contextWindow") }}</Label>

View File

@ -548,6 +548,15 @@ test("AI provider presets include common hosted and local providers", () => {
assert.ok(Object.keys(AI_PROVIDER_PRESETS).indexOf("codex-cli") < Object.keys(AI_PROVIDER_PRESETS).indexOf("pi-agent-cli"));
});
test("API AI provider settings expose and persist a default model ID", () => {
const source = readFileSync("apps/desktop/src/components/editor/EditorSettingsDialog.vue", "utf8");
const modelControl = source.indexOf('<Input v-model="aiEditModel"');
assert.ok(modelControl >= 0);
assert.match(source.slice(modelControl - 300, modelControl + 300), /v-if="!aiIsCliProvider"[\s\S]*t\("ai\.defaultModel"\)[\s\S]*t\('ai\.manualModelPlaceholder'\)/);
assert.match(source, /model:\s*aiEditModel\.value/);
});
test("normalizes legacy AI config and fills provider defaults", () => {
const legacy = normalizeAiConfig({
provider: "openai",