diff --git a/README.md b/README.md index 347ce78..fd670f3 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@

- version + version electron typescript license @@ -46,7 +46,7 @@ | 🖥️ | **工作空间面板** | 终端(增量流式输出)+ 文件浏览器,命令安全检查 | | 🔢 | **上下文长度手动控制** | 设置面板下拉选择(128K / 256K / 512K / 1M),默认 128K,模型栏显示当前配置值,下拉框中显示每个模型自身的上下文长度 | | 🗜️ | **智能上下文管理** | 滑动窗口 + Token 自动校准 + 消息重要性评分 + LLM 结构化 JSON 压缩,智能触发(120 条增量压缩 + 200 条硬上限) | -| ⏱️ | **智能超时保护** | Agent Loop 看门狗(可配,默认 30min)+ 流式分级超时(空闲 30s + 总 300s)+ 工具 HTTP/MCP 超时可配 | +| ⏱️ | **智能超时保护** | Agent Loop 看门狗(可配,默认 30min)+ 流式总超时(可配,默认 300s)+ 工具 HTTP/MCP 超时可配 | | 🪝 | **Hook 系统** | 4 阶段生命周期钩子(pre_tool / post_tool / post_iteration / pre_completion),内置安全检查、文件去重、自动计划追踪、变更审计、结果校验 | | 👥 | **子代理委派** | spawn_task 工具,独立上下文 + 超时保护 | | 📈 | **Token 仪表盘** | 全局 + 会话统计,消耗趋势柱状图,2 秒刷新,输入/输出分色 | @@ -253,7 +253,7 @@ npm start ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist ``` -产出:`release/Metona Ollama Setup v0.14.0.exe` +产出:`release/Metona Ollama Setup v0.14.1.exe` ## 🛠️ 常用命令 @@ -295,7 +295,7 @@ npm run dist # 构建 Windows 安装包 | 🖥️ | **Workspace Panel** | Terminal (incremental streaming) + file browser, command security checks | | 🔢 | **Manual Context Length** | Settings dropdown (128K / 256K / 512K / 1M), default 128K. Model bar shows configured value, dropdown shows per-model context length | | 🗜️ | **Smart Context Manager** | Sliding window + Token auto-calibration + message importance scoring + LLM structured JSON compression, smart triggers (120 msg incremental + 200 msg hard limit) | -| ⏱️ | **Smart Timeout Protection** | Agent Loop watchdog (configurable, default 30min) + tiered stream timeout (idle 30s + total 300s) + configurable HTTP/MCP timeouts | +| ⏱️ | **Smart Timeout Protection** | Agent Loop watchdog (configurable, default 30min) + stream total timeout (configurable, default 300s) + configurable HTTP/MCP timeouts | | 🪝 | **Hook System** | 4-phase lifecycle hooks (pre_tool / post_tool / post_iteration / pre_completion), built-in security check, file dedup, auto plan tracking, change audit, result validation | | 👥 | **Sub-agent Delegation** | spawn_task tool, isolated context + timeout protection | | 📈 | **Token Dashboard** | Global + session stats, consumption trend bar chart, 2s refresh, input/output color-coded | @@ -501,7 +501,7 @@ npm start ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist ``` -Output: `release/Metona Ollama Setup v0.14.0.exe` +Output: `release/Metona Ollama Setup v0.14.1.exe` ## 🛠️ Common Commands diff --git a/package-lock.json b/package-lock.json index be538be..ed54c1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "metona-ollama-desktop", - "version": "0.14.0", + "version": "0.14.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "metona-ollama-desktop", - "version": "0.14.0", + "version": "0.14.1", "license": "MIT", "dependencies": { "ffmpeg-static": "^5.2.0", diff --git a/package.json b/package.json index 6f5431b..863022f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metona-ollama-desktop", - "version": "0.14.0", + "version": "0.14.1", "description": "Metona Ollama - TypeScript + Electron 桌面 AI 聊天客户端", "main": "dist/main/main.js", "author": "thzxx", diff --git a/src/main/menu.ts b/src/main/menu.ts index 86b5a37..13f8683 100644 --- a/src/main/menu.ts +++ b/src/main/menu.ts @@ -101,7 +101,7 @@ export function createMenu(): void { dialog.showMessageBox(mainWindow!, { type: 'info', title: '关于 Metona Ollama', - message: 'Metona Ollama Desktop v0.14.0', + message: 'Metona Ollama Desktop v0.14.1', detail: 'TypeScript + Electron Ollama AI 聊天客户端\n\nhttps://gitee.com/thzxx/metona-ollama', icon: getIconPath() }); diff --git a/src/renderer/components/input-area.ts b/src/renderer/components/input-area.ts index 632a3d9..7d3ba54 100644 --- a/src/renderer/components/input-area.ts +++ b/src/renderer/components/input-area.ts @@ -626,7 +626,7 @@ async function handleRetry(): Promise { })); } await saveCurrentSession(); - if (loopStats?.prompt_eval_count) updateCtxRemain(loopStats.prompt_eval_count); + if (loopStats?.ctx_tokens) updateCtxRemain(loopStats.ctx_tokens); } }); } catch (err) { @@ -789,16 +789,16 @@ function stopGeneration(): void { if (abortController) abortController.abort(); } -/** 更新剩余上下文显示 */ -function updateCtxRemain(promptEvalCount?: number): void { +/** 更新剩余上下文显示(使用 estimateTokens 估算实际占用,非 Ollama eval_count) */ +function updateCtxRemain(ctxTokens?: number): void { const el = document.querySelector('#ctxRemain') as HTMLElement; if (!el) return; const total = state.get(KEYS.NUM_CTX, 0); - if (!total || !promptEvalCount || promptEvalCount <= 0) { + if (!total || !ctxTokens || ctxTokens <= 0) { el.style.display = 'none'; return; } - const remain = total - promptEvalCount; + const remain = total - ctxTokens; if (remain <= 0) { el.style.display = 'inline-flex'; el.textContent = '⚠ 上下文已满'; @@ -806,8 +806,9 @@ function updateCtxRemain(promptEvalCount?: number): void { } else { el.style.display = 'inline-flex'; el.style.color = ''; - const fmt = remain >= 1024 ? `${(remain / 1024).toFixed(0)}K` : String(remain); - el.textContent = `剩余 ${fmt}`; + const remainFmt = remain >= 1024 ? `${(remain / 1024).toFixed(0)}K` : String(remain); + const usedFmt = ctxTokens >= 1024 ? `${(ctxTokens / 1024).toFixed(0)}K` : String(ctxTokens); + el.textContent = `${usedFmt} / ${total >= 1024 ? (total/1024).toFixed(0)+'K' : total}`; } } diff --git a/src/renderer/components/model-bar.ts b/src/renderer/components/model-bar.ts index 4ad8ce6..15071e1 100644 --- a/src/renderer/components/model-bar.ts +++ b/src/renderer/components/model-bar.ts @@ -98,7 +98,7 @@ export async function loadModels(): Promise { await checkModelCapability(modelSelectEl.value); } - filterEmbedModels(data.models); + await filterEmbedModels(data.models); } catch (err) { logError('加载模型列表失败', (err as Error).message); modelSelectEl.innerHTML = ''; diff --git a/src/renderer/index.html b/src/renderer/index.html index 25693e6..7ddbe43 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -28,7 +28,7 @@

Metona Ollama - v0.14.0 + v0.14.1