diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d84c4f7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Jason Young + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 8c76968..65b3f16 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - **极速启动** - 基于 Tauri 2.0,原生性能,秒开应用 - 一键切换不同供应商 -- 智谱 GLM、Qwen coder、DeepSeek v3.1、packycode 等预设供应商只需要填写 key 即可一键配置 +- Qwen coder、kimi k2、智谱 GLM、DeepSeek v3.1、packycode 等预设供应商只需要填写 key 即可一键配置 - 支持添加自定义供应商 - 简洁美观的图形界面 - 信息存储在本地 ~/.cc-switch/config.json,无隐私风险 diff --git a/package.json b/package.json index d8a4ecd..37e02eb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@types/react": "^18.2.0", "@types/react-dom": "^18.2.0", "@vitejs/plugin-react": "^4.2.0", + "prettier": "^3.6.2", "typescript": "^5.3.0", "vite": "^5.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 57732f4..2953447 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,6 +33,9 @@ importers: '@vitejs/plugin-react': specifier: ^4.2.0 version: 4.7.0(vite@5.4.19(@types/node@20.19.9)) + prettier: + specifier: ^3.6.2 + version: 3.6.2 typescript: specifier: ^5.3.0 version: 5.9.2 @@ -574,6 +577,11 @@ packages: resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} engines: {node: ^10 || ^12 || >=14} + prettier@3.6.2: + resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} + engines: {node: '>=14'} + hasBin: true + react-dom@18.3.1: resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} peerDependencies: @@ -1094,6 +1102,8 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 + prettier@3.6.2: {} + react-dom@18.3.1(react@18.3.1): dependencies: loose-envify: 1.4.0 diff --git a/screenshots/add.png b/screenshots/add.png index cf1c983..b177320 100644 Binary files a/screenshots/add.png and b/screenshots/add.png differ diff --git a/src/components/ProviderForm.tsx b/src/components/ProviderForm.tsx index 709f9dc..bd59d13 100644 --- a/src/components/ProviderForm.tsx +++ b/src/components/ProviderForm.tsx @@ -171,7 +171,8 @@ const ProviderForm: React.FC = ({ selectedPreset !== null || hasApiKeyField(formData.settingsConfig); // 判断当前选中的预设是否是官方 - const isOfficialPreset = selectedPreset !== null && + const isOfficialPreset = + selectedPreset !== null && providerPresets[selectedPreset]?.isOfficial === true; // 初始时从配置中同步 API Key(编辑模式) @@ -270,17 +271,22 @@ const ProviderForm: React.FC = ({ id="apiKey" value={apiKey} onChange={(e) => handleApiKeyChange(e.target.value)} - placeholder={isOfficialPreset - ? "官方登录无需填写 API Key,直接保存即可" - : "只需要填这里,下方配置会自动填充" + placeholder={ + isOfficialPreset + ? "官方登录无需填写 API Key,直接保存即可" + : "只需要填这里,下方配置会自动填充" } disabled={isOfficialPreset} autoComplete="off" - style={isOfficialPreset ? { - backgroundColor: '#f5f5f5', - cursor: 'not-allowed', - color: '#999' - } : {}} + style={ + isOfficialPreset + ? { + backgroundColor: "#f5f5f5", + cursor: "not-allowed", + color: "#999", + } + : {} + } /> diff --git a/src/config/providerPresets.ts b/src/config/providerPresets.ts index f0baa6f..818b0e3 100644 --- a/src/config/providerPresets.ts +++ b/src/config/providerPresets.ts @@ -13,8 +13,7 @@ export const providerPresets: ProviderPreset[] = [ name: "Claude官方登录", websiteUrl: "https://www.anthropic.com/claude-code", settingsConfig: { - env: { - }, + env: {}, }, isOfficial: true, // 明确标识为官方预设 },