mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-18 02:49:23 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f71ab053b3 |
@@ -14,11 +14,10 @@ function parseModelsFromConfig(settingsConfig: string) {
|
|||||||
const env = cfg?.env || {};
|
const env = cfg?.env || {};
|
||||||
const model =
|
const model =
|
||||||
typeof env.ANTHROPIC_MODEL === "string" ? env.ANTHROPIC_MODEL : "";
|
typeof env.ANTHROPIC_MODEL === "string" ? env.ANTHROPIC_MODEL : "";
|
||||||
const explicitReasoning =
|
const reasoning =
|
||||||
typeof env.ANTHROPIC_REASONING_MODEL === "string"
|
typeof env.ANTHROPIC_REASONING_MODEL === "string"
|
||||||
? env.ANTHROPIC_REASONING_MODEL
|
? env.ANTHROPIC_REASONING_MODEL
|
||||||
: "";
|
: "";
|
||||||
const reasoning = explicitReasoning || model;
|
|
||||||
const small =
|
const small =
|
||||||
typeof env.ANTHROPIC_SMALL_FAST_MODEL === "string"
|
typeof env.ANTHROPIC_SMALL_FAST_MODEL === "string"
|
||||||
? env.ANTHROPIC_SMALL_FAST_MODEL
|
? env.ANTHROPIC_SMALL_FAST_MODEL
|
||||||
@@ -93,11 +92,10 @@ export function useModelState({
|
|||||||
const env = cfg?.env || {};
|
const env = cfg?.env || {};
|
||||||
const model =
|
const model =
|
||||||
typeof env.ANTHROPIC_MODEL === "string" ? env.ANTHROPIC_MODEL : "";
|
typeof env.ANTHROPIC_MODEL === "string" ? env.ANTHROPIC_MODEL : "";
|
||||||
const explicitReasoning =
|
const reasoning =
|
||||||
typeof env.ANTHROPIC_REASONING_MODEL === "string"
|
typeof env.ANTHROPIC_REASONING_MODEL === "string"
|
||||||
? env.ANTHROPIC_REASONING_MODEL
|
? env.ANTHROPIC_REASONING_MODEL
|
||||||
: "";
|
: "";
|
||||||
const reasoning = explicitReasoning || model;
|
|
||||||
const small =
|
const small =
|
||||||
typeof env.ANTHROPIC_SMALL_FAST_MODEL === "string"
|
typeof env.ANTHROPIC_SMALL_FAST_MODEL === "string"
|
||||||
? env.ANTHROPIC_SMALL_FAST_MODEL
|
? env.ANTHROPIC_SMALL_FAST_MODEL
|
||||||
@@ -150,17 +148,16 @@ export function useModelState({
|
|||||||
? JSON.parse(settingsConfig)
|
? JSON.parse(settingsConfig)
|
||||||
: { env: {} };
|
: { env: {} };
|
||||||
if (!currentConfig.env) currentConfig.env = {};
|
if (!currentConfig.env) currentConfig.env = {};
|
||||||
const env = currentConfig.env as Record<string, unknown>;
|
|
||||||
|
|
||||||
// 新键仅写入;旧键不再写入
|
// 新键仅写入;旧键不再写入
|
||||||
const trimmed = value.trim();
|
const trimmed = value.trim();
|
||||||
if (trimmed) {
|
if (trimmed) {
|
||||||
env[field] = trimmed;
|
currentConfig.env[field] = trimmed;
|
||||||
} else {
|
} else {
|
||||||
delete env[field];
|
delete currentConfig.env[field];
|
||||||
}
|
}
|
||||||
// 删除旧键
|
// 删除旧键
|
||||||
delete env["ANTHROPIC_SMALL_FAST_MODEL"];
|
delete currentConfig.env["ANTHROPIC_SMALL_FAST_MODEL"];
|
||||||
|
|
||||||
onConfigChange(JSON.stringify(currentConfig, null, 2));
|
onConfigChange(JSON.stringify(currentConfig, null, 2));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -243,6 +243,7 @@
|
|||||||
"title": "Settings",
|
"title": "Settings",
|
||||||
"general": "General",
|
"general": "General",
|
||||||
"tabGeneral": "General",
|
"tabGeneral": "General",
|
||||||
|
"tabAuth": "Auth",
|
||||||
"tabAdvanced": "Advanced",
|
"tabAdvanced": "Advanced",
|
||||||
"tabProxy": "Proxy",
|
"tabProxy": "Proxy",
|
||||||
"authCenter": {
|
"authCenter": {
|
||||||
|
|||||||
@@ -243,6 +243,7 @@
|
|||||||
"title": "設定",
|
"title": "設定",
|
||||||
"general": "一般",
|
"general": "一般",
|
||||||
"tabGeneral": "一般",
|
"tabGeneral": "一般",
|
||||||
|
"tabAuth": "認証",
|
||||||
"tabAdvanced": "詳細",
|
"tabAdvanced": "詳細",
|
||||||
"tabProxy": "プロキシ",
|
"tabProxy": "プロキシ",
|
||||||
"authCenter": {
|
"authCenter": {
|
||||||
|
|||||||
@@ -243,6 +243,7 @@
|
|||||||
"title": "设置",
|
"title": "设置",
|
||||||
"general": "通用",
|
"general": "通用",
|
||||||
"tabGeneral": "通用",
|
"tabGeneral": "通用",
|
||||||
|
"tabAuth": "认证",
|
||||||
"tabAdvanced": "高级",
|
"tabAdvanced": "高级",
|
||||||
"tabProxy": "代理",
|
"tabProxy": "代理",
|
||||||
"authCenter": {
|
"authCenter": {
|
||||||
|
|||||||
Reference in New Issue
Block a user