mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
feat(providers): add prime-partner heart badge for Kimi presets
Introduce an optional primePartner flag on all provider preset interfaces. Regular partners keep the gold star badge; prime partners render a solid gold heart (no badge frame). Mark the first-party Moonshot Kimi presets (Kimi / Kimi For Coding / Kimi K2.7 Code) across claude, codex, claude desktop, opencode, openclaw and hermes as prime partners.
This commit is contained in:
@@ -4,7 +4,15 @@ import { FormLabel } from "@/components/ui/form";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { ClaudeIcon, CodexIcon, GeminiIcon } from "@/components/BrandIcons";
|
import { ClaudeIcon, CodexIcon, GeminiIcon } from "@/components/BrandIcons";
|
||||||
import { ArrowUpAZ, Search, Zap, Star, Layers, Settings2 } from "lucide-react";
|
import {
|
||||||
|
ArrowUpAZ,
|
||||||
|
Search,
|
||||||
|
Zap,
|
||||||
|
Star,
|
||||||
|
Heart,
|
||||||
|
Layers,
|
||||||
|
Settings2,
|
||||||
|
} from "lucide-react";
|
||||||
import type { ProviderPreset } from "@/config/claudeProviderPresets";
|
import type { ProviderPreset } from "@/config/claudeProviderPresets";
|
||||||
import type { CodexProviderPreset } from "@/config/codexProviderPresets";
|
import type { CodexProviderPreset } from "@/config/codexProviderPresets";
|
||||||
import type { GeminiProviderPreset } from "@/config/geminiProviderPresets";
|
import type { GeminiProviderPreset } from "@/config/geminiProviderPresets";
|
||||||
@@ -380,6 +388,7 @@ export function ProviderPresetSelector({
|
|||||||
{visiblePresetEntries.map((entry) => {
|
{visiblePresetEntries.map((entry) => {
|
||||||
const isSelected = selectedPresetId === entry.id;
|
const isSelected = selectedPresetId === entry.id;
|
||||||
const isPartner = entry.preset.isPartner;
|
const isPartner = entry.preset.isPartner;
|
||||||
|
const isPrimePartner = entry.preset.primePartner;
|
||||||
const presetCategory = entry.preset.category ?? "others";
|
const presetCategory = entry.preset.category ?? "others";
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
@@ -397,10 +406,18 @@ export function ProviderPresetSelector({
|
|||||||
<span className="truncate">
|
<span className="truncate">
|
||||||
{getPresetDisplayName(entry.preset, t)}
|
{getPresetDisplayName(entry.preset, t)}
|
||||||
</span>
|
</span>
|
||||||
{isPartner && (
|
{isPrimePartner ? (
|
||||||
<span className="absolute -top-1 -right-1 flex items-center gap-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-500 px-1.5 py-0.5 text-[10px] font-bold text-white shadow-md">
|
<Heart
|
||||||
<Star className="h-2.5 w-2.5 fill-current" />
|
className="absolute -top-1 -right-1 h-5 w-5 fill-amber-500 text-amber-500 drop-shadow-sm"
|
||||||
</span>
|
strokeWidth={0}
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
isPartner && (
|
||||||
|
<span className="absolute -top-1 -right-1 flex items-center gap-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-500 px-1.5 py-0.5 text-[10px] font-bold text-white shadow-md">
|
||||||
|
<Star className="h-2.5 w-2.5 fill-current" />
|
||||||
|
</span>
|
||||||
|
)
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export interface ClaudeDesktopProviderPreset {
|
|||||||
apiKeyUrl?: string;
|
apiKeyUrl?: string;
|
||||||
category?: ProviderCategory;
|
category?: ProviderCategory;
|
||||||
isPartner?: boolean;
|
isPartner?: boolean;
|
||||||
|
primePartner?: boolean; // 置顶合作伙伴(顶级):徽章显示为心形
|
||||||
partnerPromotionKey?: string;
|
partnerPromotionKey?: string;
|
||||||
|
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
@@ -414,6 +415,7 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi",
|
name: "Kimi",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
||||||
category: "cn_official",
|
category: "cn_official",
|
||||||
baseUrl: "https://api.moonshot.cn/anthropic",
|
baseUrl: "https://api.moonshot.cn/anthropic",
|
||||||
@@ -429,6 +431,7 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi For Coding",
|
name: "Kimi For Coding",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
||||||
category: "cn_official",
|
category: "cn_official",
|
||||||
baseUrl: "https://api.kimi.com/coding/",
|
baseUrl: "https://api.kimi.com/coding/",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export interface ProviderPreset {
|
|||||||
settingsConfig: object;
|
settingsConfig: object;
|
||||||
isOfficial?: boolean; // 标识是否为官方预设
|
isOfficial?: boolean; // 标识是否为官方预设
|
||||||
isPartner?: boolean; // 标识是否为商业合作伙伴
|
isPartner?: boolean; // 标识是否为商业合作伙伴
|
||||||
|
primePartner?: boolean; // 置顶合作伙伴(顶级):徽章显示为心形
|
||||||
partnerPromotionKey?: string; // 合作伙伴促销信息的 i18n key
|
partnerPromotionKey?: string; // 合作伙伴促销信息的 i18n key
|
||||||
category?: ProviderCategory; // 新增:分类
|
category?: ProviderCategory; // 新增:分类
|
||||||
// 新增:指定该预设所使用的 API Key 字段名(默认 ANTHROPIC_AUTH_TOKEN)
|
// 新增:指定该预设所使用的 API Key 字段名(默认 ANTHROPIC_AUTH_TOKEN)
|
||||||
@@ -367,6 +368,7 @@ export const providerPresets: ProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi",
|
name: "Kimi",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
env: {
|
env: {
|
||||||
@@ -384,6 +386,7 @@ export const providerPresets: ProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi For Coding",
|
name: "Kimi For Coding",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
env: {
|
env: {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface CodexProviderPreset {
|
|||||||
config: string; // 将写入 ~/.codex/config.toml(TOML 字符串)
|
config: string; // 将写入 ~/.codex/config.toml(TOML 字符串)
|
||||||
isOfficial?: boolean; // 标识是否为官方预设
|
isOfficial?: boolean; // 标识是否为官方预设
|
||||||
isPartner?: boolean; // 标识是否为商业合作伙伴
|
isPartner?: boolean; // 标识是否为商业合作伙伴
|
||||||
|
primePartner?: boolean; // 置顶合作伙伴(顶级):徽章显示为心形
|
||||||
partnerPromotionKey?: string; // 合作伙伴促销信息的 i18n key
|
partnerPromotionKey?: string; // 合作伙伴促销信息的 i18n key
|
||||||
category?: ProviderCategory; // 新增:分类
|
category?: ProviderCategory; // 新增:分类
|
||||||
isCustomTemplate?: boolean; // 标识是否为自定义模板
|
isCustomTemplate?: boolean; // 标识是否为自定义模板
|
||||||
@@ -420,6 +421,7 @@ requires_openai_auth = true`,
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi",
|
name: "Kimi",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
||||||
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys?aff=cc-switch",
|
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys?aff=cc-switch",
|
||||||
auth: generateThirdPartyAuth(""),
|
auth: generateThirdPartyAuth(""),
|
||||||
@@ -450,6 +452,7 @@ requires_openai_auth = true`,
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi For Coding",
|
name: "Kimi For Coding",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://www.kimi.com/code/docs/",
|
websiteUrl: "https://www.kimi.com/code/docs/",
|
||||||
apiKeyUrl: "https://www.kimi.com/code/",
|
apiKeyUrl: "https://www.kimi.com/code/",
|
||||||
auth: generateThirdPartyAuth(""),
|
auth: generateThirdPartyAuth(""),
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export interface GeminiProviderPreset {
|
|||||||
description?: string;
|
description?: string;
|
||||||
category?: ProviderCategory;
|
category?: ProviderCategory;
|
||||||
isPartner?: boolean;
|
isPartner?: boolean;
|
||||||
|
primePartner?: boolean; // 置顶合作伙伴(顶级):徽章显示为心形
|
||||||
partnerPromotionKey?: string;
|
partnerPromotionKey?: string;
|
||||||
endpointCandidates?: string[];
|
endpointCandidates?: string[];
|
||||||
theme?: GeminiPresetTheme;
|
theme?: GeminiPresetTheme;
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export interface HermesProviderPreset {
|
|||||||
settingsConfig: HermesProviderSettingsConfig;
|
settingsConfig: HermesProviderSettingsConfig;
|
||||||
isOfficial?: boolean;
|
isOfficial?: boolean;
|
||||||
isPartner?: boolean;
|
isPartner?: boolean;
|
||||||
|
primePartner?: boolean; // 置顶合作伙伴(顶级):徽章显示为心形
|
||||||
partnerPromotionKey?: string;
|
partnerPromotionKey?: string;
|
||||||
category?: ProviderCategory;
|
category?: ProviderCategory;
|
||||||
templateValues?: Record<string, TemplateValueConfig>;
|
templateValues?: Record<string, TemplateValueConfig>;
|
||||||
@@ -515,6 +516,7 @@ export const hermesProviderPresets: HermesProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi",
|
name: "Kimi",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
name: "kimi",
|
name: "kimi",
|
||||||
@@ -532,6 +534,7 @@ export const hermesProviderPresets: HermesProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi For Coding",
|
name: "Kimi For Coding",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
name: "kimi_coding",
|
name: "kimi_coding",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export interface OpenClawProviderPreset {
|
|||||||
settingsConfig: OpenClawProviderConfig;
|
settingsConfig: OpenClawProviderConfig;
|
||||||
isOfficial?: boolean;
|
isOfficial?: boolean;
|
||||||
isPartner?: boolean;
|
isPartner?: boolean;
|
||||||
|
primePartner?: boolean; // 置顶合作伙伴(顶级):徽章显示为心形
|
||||||
partnerPromotionKey?: string;
|
partnerPromotionKey?: string;
|
||||||
category?: ProviderCategory;
|
category?: ProviderCategory;
|
||||||
/** Template variable definitions */
|
/** Template variable definitions */
|
||||||
@@ -491,6 +492,7 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi K2.7 Code",
|
name: "Kimi K2.7 Code",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
||||||
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys",
|
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
@@ -529,6 +531,7 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi For Coding",
|
name: "Kimi For Coding",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
||||||
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys",
|
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export interface OpenCodeProviderPreset {
|
|||||||
settingsConfig: OpenCodeProviderConfig;
|
settingsConfig: OpenCodeProviderConfig;
|
||||||
isOfficial?: boolean;
|
isOfficial?: boolean;
|
||||||
isPartner?: boolean;
|
isPartner?: boolean;
|
||||||
|
primePartner?: boolean; // 置顶合作伙伴(顶级):徽章显示为心形
|
||||||
partnerPromotionKey?: string;
|
partnerPromotionKey?: string;
|
||||||
category?: ProviderCategory;
|
category?: ProviderCategory;
|
||||||
templateValues?: Record<string, TemplateValueConfig>;
|
templateValues?: Record<string, TemplateValueConfig>;
|
||||||
@@ -589,6 +590,7 @@ export const opencodeProviderPresets: OpenCodeProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi K2.7 Code",
|
name: "Kimi K2.7 Code",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
websiteUrl: "https://platform.moonshot.cn/console?aff=cc-switch",
|
||||||
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys?aff=cc-switch",
|
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys?aff=cc-switch",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
@@ -622,6 +624,7 @@ export const opencodeProviderPresets: OpenCodeProviderPreset[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Kimi For Coding",
|
name: "Kimi For Coding",
|
||||||
|
primePartner: true,
|
||||||
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
websiteUrl: "https://www.kimi.com/code/docs/?aff=cc-switch",
|
||||||
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys?aff=cc-switch",
|
apiKeyUrl: "https://platform.moonshot.cn/console/api-keys?aff=cc-switch",
|
||||||
settingsConfig: {
|
settingsConfig: {
|
||||||
|
|||||||
Reference in New Issue
Block a user