diff --git a/internal/plugins/webui/dashboard.html b/internal/plugins/webui/dashboard.html index c5b354c..5e5d06e 100644 --- a/internal/plugins/webui/dashboard.html +++ b/internal/plugins/webui/dashboard.html @@ -1,1912 +1,4413 @@ - + -
- - -' + + __("运行中...", "Running...") + + "
"; + try { + var r = await api("/kernel"); + var tools = r?.tools || []; + var healthTool = tools.find(function (t) { + return t.name === "healthcheck"; + }); + if (!healthTool) { + panel.innerHTML = + '' + + __("healthcheck 工具未注册", "healthcheck tool not registered") + + "
"; + return; + } + panel.innerHTML = + '' + + __( + "通过 Agent 对话触发 healthcheck...", + "Triggering healthcheck via Agent...", + ) + + "
"; + var chatR = await api("/chat", { + method: "POST", + body: JSON.stringify({ + message: __( + "请运行 healthcheck 工具进行全面健康检查并报告结果", + "Please run the healthcheck tool for a full system check and report the results", + ), + }), + }); + panel.innerHTML = + "" + escHtml(JSON.stringify(chatR, null, 2)) + ""; + } catch (e) { + panel.innerHTML = + '
' + + __("错误: ", "Error: ") + + escHtml(e.message) + + "
"; + toast( + __("健康检查失败: ", "Health check failed: ") + e.message, + true, + ); + } + } + + function renderHealthResult(r) { + if (!r || !r.checks) + return ( + '' + + __("暂无健康检查数据", "No health check data") + + "
" + ); + var checks = r.checks || []; + var passed = checks.filter(function (c) { + return c.pass; + }).length; + var failed = checks.filter(function (c) { + return !c.pass; + }).length; + var html = + '' + + __("内核未响应", "Kernel not responding") + + "
' + __("无", "None") + "
"; + } + html += "' + + __("暂无设置项", "No settings") + + "
' + + escHtml(desc) + + "
" + : ""; + html += + '' + + __( + "配置 Model Context Protocol 服务端连接", + "Configure Model Context Protocol server connections", + ) + + "
' + + __("设置面板已加载", "Settings panel loaded") + + "
' + + __( + "上传自定义 Lua 适配器脚本以支持新的 LLM 提供商。脚本文件将保存到适配器目录并自动加载到 Lua VM。", + "Upload custom Lua adapter scripts to support new LLM providers. Scripts are saved to the adapter directory and auto-loaded into the Lua VM.", + ) + + "
' + + __("暂无适配器", "No adapters") + + "
"; + } else { + html += + "| " + + __("名称", "Name") + + " | " + + __("版本", "Version") + + " | " + + __("操作", "Actions") + + " |
|---|---|---|
| " + + escHtml(a.name) + + " | " + + escHtml(a.version || "-") + + " | " + + '
' + + __("加载适配器失败: ", "Failed to load adapters: ") + + escHtml(e.message) + + "