mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
Add Claude Desktop official preset
- Add Claude Desktop Official to the Claude Desktop preset list. - Treat selected official presets as official mode in the form. - Cover the official preset with a preset-order regression test.
This commit is contained in:
@@ -296,7 +296,6 @@ export function ClaudeDesktopProviderForm({
|
||||
showButtons = true,
|
||||
}: ClaudeDesktopProviderFormProps) {
|
||||
const { t } = useTranslation();
|
||||
const isOfficial = initialData?.category === "official";
|
||||
const initialMode = initialData?.meta?.claudeDesktopMode ?? "direct";
|
||||
const [mode, setMode] = useState<"direct" | "proxy">(initialMode);
|
||||
const needsModelMapping = mode === "proxy";
|
||||
@@ -412,6 +411,9 @@ export function ClaudeDesktopProviderForm({
|
||||
);
|
||||
const activeProviderType =
|
||||
activePreset?.providerType ?? initialData?.meta?.providerType;
|
||||
const isOfficial =
|
||||
initialData?.category === "official" ||
|
||||
activePreset?.category === "official";
|
||||
const usesManagedOAuth =
|
||||
activePreset?.requiresOAuth === true ||
|
||||
activeProviderType === "github_copilot" ||
|
||||
|
||||
@@ -134,6 +134,21 @@ const brandedRoutes = (
|
||||
};
|
||||
|
||||
export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [
|
||||
{
|
||||
name: "Claude Desktop Official",
|
||||
websiteUrl: "https://claude.ai/download",
|
||||
category: "official",
|
||||
baseUrl: "",
|
||||
mode: "direct",
|
||||
apiFormat: "anthropic",
|
||||
theme: {
|
||||
icon: "claude",
|
||||
backgroundColor: "#D97757",
|
||||
textColor: "#FFFFFF",
|
||||
},
|
||||
icon: "anthropic",
|
||||
iconColor: "#D4915D",
|
||||
},
|
||||
{
|
||||
name: "Shengsuanyun",
|
||||
nameKey: "providerForm.presets.shengsuanyun",
|
||||
|
||||
@@ -37,6 +37,15 @@ describe("provider preset order", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("Claude Desktop 预设包含官方登录入口", () => {
|
||||
expect(claudeDesktopProviderPresets[0]).toMatchObject({
|
||||
name: "Claude Desktop Official",
|
||||
category: "official",
|
||||
baseUrl: "",
|
||||
mode: "direct",
|
||||
});
|
||||
});
|
||||
|
||||
it("Codex 预设把 PatewayAI 放在胜算云后面", () => {
|
||||
expectInOrder(namesOf(codexProviderPresets), ["Shengsuanyun", "PatewayAI"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user