feat(settings): add Enable Fast toggle for Codex service tier
This commit is contained in:
@@ -121,6 +121,7 @@ interface AgentDraft {
|
||||
codexReasoningEffort: CodexReasoningEffort
|
||||
codexSupportsWebsockets: boolean
|
||||
codexSkills: boolean
|
||||
codexServiceTierFast: boolean
|
||||
claudeMainModel: string
|
||||
claudeReasoningModel: string
|
||||
claudeDefaultHaikuModel: string
|
||||
@@ -1147,6 +1148,7 @@ interface CodexTomlImportantValues {
|
||||
providerSupportsWebsockets: Record<string, boolean>
|
||||
featureResponsesWebsocketsV2: boolean
|
||||
featureSkills: boolean
|
||||
serviceTierFast: boolean
|
||||
}
|
||||
|
||||
interface CodexImportantValues {
|
||||
@@ -1158,6 +1160,7 @@ interface CodexImportantValues {
|
||||
providerOptions: string[]
|
||||
supportsWebsockets: boolean
|
||||
skills: boolean
|
||||
serviceTierFast: boolean
|
||||
}
|
||||
|
||||
const CODEX_DEFAULT_MODEL_PROVIDER = "codeg"
|
||||
@@ -1319,6 +1322,7 @@ function extractCodexTomlImportantValues(
|
||||
CODEX_DEFAULT_REASONING_EFFORT
|
||||
let featureResponsesWebsocketsV2 = false
|
||||
let featureSkills = false
|
||||
let serviceTierFast = false
|
||||
let currentProviderSection: string | null = null
|
||||
let inFeaturesSection = false
|
||||
|
||||
@@ -1364,6 +1368,14 @@ function extractCodexTomlImportantValues(
|
||||
CODEX_DEFAULT_REASONING_EFFORT
|
||||
continue
|
||||
}
|
||||
if (
|
||||
!currentProviderSection &&
|
||||
!inFeaturesSection &&
|
||||
assignment.key === "service_tier"
|
||||
) {
|
||||
serviceTierFast = assignment.value.toLowerCase() === "fast"
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
const boolAssignment = parseTomlBooleanAssignment(rawLine)
|
||||
@@ -1452,6 +1464,7 @@ function extractCodexTomlImportantValues(
|
||||
providerSupportsWebsockets,
|
||||
featureResponsesWebsocketsV2,
|
||||
featureSkills,
|
||||
serviceTierFast,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1547,6 +1560,7 @@ function extractCodexImportantValues(
|
||||
),
|
||||
supportsWebsockets: providerSupportsWebsockets,
|
||||
skills: toml.featureSkills,
|
||||
serviceTierFast: toml.serviceTierFast,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1579,7 +1593,11 @@ function preferredTomlRootInsertionIndex(lines: string[], key: string): number {
|
||||
const modelIndex = findTomlRootAssignmentIndex(lines, "model")
|
||||
return modelIndex >= 0 ? modelIndex + 1 : 0
|
||||
}
|
||||
return findTomlRootEndIndex(lines)
|
||||
let insertAt = findTomlRootEndIndex(lines)
|
||||
while (insertAt > 0 && lines[insertAt - 1].trim() === "") {
|
||||
insertAt -= 1
|
||||
}
|
||||
return insertAt
|
||||
}
|
||||
|
||||
function updateTomlRootStringKey(
|
||||
@@ -1952,6 +1970,7 @@ function patchCodexConfigTomlText(
|
||||
modelReasoningEffort?: string
|
||||
supportsWebsockets?: boolean
|
||||
skills?: boolean
|
||||
serviceTierFast?: boolean
|
||||
}
|
||||
): string {
|
||||
let nextTomlText = configTomlText
|
||||
@@ -2052,6 +2071,13 @@ function patchCodexConfigTomlText(
|
||||
patch.skills ? true : null
|
||||
)
|
||||
}
|
||||
if (typeof patch.serviceTierFast === "boolean") {
|
||||
nextTomlText = updateTomlRootStringKey(
|
||||
nextTomlText,
|
||||
"service_tier",
|
||||
patch.serviceTierFast ? "fast" : ""
|
||||
)
|
||||
}
|
||||
nextTomlText = updateTomlRootBooleanKey(
|
||||
nextTomlText,
|
||||
"disable_response_storage",
|
||||
@@ -2286,6 +2312,7 @@ function buildAgentDraft(agent: AcpAgentInfo): AgentDraft {
|
||||
codexReasoningEffort: codexImportant.reasoningEffort,
|
||||
codexSupportsWebsockets: codexImportant.supportsWebsockets,
|
||||
codexSkills: codexImportant.skills,
|
||||
codexServiceTierFast: codexImportant.serviceTierFast,
|
||||
claudeMainModel: important.claudeMainModel,
|
||||
claudeReasoningModel: important.claudeReasoningModel,
|
||||
claudeDefaultHaikuModel: important.claudeDefaultHaikuModel,
|
||||
@@ -4519,6 +4546,7 @@ export function AcpAgentSettings() {
|
||||
codexReasoningEffort: important.reasoningEffort,
|
||||
codexSupportsWebsockets: important.supportsWebsockets,
|
||||
codexSkills: important.skills,
|
||||
codexServiceTierFast: important.serviceTierFast,
|
||||
}))
|
||||
},
|
||||
[selectedAgent, selectedDraft, updateSelectedDraft]
|
||||
@@ -4542,6 +4570,7 @@ export function AcpAgentSettings() {
|
||||
codexReasoningEffort: important.reasoningEffort,
|
||||
codexSupportsWebsockets: important.supportsWebsockets,
|
||||
codexSkills: important.skills,
|
||||
codexServiceTierFast: important.serviceTierFast,
|
||||
}))
|
||||
},
|
||||
[selectedAgent, selectedDraft, updateSelectedDraft]
|
||||
@@ -4594,6 +4623,7 @@ export function AcpAgentSettings() {
|
||||
codexReasoningEffort: synced.reasoningEffort,
|
||||
codexSupportsWebsockets: synced.supportsWebsockets,
|
||||
codexSkills: synced.skills,
|
||||
codexServiceTierFast: synced.serviceTierFast,
|
||||
}))
|
||||
return
|
||||
}
|
||||
@@ -4627,6 +4657,7 @@ export function AcpAgentSettings() {
|
||||
codexReasoningEffort: synced.reasoningEffort,
|
||||
codexSupportsWebsockets: synced.supportsWebsockets,
|
||||
codexSkills: synced.skills,
|
||||
codexServiceTierFast: synced.serviceTierFast,
|
||||
}))
|
||||
},
|
||||
[selectedAgent, selectedDraft, updateSelectedDraft]
|
||||
@@ -4693,6 +4724,7 @@ export function AcpAgentSettings() {
|
||||
codexReasoningEffort: synced.reasoningEffort,
|
||||
codexSupportsWebsockets: synced.supportsWebsockets,
|
||||
codexSkills: synced.skills,
|
||||
codexServiceTierFast: synced.serviceTierFast,
|
||||
codexAuthJsonText: nextAuth.authJsonText,
|
||||
codexConfigTomlText: nextToml,
|
||||
}))
|
||||
@@ -4729,6 +4761,7 @@ export function AcpAgentSettings() {
|
||||
codexReasoningEffort: synced.reasoningEffort,
|
||||
codexSupportsWebsockets: synced.supportsWebsockets,
|
||||
codexSkills: synced.skills,
|
||||
codexServiceTierFast: synced.serviceTierFast,
|
||||
codexConfigTomlText: nextToml,
|
||||
}))
|
||||
},
|
||||
@@ -4761,6 +4794,40 @@ export function AcpAgentSettings() {
|
||||
codexReasoningEffort: synced.reasoningEffort,
|
||||
codexSupportsWebsockets: synced.supportsWebsockets,
|
||||
codexSkills: synced.skills,
|
||||
codexServiceTierFast: synced.serviceTierFast,
|
||||
codexConfigTomlText: nextToml,
|
||||
}))
|
||||
},
|
||||
[selectedAgent, selectedDraft, updateSelectedDraft]
|
||||
)
|
||||
|
||||
const handleCodexServiceTierFastChange = useCallback(
|
||||
(enabled: boolean) => {
|
||||
if (
|
||||
!selectedAgent ||
|
||||
!selectedDraft ||
|
||||
selectedAgent.agent_type !== "codex"
|
||||
)
|
||||
return
|
||||
const nextToml = patchCodexConfigTomlText(
|
||||
selectedDraft.codexConfigTomlText,
|
||||
{ serviceTierFast: enabled }
|
||||
)
|
||||
const synced = extractCodexImportantValues(
|
||||
selectedDraft.codexAuthJsonText,
|
||||
nextToml
|
||||
)
|
||||
updateSelectedDraft((current) => ({
|
||||
...current,
|
||||
apiBaseUrl: synced.apiBaseUrl,
|
||||
apiKey: synced.apiKey ?? current.apiKey,
|
||||
model: synced.model,
|
||||
codexModelProvider: synced.modelProvider,
|
||||
codexProviderOptions: synced.providerOptions,
|
||||
codexReasoningEffort: synced.reasoningEffort,
|
||||
codexSupportsWebsockets: synced.supportsWebsockets,
|
||||
codexSkills: synced.skills,
|
||||
codexServiceTierFast: synced.serviceTierFast,
|
||||
codexConfigTomlText: nextToml,
|
||||
}))
|
||||
},
|
||||
@@ -5351,6 +5418,19 @@ export function AcpAgentSettings() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5">
|
||||
<div className="flex items-center justify-between rounded-md border px-3 py-2">
|
||||
<label className="text-[11px] text-muted-foreground">
|
||||
{t("codex.enableFast")}
|
||||
</label>
|
||||
<Switch
|
||||
checked={selectedDraft.codexServiceTierFast}
|
||||
onCheckedChange={handleCodexServiceTierFastChange}
|
||||
aria-label={t("codex.enableFastAria")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-[11px] text-muted-foreground">
|
||||
{t("codex.authJsonNative")}
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "تفعيل WebSocket لـ Codex Provider",
|
||||
"enableSkills": "تفعيل Skills",
|
||||
"enableSkillsAria": "تفعيل Skills لـ Codex",
|
||||
"enableFast": "تفعيل Fast",
|
||||
"enableFastAria": "تفعيل مستوى خدمة Fast لـ Codex",
|
||||
"authJsonNative": "auth.json (أصلي)",
|
||||
"configTomlNative": "config.toml (أصلي)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "WebSocket für Codex Provider aktivieren",
|
||||
"enableSkills": "Skills aktivieren",
|
||||
"enableSkillsAria": "Skills für Codex aktivieren",
|
||||
"enableFast": "Fast aktivieren",
|
||||
"enableFastAria": "Fast-Servicestufe für Codex aktivieren",
|
||||
"authJsonNative": "auth.json (nativ)",
|
||||
"configTomlNative": "config.toml (nativ)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Enable WebSocket for Codex Provider",
|
||||
"enableSkills": "Enable Skills",
|
||||
"enableSkillsAria": "Enable Skills for Codex",
|
||||
"enableFast": "Enable Fast",
|
||||
"enableFastAria": "Enable Fast service tier for Codex",
|
||||
"authJsonNative": "auth.json (native)",
|
||||
"configTomlNative": "config.toml (native)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Habilitar WebSocket para Codex Provider",
|
||||
"enableSkills": "Habilitar Skills",
|
||||
"enableSkillsAria": "Habilitar Skills para Codex",
|
||||
"enableFast": "Habilitar Fast",
|
||||
"enableFastAria": "Habilitar nivel de servicio Fast para Codex",
|
||||
"authJsonNative": "auth.json (nativo)",
|
||||
"configTomlNative": "config.toml (nativo)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Activer WebSocket pour Codex Provider",
|
||||
"enableSkills": "Activer Skills",
|
||||
"enableSkillsAria": "Activer Skills pour Codex",
|
||||
"enableFast": "Activer Fast",
|
||||
"enableFastAria": "Activer le niveau de service Fast pour Codex",
|
||||
"authJsonNative": "auth.json (natif)",
|
||||
"configTomlNative": "config.toml (natif)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Codex Provider の WebSocket を有効化",
|
||||
"enableSkills": "Skills を有効化",
|
||||
"enableSkillsAria": "Codex の Skills を有効化",
|
||||
"enableFast": "Fast を有効化",
|
||||
"enableFastAria": "Codex の Fast サービスティアを有効化",
|
||||
"authJsonNative": "auth.json(ネイティブ)",
|
||||
"configTomlNative": "config.toml(ネイティブ)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Codex Provider용 WebSocket 활성화",
|
||||
"enableSkills": "Skills 활성화",
|
||||
"enableSkillsAria": "Codex용 Skills 활성화",
|
||||
"enableFast": "Fast 활성화",
|
||||
"enableFastAria": "Codex용 Fast 서비스 계층 활성화",
|
||||
"authJsonNative": "auth.json (네이티브)",
|
||||
"configTomlNative": "config.toml (네이티브)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Habilitar WebSocket para Codex Provider",
|
||||
"enableSkills": "Habilitar Skills",
|
||||
"enableSkillsAria": "Habilitar Skills para Codex",
|
||||
"enableFast": "Habilitar Fast",
|
||||
"enableFastAria": "Habilitar nível de serviço Fast para Codex",
|
||||
"authJsonNative": "auth.json (nativo)",
|
||||
"configTomlNative": "config.toml (nativo)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Codex Provider 启用 WebSocket",
|
||||
"enableSkills": "启用 Skills",
|
||||
"enableSkillsAria": "Codex 启用 Skills",
|
||||
"enableFast": "启用 Fast",
|
||||
"enableFastAria": "Codex 启用 Fast 服务等级",
|
||||
"authJsonNative": "auth.json(原生)",
|
||||
"configTomlNative": "config.toml(原生)"
|
||||
},
|
||||
|
||||
@@ -554,6 +554,8 @@
|
||||
"enableWebsocketAria": "Codex Provider 啟用 WebSocket",
|
||||
"enableSkills": "啟用 Skills",
|
||||
"enableSkillsAria": "Codex 啟用 Skills",
|
||||
"enableFast": "啟用 Fast",
|
||||
"enableFastAria": "Codex 啟用 Fast 服務等級",
|
||||
"authJsonNative": "auth.json(原生)",
|
||||
"configTomlNative": "config.toml(原生)"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user