mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-03 19:12:04 +08:00
feat: add auto-fetch models from provider's /v1/models endpoint
Add ability to fetch available models from third-party aggregation providers (SiliconFlow, OpenRouter, etc.) via OpenAI-compatible GET /v1/models endpoint. Users can click "Fetch Models" button in the provider form, then select models from a dropdown on each model input field. - Backend: new model_fetch service + Tauri command (Rust) - Frontend: ModelInputWithFetch shared component - Integrated into all 5 app forms (Claude/Codex/Gemini/OpenCode/OpenClaw) - i18n support for zh/en/ja
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
export interface FetchedModel {
|
||||
id: string;
|
||||
ownedBy: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从供应商获取可用模型列表
|
||||
*
|
||||
* 使用 OpenAI 兼容的 GET /v1/models 端点。
|
||||
* 主要面向第三方聚合站(硅基流动、OpenRouter 等)。
|
||||
*/
|
||||
export async function fetchModelsForConfig(
|
||||
baseUrl: string,
|
||||
apiKey: string,
|
||||
isFullUrl?: boolean,
|
||||
): Promise<FetchedModel[]> {
|
||||
return invoke("fetch_models_for_config", { baseUrl, apiKey, isFullUrl });
|
||||
}
|
||||
Reference in New Issue
Block a user