diff --git a/src/views/system/social-media/prompt-config.vue b/src/views/system/social-media/prompt-config.vue
index d9cd8ad..18f3a6a 100644
--- a/src/views/system/social-media/prompt-config.vue
+++ b/src/views/system/social-media/prompt-config.vue
@@ -116,7 +116,7 @@
新增配置
- 测试当前激活
+ 测试当前激活
刷新
@@ -611,6 +611,59 @@ export default {
this.$message.error('操作失败:' + (e.message || '未知错误'))
}
}
+ },
+
+ resetLlmTestDialog() {
+ this.llmTestRow = null
+ this.llmTestResult = null
+ this.llmTestLoading = false
+ },
+
+ openLlmTest(row) {
+ if (this.llmSummary && this.llmSummary.redisAvailable === false) {
+ this.$message.warning('Redis 未配置时无法从后台写入多套参数;仍可直接测 Jarvis 默认,请确认 Jarvis 地址正确。')
+ }
+ this.llmTestRow = row || null
+ this.llmTestMessage = '1+1等于几?请只回答一个数字或最简结果,不要多余解释。'
+ this.llmTestResult = null
+ this.llmTestDialogVisible = true
+ },
+
+ async submitLlmTest() {
+ if (!this.llmTestMessage || !this.llmTestMessage.trim()) {
+ this.$message.warning('请填写测试问题')
+ return
+ }
+ const payload = { message: this.llmTestMessage.trim() }
+ if (this.llmTestRow && this.llmTestRow.id) {
+ payload.profileId = this.llmTestRow.id
+ }
+ this.llmTestLoading = true
+ this.llmTestResult = null
+ try {
+ const res = await testLlmProfile(payload)
+ if (res.code === 200 && res.data) {
+ this.llmTestResult = {
+ success: !!res.data.success,
+ reply: res.data.reply,
+ error: res.data.error
+ }
+ if (this.llmTestResult.success) {
+ this.$message.success('测试完成')
+ } else {
+ this.$message.error(this.llmTestResult.error || '调用失败')
+ }
+ } else {
+ this.$message.error(res.msg || '测试失败')
+ this.llmTestResult = { success: false, error: res.msg || '未知错误' }
+ }
+ } catch (e) {
+ console.error(e)
+ this.$message.error('测试失败:' + (e.message || '未知错误'))
+ this.llmTestResult = { success: false, error: e.message || '未知错误' }
+ } finally {
+ this.llmTestLoading = false
+ }
}
}
}
@@ -702,5 +755,25 @@ export default {
.llm-del-btn {
color: #f56c6c;
}
+
+.llm-test-hint {
+ margin: 0 0 12px 0;
+ font-size: 13px;
+ color: #606266;
+ line-height: 1.5;
+}
+
+.llm-test-result {
+ margin-top: 12px;
+}
+
+.llm-test-reply {
+ margin: 8px 0 0 0;
+ white-space: pre-wrap;
+ word-break: break-word;
+ font-family: 'Consolas', 'Monaco', monospace;
+ font-size: 13px;
+ line-height: 1.5;
+}