diff --git a/src/views/monitor/server/index.vue b/src/views/monitor/server/index.vue index 750dd9b..f9b0f0b 100644 --- a/src/views/monitor/server/index.vue +++ b/src/views/monitor/server/index.vue @@ -251,6 +251,56 @@ + + + + +
+ Ollama 服务健康度(调试) + + {{ ollamaTesting ? '检测中...' : '测试' }} + +
+
+ + + + + + + + + + + + + + + +
服务状态
+
+ + {{ health.ollama && health.ollama.status ? health.ollama.status : '未检测' }} + +
+
服务地址
+
+ {{ health.ollama && health.ollama.serviceUrl ? health.ollama.serviceUrl : '-' }} +
+
状态信息
+
+ {{ health.ollama && health.ollama.message ? health.ollama.message : '点击「测试」获取健康度' }} +
+
+
+
+
@@ -267,8 +317,10 @@ export default { // 健康度检测信息 health: { logistics: null, - wxSend: null - } + wxSend: null, + ollama: null + }, + ollamaTesting: false } }, created() { @@ -294,6 +346,29 @@ export default { console.error("获取健康度检测信息失败", error) }) }, + /** 测试 Ollama 健康度(调试用) */ + testOllamaHealth() { + this.ollamaTesting = true + getHealth() + .then(response => { + if (response.data) { + this.health = response.data + const ollama = response.data.ollama + if (ollama && ollama.healthy) { + this.$message.success('Ollama 服务正常') + } else { + this.$message.warning(ollama && ollama.message ? ollama.message : 'Ollama 服务异常或未配置') + } + } + }) + .catch(error => { + console.error('Ollama 健康度检测失败', error) + this.$message.error('检测失败: ' + (error.message || '网络异常')) + }) + .finally(() => { + this.ollamaTesting = false + }) + }, // 打开加载层 openLoading() { this.$modal.loading("正在加载服务监控数据,请稍候!")