Merge pull request #691 from zoyopei/fix/ui-custom-router

fix(ui): add CUSTOM_ROUTER_PATH support in general settings
This commit is contained in:
musi
2025-09-01 20:53:07 +08:00
committed by GitHub
5 changed files with 26 additions and 4 deletions

View File

@@ -103,7 +103,8 @@ export function ConfigProvider({ children }: ConfigProviderProps) {
longContext: '', longContext: '',
longContextThreshold: 60000, longContextThreshold: 60000,
webSearch: '' webSearch: ''
} },
CUSTOM_ROUTER_PATH: typeof data.CUSTOM_ROUTER_PATH === 'string' ? data.CUSTOM_ROUTER_PATH : ''
}; };
setConfig(validConfig); setConfig(validConfig);
@@ -132,7 +133,8 @@ export function ConfigProvider({ children }: ConfigProviderProps) {
longContext: '', longContext: '',
longContextThreshold: 60000, longContextThreshold: 60000,
webSearch: '' webSearch: ''
} },
CUSTOM_ROUTER_PATH: ''
}); });
setError(err as Error); setError(err as Error);
} }

View File

@@ -212,6 +212,21 @@ export function SettingsDialog({ isOpen, onOpenChange }: SettingsDialogProps) {
className="transition-all-ease focus:scale-[1.01]" className="transition-all-ease focus:scale-[1.01]"
/> />
</div> </div>
<div className="space-y-2">
<Label
htmlFor="custom-router-path"
className="transition-all-ease hover:scale-[1.01] cursor-pointer"
>
{t("toplevel.custom_router_path")}
</Label>
<Input
id="custom-router-path"
value={config.CUSTOM_ROUTER_PATH || ""}
onChange={(e) => setConfig({ ...config, CUSTOM_ROUTER_PATH: e.target.value })}
placeholder={t("toplevel.custom_router_path_placeholder")}
className="transition-all-ease focus:scale-[1.01]"
/>
</div>
</div> </div>
<DialogFooter className="p-4 pt-0"> <DialogFooter className="p-4 pt-0">
<Button <Button

View File

@@ -42,7 +42,9 @@
"port": "Port", "port": "Port",
"apikey": "API Key", "apikey": "API Key",
"timeout": "API Timeout (ms)", "timeout": "API Timeout (ms)",
"proxy_url": "Proxy URL" "proxy_url": "Proxy URL",
"custom_router_path": "Custom Router Script Path",
"custom_router_path_placeholder": "Enter absolute path to custom router script file"
}, },
"transformers": { "transformers": {
"title": "Custom Transformers", "title": "Custom Transformers",

View File

@@ -42,7 +42,9 @@
"port": "端口", "port": "端口",
"apikey": "API 密钥", "apikey": "API 密钥",
"timeout": "API 超时时间 (毫秒)", "timeout": "API 超时时间 (毫秒)",
"proxy_url": "代理地址" "proxy_url": "代理地址",
"custom_router_path": "自定义路由脚本路径",
"custom_router_path_placeholder": "输入自定义路由脚本文件的绝对路径"
}, },
"transformers": { "transformers": {
"title": "自定义转换器", "title": "自定义转换器",

View File

@@ -62,6 +62,7 @@ export interface Config {
APIKEY: string; APIKEY: string;
API_TIMEOUT_MS: string; API_TIMEOUT_MS: string;
PROXY_URL: string; PROXY_URL: string;
CUSTOM_ROUTER_PATH?: string;
} }
export type AccessLevel = 'restricted' | 'full'; export type AccessLevel = 'restricted' | 'full';