This commit is contained in:
van
2026-04-05 21:35:50 +08:00
parent 5cbcfa9533
commit 2d1f980a47
2 changed files with 49 additions and 3 deletions

View File

@@ -116,6 +116,7 @@
</span>
<div style="float: right;">
<el-button type="primary" size="small" icon="el-icon-plus" @click="openLlmDialog(false)">新增配置</el-button>
<el-button size="small" icon="el-icon-video-play" @click="openLlmTest(null)">测试当前激活</el-button>
<el-button size="small" icon="el-icon-refresh" @click="loadLlmList">刷新</el-button>
</div>
</div>
@@ -175,9 +176,10 @@
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right">
<el-table-column label="操作" width="268" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="small" :disabled="scope.row.active" @click="handleActivateLlm(scope.row)">激活</el-button>
<el-button type="text" size="small" @click="openLlmTest(scope.row)">测试</el-button>
<el-button type="text" size="small" @click="openLlmDialog(true, scope.row)">编辑</el-button>
<el-button type="text" size="small" class="llm-del-btn" @click="handleDeleteLlm(scope.row)">删除</el-button>
</template>
@@ -234,6 +236,35 @@
<el-button type="primary" :loading="llmSaving" @click="submitLlmDialog"> </el-button>
</div>
</el-dialog>
<el-dialog
title="大模型连通测试"
:visible.sync="llmTestDialogVisible"
width="560px"
append-to-body
@close="resetLlmTestDialog">
<p v-if="llmTestRow" class="llm-test-hint">
将使用配置<strong>{{ llmTestRow.name }}</strong>的参数请求与是否已激活无关
</p>
<p v-else class="llm-test-hint">
未指定某一套配置将使用 Jarvis 当前<strong>已激活</strong>的一套若未激活则使用 Jarvis <strong>application.yml</strong> 默认 Ollama
</p>
<el-form label-width="88px">
<el-form-item label="测试问题">
<el-input v-model="llmTestMessage" type="textarea" :rows="4" placeholder="默认会询问 1+1可改成任意短句做连通性验证" />
</el-form-item>
</el-form>
<div v-if="llmTestResult" class="llm-test-result">
<el-alert v-if="llmTestResult.success" title="模型回复" type="success" :closable="false" show-icon>
<pre class="llm-test-reply">{{ llmTestResult.reply }}</pre>
</el-alert>
<el-alert v-else :description="llmTestResult.error || '请求失败'" title="调用失败" type="error" :closable="false" show-icon />
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="llmTestDialogVisible = false"> </el-button>
<el-button type="primary" :loading="llmTestLoading" icon="el-icon-position" @click="submitLlmTest">发送测试</el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
@@ -251,7 +282,8 @@ import {
deleteLlmProfile,
setActiveLlmProfile,
clearActiveLlmProfile,
resetAllLlmConfig
resetAllLlmConfig,
testLlmProfile
} from '@/api/jarvis/socialMediaPrompt'
export default {
@@ -277,7 +309,12 @@ export default {
llmHasApiKey: false,
llmApiKeyMasked: null,
llmClearApiKey: false,
llmSaving: false
llmSaving: false,
llmTestDialogVisible: false,
llmTestRow: null,
llmTestMessage: '1+1等于几请只回答一个数字或最简结果不要多余解释。',
llmTestLoading: false,
llmTestResult: null
}
},
computed: {