mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 08:44:41 +08:00
088b47b08a
Slim the Hermes surface in CC Switch to match its core positioning — cross-client provider switching and shared MCP/prompts/skills — and delegate deep configuration (model, agent, env, skills, cron, logs) to the Hermes Web UI at http://127.0.0.1:9119. - Drop AgentPanel/EnvPanel/ModelPanel and their mutation commands, hooks, types, and i18n keys across zh/en/ja. - Add open_hermes_web_ui Tauri command that probes /api/status and launches the URL in the system browser. Hermes injects its own session token into the returned HTML, so CC Switch doesn't need to touch auth. - Surface the launcher from the Hermes toolbar and the health banner via a shared useOpenHermesWebUI() hook; the offline error code is defined once per side and referenced across the contract. - Keep read-only access to model.provider so ProviderList can still highlight the active supplier; apply_switch_defaults continues to write the top-level model section when switching providers. Net diff: +152 / -1253.
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { invoke } from "@tauri-apps/api/core";
|
|
import type { HermesModelConfig, HermesHealthWarning } from "@/types";
|
|
|
|
/**
|
|
* Hermes Agent configuration API (CC Switch side).
|
|
*
|
|
* CC Switch intentionally keeps its Hermes surface minimal — deep configuration
|
|
* (model, agent behavior, env vars, skills, cron, logs, analytics) lives in
|
|
* the Hermes Web UI at http://127.0.0.1:9119. CC Switch only reads the `model`
|
|
* section to highlight the active provider, scans config health, and launches
|
|
* the Hermes Web UI for everything else. Writes to `model` happen implicitly
|
|
* via `apply_switch_defaults` when the user switches providers.
|
|
*/
|
|
export const hermesApi = {
|
|
async getModelConfig(): Promise<HermesModelConfig | null> {
|
|
return await invoke("get_hermes_model_config");
|
|
},
|
|
|
|
async scanHealth(): Promise<HermesHealthWarning[]> {
|
|
return await invoke("scan_hermes_config_health");
|
|
},
|
|
|
|
/**
|
|
* Probe the local Hermes Web UI and open it in the system browser.
|
|
* Optional `path` lets callers deep-link to specific pages like `/config`.
|
|
*/
|
|
async openWebUI(path?: string): Promise<void> {
|
|
await invoke("open_hermes_web_ui", { path: path ?? null });
|
|
},
|
|
};
|