From 1afe5ffe35ce2ede434267f5166f900ee0eabc2a Mon Sep 17 00:00:00 2001 From: danvilig <230506945+danvilig@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:18:34 +0000 Subject: [PATCH] fix(frontend): enable live web search in Codex exports --- frontend/src/components/keys/UseKeyModal.vue | 2 ++ frontend/src/components/keys/__tests__/UseKeyModal.spec.ts | 4 ++++ frontend/src/i18n/locales/en/dashboard.ts | 2 +- frontend/src/i18n/locales/zh/dashboard.ts | 2 +- frontend/src/utils/__tests__/ccswitchImport.spec.ts | 1 + frontend/src/utils/ccswitchImport.ts | 1 + 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/keys/UseKeyModal.vue b/frontend/src/components/keys/UseKeyModal.vue index 06ef4c2164..183ed549f0 100644 --- a/frontend/src/components/keys/UseKeyModal.vue +++ b/frontend/src/components/keys/UseKeyModal.vue @@ -1035,6 +1035,7 @@ function generateOpenAIFiles(baseUrl: string, apiKey: string): FileConfig[] { const configContent = `model_provider = "OpenAI" model = "${model}" review_model = "${model}" +web_search = "live" ${reasoningEffortLine}disable_response_storage = true ${codexLocalCatalogToml.value}network_access = "enabled" windows_wsl_setup_acknowledged = true @@ -1381,6 +1382,7 @@ function generateOpenAIWsFiles(baseUrl: string, apiKey: string): FileConfig[] { const configContent = `model_provider = "OpenAI" model = "${model}" review_model = "${model}" +web_search = "live" ${reasoningEffortLine}disable_response_storage = true ${codexLocalCatalogToml.value}network_access = "enabled" windows_wsl_setup_acknowledged = true diff --git a/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts b/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts index c1d5f8ed53..dbfda0381e 100644 --- a/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts +++ b/frontend/src/components/keys/__tests__/UseKeyModal.spec.ts @@ -411,6 +411,7 @@ describe('UseKeyModal', () => { expect(configToml).not.toContain('model = "gpt-5.4"') expect(configToml).not.toContain('model_context_window') expect(configToml).not.toContain('model_auto_compact_token_limit') + expect(configToml?.split('[model_providers.')[0]).toContain('web_search = "live"') expect(configToml).toContain('requires_openai_auth = true') expect(configToml).not.toContain('experimental_bearer_token') expect(configToml).not.toContain('x-openai-actor-authorization') @@ -494,6 +495,7 @@ describe('UseKeyModal', () => { expect(apiKeyMode.attributes('aria-checked')).toBe('true') expect(configToml).toBeDefined() expect(configToml).toContain('requires_openai_auth = false') + expect(configToml?.split('[model_providers.')[0]).toContain('web_search = "live"') expect(configToml).toContain('experimental_bearer_token = "sk-test"') expect(configToml).toContain('http_headers = { "x-openai-actor-authorization" = "local-image-extension" }') expect(configToml).toContain('model_catalog_url = "https://example.com/v1/models"') @@ -556,6 +558,7 @@ describe('UseKeyModal', () => { expect(configToml).not.toContain('model = "gpt-5.4"') expect(configToml).not.toContain('model_context_window') expect(configToml).not.toContain('model_auto_compact_token_limit') + expect(configToml?.split('[model_providers.')[0]).toContain('web_search = "live"') expect(configToml).toContain('requires_openai_auth = true') expect(configToml).not.toContain('experimental_bearer_token') expect(configToml).not.toContain('x-openai-actor-authorization') @@ -607,6 +610,7 @@ describe('UseKeyModal', () => { expect(wrapper.get('[data-testid="codex-auth-mode-api-key"]').attributes('aria-checked')).toBe('true') expect(configToml).toBeDefined() expect(configToml).toContain('requires_openai_auth = false') + expect(configToml?.split('[model_providers.')[0]).toContain('web_search = "live"') expect(configToml).toContain('experimental_bearer_token = "sk-test"') expect(configToml).toContain('http_headers = { "x-openai-actor-authorization" = "local-image-extension" }') expect(configToml).not.toContain('env_key') diff --git a/frontend/src/i18n/locales/en/dashboard.ts b/frontend/src/i18n/locales/en/dashboard.ts index f7555b10ea..1df52c64bc 100644 --- a/frontend/src/i18n/locales/en/dashboard.ts +++ b/frontend/src/i18n/locales/en/dashboard.ts @@ -168,7 +168,7 @@ export default { openai: { description: 'Add the following configuration files to your Codex CLI config directory.', authModeTitle: 'Codex authentication mode', - authModeDescription: 'API Key mode supports native Codex image generation by default. Choose compatibility mode for older clients.', + authModeDescription: 'The configuration enables live web search. API Key mode supports native Codex image generation by default. Choose compatibility mode for older clients.', authModeLegacy: 'Compatibility mode', authModeApiKey: 'API Key Mode (recommended)', authModeApiKeyRestartNotice: 'This configuration contains your API key; do not share it or commit it. Save it and test in a new conversation; restart Codex if it has not loaded. Image generation still requires group permission, available balance, and upstream support.', diff --git a/frontend/src/i18n/locales/zh/dashboard.ts b/frontend/src/i18n/locales/zh/dashboard.ts index 2ef7462628..2275d1ae90 100644 --- a/frontend/src/i18n/locales/zh/dashboard.ts +++ b/frontend/src/i18n/locales/zh/dashboard.ts @@ -168,7 +168,7 @@ export default { openai: { description: '将以下配置文件添加到 Codex CLI 配置目录中。', authModeTitle: 'Codex 认证模式', - authModeDescription: '默认 API Key 模式支持 Codex 原生生图;旧版客户端可选择兼容模式。', + authModeDescription: '配置默认启用实时联网搜索;API Key 模式支持 Codex 原生生图,旧版客户端可选择兼容模式。', authModeLegacy: '兼容模式', authModeApiKey: 'API Key 模式(推荐)', authModeApiKeyRestartNotice: '此配置包含 API 密钥,请勿共享或提交到仓库。保存后新建会话验证;若配置未加载,再重启 Codex。生图仍需分组权限、可用余额和上游支持。', diff --git a/frontend/src/utils/__tests__/ccswitchImport.spec.ts b/frontend/src/utils/__tests__/ccswitchImport.spec.ts index e3a8aea552..4c7d509469 100644 --- a/frontend/src/utils/__tests__/ccswitchImport.spec.ts +++ b/frontend/src/utils/__tests__/ccswitchImport.spec.ts @@ -52,6 +52,7 @@ describe('ccswitchImport utils', () => { expect(params.get('configFormat')).toBe('json') expect(payload.config).toContain(`base_url = "${endpoint}"`) expect(payload.config).toContain(`model = "${OPENAI_CC_SWITCH_CODEX_MODEL}"`) + expect(payload.config.split('[model_providers.')[0]).toContain('web_search = "live"') expect(payload.config).toContain('requires_openai_auth = false') expect(payload.config).toContain('experimental_bearer_token = "sk-test"') expect(payload.config).toContain('"x-openai-actor-authorization" = "local-image-extension"') diff --git a/frontend/src/utils/ccswitchImport.ts b/frontend/src/utils/ccswitchImport.ts index 4985fc6e3e..45625587e9 100644 --- a/frontend/src/utils/ccswitchImport.ts +++ b/frontend/src/utils/ccswitchImport.ts @@ -117,6 +117,7 @@ export function buildCcSwitchImportDeeplink(input: CcSwitchImportDeeplinkInput): // It deliberately leaves global [features] settings to the user. const codexConfig = `model_provider = "sub2api" model = ${JSON.stringify(config.model)} +web_search = "live" [model_providers.sub2api] name = "Sub2API"