This commit is contained in:
van
2026-03-10 00:31:57 +08:00
parent 27c70ac567
commit 9f18f13607

View File

@@ -251,6 +251,56 @@
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
<!-- Ollama 服务健康度调试用 -->
<el-col :span="12" class="card-box">
<el-card>
<div slot="header" class="clearfix">
<span><i class="el-icon-cpu"></i> Ollama 服务健康度调试</span>
<el-button
style="float: right; padding: 3px 10px;"
type="primary"
size="mini"
:loading="ollamaTesting"
@click="testOllamaHealth"
>
{{ ollamaTesting ? '检测中...' : '测试' }}
</el-button>
</div>
<div class="el-table el-table--enable-row-hover el-table--medium">
<table cellspacing="0" style="width: 100%;">
<tbody>
<tr>
<td class="el-table__cell is-leaf"><div class="cell">服务状态</div></td>
<td class="el-table__cell is-leaf">
<div class="cell">
<el-tag :type="health.ollama && health.ollama.healthy ? 'success' : (health.ollama ? 'danger' : 'info')">
{{ health.ollama && health.ollama.status ? health.ollama.status : '未检测' }}
</el-tag>
</div>
</td>
</tr>
<tr>
<td class="el-table__cell is-leaf"><div class="cell">服务地址</div></td>
<td class="el-table__cell is-leaf">
<div class="cell" style="word-break: break-all;">
{{ health.ollama && health.ollama.serviceUrl ? health.ollama.serviceUrl : '-' }}
</div>
</td>
</tr>
<tr>
<td class="el-table__cell is-leaf"><div class="cell">状态信息</div></td>
<td class="el-table__cell is-leaf">
<div class="cell" :class="{'text-danger': health.ollama && !health.ollama.healthy}">
{{ health.ollama && health.ollama.message ? health.ollama.message : '点击「测试」获取健康度' }}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</el-card>
</el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
@@ -267,8 +317,10 @@ export default {
// 健康度检测信息 // 健康度检测信息
health: { health: {
logistics: null, logistics: null,
wxSend: null wxSend: null,
} ollama: null
},
ollamaTesting: false
} }
}, },
created() { created() {
@@ -294,6 +346,29 @@ export default {
console.error("获取健康度检测信息失败", error) 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() { openLoading() {
this.$modal.loading("正在加载服务监控数据,请稍候!") this.$modal.loading("正在加载服务监控数据,请稍候!")