diff --git a/src-tauri/src/commands/hermes.rs b/src-tauri/src/commands/hermes.rs index 211e883..c0ee2e3 100644 --- a/src-tauri/src/commands/hermes.rs +++ b/src-tauri/src/commands/hermes.rs @@ -2164,7 +2164,19 @@ pub async fn hermes_read_config_full() -> Result { // --------------------------------------------------------------------------- /// 找到 Hermes venv 的 Python 解释器路径 +/// +/// 优先级(P1-3 优化): +/// 1. 环境变量 `HERMES_PYTHON` — 适配自定义 venv(brew / uv tool / 容器等非默认路径) +/// 2. ~/.hermes-venv/bin/python (Unix) 或 ~/.hermes-venv/Scripts/python.exe (Windows) fn hermes_venv_python() -> Option { + // 1. HERMES_PYTHON 环境变量优先 + if let Ok(custom) = std::env::var("HERMES_PYTHON") { + let p = PathBuf::from(custom); + if p.exists() { + return Some(p); + } + } + // 2. 默认 venv 位置 let venv_dir = dirs::home_dir()?.join(".hermes-venv"); #[cfg(target_os = "windows")] let py = venv_dir.join("Scripts").join("python.exe"); diff --git a/src/engines/hermes/index.js b/src/engines/hermes/index.js index 384a9d6..533f54a 100644 --- a/src/engines/hermes/index.js +++ b/src/engines/hermes/index.js @@ -116,6 +116,8 @@ export default { { path: '/h/lazy-deps', loader: () => import('./pages/lazy-deps.js') }, { path: '/h/services', loader: () => import('./pages/services.js') }, { path: '/h/config', loader: () => import('./pages/config.js') }, + // Batch 1 §A: /h/channels 当前是 placeholder(487 字节 stub)— 暂不挂 nav + // 完整实现见 Batch 3,待 Hermes 渠道完整支持时启用 sidebar 入口 { path: '/h/channels', loader: () => import('./pages/channels.js') }, { path: '/h/env', loader: () => import('./pages/env-editor.js') }, // 共用页面(引擎无关) diff --git a/src/engines/hermes/pages/config.js b/src/engines/hermes/pages/config.js index fadefa0..982c641 100644 --- a/src/engines/hermes/pages/config.js +++ b/src/engines/hermes/pages/config.js @@ -26,13 +26,13 @@ export function render() { el.innerHTML = `
-
HERMES AGENT · CONFIG
+
${t('engine.hermesConfigEyebrow')}

${t('engine.hermesConfigTitle')}

~/.hermes/config.yaml
- - + +
@@ -40,7 +40,7 @@ export function render() {
config.yaml
- ${saving ? 'saving…' : loading ? 'loading…' : 'raw yaml editor'} + ${saving ? t('engine.hermesConfigStatusSaving') : loading ? t('engine.hermesConfigStatusLoading') : t('engine.hermesConfigStatusReady')}
@@ -76,7 +76,7 @@ export function render() { draw() try { await api.hermesConfigRawWrite(yaml) - toast('配置已保存,建议重启 Hermes Gateway 生效', 'success') + toast(t('engine.hermesConfigSaveSuccess'), 'success') } catch (err) { error = String(err?.message || err).replace(/^Error:\s*/, '') toast(error, 'error') diff --git a/src/locales/modules/engine.js b/src/locales/modules/engine.js index 2e0f3fe..5446ce7 100644 --- a/src/locales/modules/engine.js +++ b/src/locales/modules/engine.js @@ -429,6 +429,14 @@ export default { chatSlashPort: _('端口', 'Port', '埠'), chatSlashModel: _('模型', 'Model', '模型'), chatSlashRedirect: _('正在跳转到 {page}...', 'Redirecting to {page}...', '正在跳轉到 {page}...'), + // Batch 1 §B: Hermes config.js 编辑器(去掉硬编码) + hermesConfigEyebrow: _('HERMES AGENT · 配置', 'HERMES AGENT · CONFIG', 'HERMES AGENT · 設定'), + hermesConfigReload: _('重新加载', 'Reload', '重新載入'), + hermesConfigSave: _('保存配置', 'Save', '儲存設定'), + hermesConfigSaveSuccess: _('配置已保存,建议重启 Hermes Gateway 生效', 'Saved. Restart Hermes Gateway to take effect.', '已儲存設定,建議重啟 Hermes Gateway 生效'), + hermesConfigStatusSaving: _('保存中…', 'Saving…', '儲存中…'), + hermesConfigStatusLoading: _('加载中…', 'Loading…', '載入中…'), + hermesConfigStatusReady: _('raw yaml 编辑器', 'raw yaml editor', 'raw yaml 編輯器'), // 停止流式 chatStop: _('停止', 'Stop', '停止'), chatStopped: _('已停止当前回复', 'Run stopped', '已停止目前回覆'),