mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 00:35:32 +08:00
eca9c02147
- Add ProviderCategory type with official, cn_official, aggregator, third_party, and custom categories - Update Provider interface and Rust struct to include optional category field - Enhance ProviderForm to automatically sync category when selecting presets - Improve PresetSelector to show category-based styling and hints - Add category classification to all provider presets - Support differentiated interactions (e.g., hide API key input for official providers) - Maintain backward compatibility with existing configurations
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
/**
|
||
* Codex 预设供应商配置模板
|
||
*/
|
||
import { ProviderCategory } from "../types";
|
||
|
||
export interface CodexProviderPreset {
|
||
name: string;
|
||
websiteUrl: string;
|
||
auth: Record<string, any>; // 将写入 ~/.codex/auth.json
|
||
config: string; // 将写入 ~/.codex/config.toml(TOML 字符串)
|
||
isOfficial?: boolean; // 标识是否为官方预设
|
||
category?: ProviderCategory; // 新增:分类
|
||
}
|
||
|
||
export const codexProviderPresets: CodexProviderPreset[] = [
|
||
{
|
||
name: "Codex官方",
|
||
websiteUrl: "https://chatgpt.com/codex",
|
||
isOfficial: true,
|
||
category: "official",
|
||
// 官方的 key 为null
|
||
auth: {
|
||
OPENAI_API_KEY: null,
|
||
},
|
||
config: ``,
|
||
},
|
||
{
|
||
name: "PackyCode",
|
||
websiteUrl: "https://codex.packycode.com/",
|
||
category: "third_party",
|
||
// PackyCode 一般通过 API Key;请将占位符替换为你的实际 key
|
||
auth: {
|
||
OPENAI_API_KEY: "sk-your-api-key-here",
|
||
},
|
||
config: `model_provider = "packycode"
|
||
model = "gpt-5"
|
||
model_reasoning_effort = "high"
|
||
disable_response_storage = true
|
||
|
||
[model_providers.packycode]
|
||
name = "packycode"
|
||
base_url = "https://codex-api.packycode.com/v1"
|
||
wire_api = "responses"
|
||
env_key = "packycode"`,
|
||
},
|
||
];
|