feat: add prettier formatter and MIT license

- Add prettier dev dependency for code formatting
- Create MIT LICENSE file
- Format TypeScript files with prettier
- Update provider order in README (Qwen coder first)
- Update add provider screenshot with new UI
This commit is contained in:
Jason
2025-08-29 11:35:17 +08:00
parent 73cf337c42
commit 2cf116280f
7 changed files with 49 additions and 12 deletions

21
LICENSE Normal file
View File

@@ -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.

View File

@@ -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无隐私风险

View File

@@ -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"
},

10
pnpm-lock.yaml generated
View File

@@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 128 KiB

View File

@@ -171,7 +171,8 @@ const ProviderForm: React.FC<ProviderFormProps> = ({
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<ProviderFormProps> = ({
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",
}
: {}
}
/>
</div>

View File

@@ -13,8 +13,7 @@ export const providerPresets: ProviderPreset[] = [
name: "Claude官方登录",
websiteUrl: "https://www.anthropic.com/claude-code",
settingsConfig: {
env: {
},
env: {},
},
isOfficial: true, // 明确标识为官方预设
},