fix(ui): restore standard Codex API key setup

Remove command-backed provider auth from the generated configuration and use auth.json again.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
zyycn
2026-07-26 06:17:21 +08:00
co-authored by Codex
parent 6125b10276
commit dfd496b41a
@@ -35,23 +35,13 @@ const configPath = computed(() =>
? '%userprofile%\\.codex\\config.toml'
: '~/.codex/config.toml',
)
const tokenPath = computed(() =>
activePlatform.value === 'windows'
? '%userprofile%\\.codex\\codex-proxy.token'
: '~/.codex/codex-proxy.token',
const authPath = computed(() =>
activePlatform.value === 'windows' ? '%userprofile%\\.codex\\auth.json' : '~/.codex/auth.json',
)
const codexAuthJson = computed(() => JSON.stringify({ OPENAI_API_KEY: keyValue.value }, null, 2))
const defaultModel = computed(() =>
props.apiKey?.providerKind?.trim().toLowerCase() === 'xai' ? 'grok-4.5' : 'gpt-5.5',
)
const providerAuthToml = computed(() =>
activePlatform.value === 'windows'
? `[model_providers.OpenAI.auth]
command = "powershell.exe"
args = ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", "Get-Content -Raw (Join-Path (Join-Path $env:USERPROFILE '.codex') 'codex-proxy.token')"]`
: `[model_providers.OpenAI.auth]
command = "sh"
args = ["-c", 'cat "$HOME/.codex/codex-proxy.token"']`,
)
const codexConfigToml = computed(
() => `model_provider = "OpenAI"
@@ -67,8 +57,7 @@ windows_wsl_setup_acknowledged = true
name = "OpenAI"
base_url = "${props.apiBaseUrl}"
wire_api = "responses"
${providerAuthToml.value}
requires_openai_auth = true
[features]
goals = true`,
@@ -76,7 +65,7 @@ goals = true`,
const visibleFiles = computed(() => [
{ path: configPath.value, content: codexConfigToml.value },
{ path: tokenPath.value, content: keyValue.value },
{ path: authPath.value, content: codexAuthJson.value },
])
</script>