Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(providers): keep preset routes authoritative
Chrisfa31d69da875
diff --git a/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx b/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsxindex 2973d3226d..1c5093c17f 100644--- a/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx+++ b/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx@@ -690,6 +690,36 @@ describe('AddProviderWizard — preset 直达', () => {expect(keys.codex).toBe('glm-key');});+ it('智谱主目录失败时附加目录不会改写预设模型的 V4 路由', async () => {+ vi.mocked(window.electronAPI.maker.fetchProviderModels).mockImplementation(+ async ({ baseUrl }: { baseUrl: string }) =>+ baseUrl === 'https://open.bigmodel.cn/api/v1'+ ? {+ ok: true,+ models: [+ { id: 'glm-5.2', name: 'GLM-5.2' },+ { id: 'glm-5.3', name: 'GLM-5.3' },+ ],+ }+ : { ok: false },+ );+ renderWizard('zhipu-coding-plan-cn');++ await waitFor(() => expect(screen.getByDisplayValue('Zhipu GLM Coding Plan')).not.toBeNull());+ fireEvent.change(screen.getByPlaceholderText('sk-…'), { target: { value: 'glm-key' } });+ fireEvent.click(screen.getByText('settings.providers.wizard.next'));+ await screen.findByText('GLM-5.3');+ fireEvent.click(screen.getByText('settings.providers.wizard.finish'));++ await waitFor(() => expect(createCustomProvider).toHaveBeenCalledTimes(1));+ const runtime = vi.mocked(createCustomProvider).mock.calls[0][0].runtimes.codex;+ expect(runtime).toMatchObject({+ baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4',+ wireProtocol: 'openai-chat',+ });+ expect(runtime?.models).toEqual([{ id: 'glm-5.2', name: 'GLM-5.2' }]);+ });+it('LiteLLM:清空可编辑端点后不回退预设地址,也不能继续', async () => {renderWizard('litellm');diff --git a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsxindex e4fda9cd31..d365f78d9d 100644--- a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx+++ b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx@@ -698,8 +698,11 @@ export function AddProviderWizard({// 「预设没写窗口」的兜底)。const backfillWindow =existing.contextWindows?.[agent] === undefined && m.contextWindow !== undefined;+ const presetOwnsModel =+ preset.runtimes[agent]?.models.some((model) => model.id === m.id) === true;const discoveredRoute =route &&+ !presetOwnsModel &&!defaultDiscoveredModels.has(`${agent}\u0000${m.id}`) &&!existing.routes?.[agent]? route