fix(openai): 修复关闭 codex_cli_only 无法持久化问题
在编辑 OpenAI OAuth 账号时,若 codex_cli_only 从开启切换为关闭, 现改为显式写入 false,避免 extra 为空时后端忽略更新导致旧值残留。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1823,6 +1823,7 @@ const handleSubmit = async () => {
|
||||
if (props.account.platform === 'openai' && (props.account.type === 'oauth' || props.account.type === 'apikey')) {
|
||||
const currentExtra = (props.account.extra as Record<string, unknown>) || {}
|
||||
const newExtra: Record<string, unknown> = { ...currentExtra }
|
||||
const hadCodexCLIOnlyEnabled = currentExtra.codex_cli_only === true
|
||||
if (openaiPassthroughEnabled.value) {
|
||||
newExtra.openai_passthrough = true
|
||||
} else {
|
||||
@@ -1830,10 +1831,15 @@ const handleSubmit = async () => {
|
||||
delete newExtra.openai_oauth_passthrough
|
||||
}
|
||||
|
||||
if (props.account.type === 'oauth' && codexCLIOnlyEnabled.value) {
|
||||
newExtra.codex_cli_only = true
|
||||
} else {
|
||||
delete newExtra.codex_cli_only
|
||||
if (props.account.type === 'oauth') {
|
||||
if (codexCLIOnlyEnabled.value) {
|
||||
newExtra.codex_cli_only = true
|
||||
} else if (hadCodexCLIOnlyEnabled) {
|
||||
// 关闭时显式写 false,避免 extra 为空被后端忽略导致旧值无法清除
|
||||
newExtra.codex_cli_only = false
|
||||
} else {
|
||||
delete newExtra.codex_cli_only
|
||||
}
|
||||
}
|
||||
|
||||
updatePayload.extra = newExtra
|
||||
|
||||
Reference in New Issue
Block a user