Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(settings): 「编辑连接设置」放开 Pi runtime 的 base URL
Zhang Yunjinb80352598c19
diff --git a/apps/desktop/src/renderer/components/settings/ProviderConnectionDialog.tsx b/apps/desktop/src/renderer/components/settings/ProviderConnectionDialog.tsxindex 7a8af183e4..859d98cd4a 100644--- a/apps/desktop/src/renderer/components/settings/ProviderConnectionDialog.tsx+++ b/apps/desktop/src/renderer/components/settings/ProviderConnectionDialog.tsx@@ -1202,7 +1202,8 @@ export function ProviderConnectionDialog({const boundPreset = presets.find(preset => preset.id === f.catalogPresetId);const templateBound = Boolean(f.catalogPresetId);const endpointTemplate = boundPreset?.runtimes[activeTab]?.baseUrl;- const fixedTemplateEndpoint = templateBound && !endpointTemplate?.includes('{');+ // 只有 Pi runtime 的端点对用户开放改写;Claude / Codex 的模板绑定端点保持只读。+ const fixedTemplateEndpoint = activeTab !== 'pi' && templateBound && !endpointTemplate?.includes('{');// Google inference and discovery already resolve to this native endpoint. The old// compatibility base remains stored as a template reference, never an editable choice.const displayedBaseUrl = fixedTemplateEndpoint && f.catalogPresetId === 'google-gemini-api'diff --git a/apps/desktop/src/renderer/components/settings/__tests__/CustomProviderDialogAccessibility.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/CustomProviderDialogAccessibility.test.tsxindex b2c6996929..d991259918 100644--- a/apps/desktop/src/renderer/components/settings/__tests__/CustomProviderDialogAccessibility.test.tsx+++ b/apps/desktop/src/renderer/components/settings/__tests__/CustomProviderDialogAccessibility.test.tsx@@ -2006,7 +2006,31 @@ it('keeps a template connection editable without offering protocol or path switcexpect(JSON.stringify(customProviderMocks.updateCustomProvider.mock.calls[0])).not.toContain('other.example');});- it('allows a cloud account endpoint but rejects changing its fixed host pattern', async () => {+ it('lets an existing preset connection edit the Pi endpoint while Codex keeps the preset address', async () => {+ const preset = { id: 'preset-endpoint', name: 'Preset Endpoint', runtimes: {+ codex: { baseUrl: 'https://codex.example.test/v1', wireProtocol: 'openai-responses' as const,+ models: [{ id: 'm', name: 'M' }] },+ pi: { baseUrl: 'https://pi.example.test/v1', wireProtocol: 'openai-chat' as const,+ models: [{ id: 'm', name: 'M' }] },+ } };+ vi.mocked(window.electronAPI.maker.listProviderPresets).mockResolvedValue({ presets: [preset] });+ customProviderMocks.readCustomProviderKey.mockResolvedValue(null);+ render(<ProviderConnectionDialog initial={{ id: 'preset-endpoint-live', name: 'Live', runtimes: {+ codex: { ...preset.runtimes.codex, catalogPresetId: preset.id },+ pi: { ...preset.runtimes.pi, catalogPresetId: preset.id },+ } }} focusAgent="pi" onSaved={vi.fn()} onClose={vi.fn()} />);+ await waitForInitialDialogFocus();+ const endpoint = screen.getByLabelText('settings.providers.custom.fields.baseUrl') as HTMLInputElement;+ await waitFor(() => expect(endpoint.readOnly).toBe(false));+ fireEvent.change(endpoint, { target: { value: 'https://relay.example.test/v1' } });+ fireEvent.click(screen.getByRole('button', { name: 'settings.providers.custom.save' }));+ await waitFor(() => expect(customProviderMocks.updateCustomProvider).toHaveBeenCalledOnce());+ const saved = customProviderMocks.updateCustomProvider.mock.calls[0][0];+ expect(saved.runtimes.pi.baseUrl).toBe('https://relay.example.test/v1');+ expect(saved.runtimes.codex.baseUrl).toBe('https://codex.example.test/v1');+});++it('allows a cloud account endpoint but rejects changing its fixed host pattern', async () => {const preset = { id: 'cloud-account', name: 'Cloud account', authMethod: 'apiKey' as const,runtimes: { codex: { baseUrl: 'https://{account}.example.test/v1', wireProtocol: 'openai-responses' as const,models: [{ id: 'deployment', name: 'Deployment' }] } } };