mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 16:56:16 +08:00
feat(codex): expose official routing and restore the built-in provider
Let users switch between the built-in OpenAI provider and third-party Codex providers directly from the provider panel while takeover mode remains active. Centralize the frontend capability predicate so only the fixed codex-official seed receives native-login routing support, and keep copied UUID-based official entries clearly marked as unsupported. Add an idempotent backend command that recreates the deleted official seed, wire it into the add-provider flow, refresh localized guidance, and add mutation and provider-action regression coverage.
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
isCodexAnthropicWireApi,
|
||||
isCodexChatWireApi,
|
||||
} from "@/utils/providerConfigUtils";
|
||||
import { supportsOfficialProxyTakeover } from "@/utils/providerCapabilities";
|
||||
|
||||
/**
|
||||
* Hook for managing provider actions (add, update, delete, switch)
|
||||
@@ -78,6 +79,7 @@ export function useProviderActions(
|
||||
suggestedDefaults?: OpenClawSuggestedDefaults;
|
||||
addToLive?: boolean;
|
||||
ensureClaudeDesktopOfficialSeed?: boolean;
|
||||
ensureCodexOfficialSeed?: boolean;
|
||||
},
|
||||
) => {
|
||||
const enhanced = injectCodingPlanUsageScript(activeApp, provider);
|
||||
@@ -236,8 +238,17 @@ export function useProviderActions(
|
||||
);
|
||||
}
|
||||
|
||||
// Block official providers when proxy takeover is active
|
||||
if (isProxyTakeover && provider.category === "official") {
|
||||
// The built-in Codex official provider can reuse Codex's native ChatGPT
|
||||
// login through local routing. Other official providers remain blocked.
|
||||
const officialSupportsTakeover = supportsOfficialProxyTakeover(
|
||||
activeApp,
|
||||
provider,
|
||||
);
|
||||
if (
|
||||
isProxyTakeover &&
|
||||
provider.category === "official" &&
|
||||
!officialSupportsTakeover
|
||||
) {
|
||||
toast.error(
|
||||
t("notifications.officialBlockedByProxy", {
|
||||
defaultValue:
|
||||
|
||||
Reference in New Issue
Block a user