diff --git a/ai_knowledge_base_v2/apps/admin-web/src/App.vue b/ai_knowledge_base_v2/apps/admin-web/src/App.vue index 2634f40..ccf8245 100644 --- a/ai_knowledge_base_v2/apps/admin-web/src/App.vue +++ b/ai_knowledge_base_v2/apps/admin-web/src/App.vue @@ -3,6 +3,7 @@ import { ElMessage, ElMessageBox } from "element-plus"; import { computed, onMounted, reactive, ref } from "vue"; import AdminLoginView from "./components/AdminLoginView.vue"; +import KnowledgeManagementView from "./components/KnowledgeManagementView.vue"; import { systemSettingDefinitions, systemSettingSections, type SystemSettingValue } from "./config/systemSettings"; import { api, clearToken, getToken, saveToken } from "./services/api"; import type { @@ -14,6 +15,8 @@ import type { ChatRecord, DashboardStats, KnowledgeItem, + RetrievalLogItem, + AttentionItem, ModelItem, SystemConfigItem, UserImportResult, @@ -36,6 +39,10 @@ const configs = ref([]); const chats = ref([]); const aiLogs = ref([]); const operationLogs = ref[]>([]); +const retrievalLogs = ref([]); +const attentionRecords = ref([]); +const selectedRetrievalLog = ref | null>(null); +const retrievalDetailOpen = ref(false); const promptContent = ref(""); const chatDetail = ref(null); const chatDetailOpen = ref(false); @@ -47,6 +54,7 @@ const editingKnowledgeId = ref(null); const batchNodeToken = ref(""); const batchImporting = ref(false); const agentDebugging = ref(false); +const agentDebugTrace = ref[]>([]); const agentPreviewMessages = ref<{ role: "user" | "assistant" | "system"; content: string }[]>([ { role: "assistant", content: "选择模型和知识库后,可以在这里调试 Agent 的真实问答效果。" }, ]); @@ -263,6 +271,8 @@ async function loadCurrentMenu() { aiLogs.value = await api.aiLogs(); operationLogs.value = await api.operationLogs(); } + if (activeMenu.value === "retrievals") retrievalLogs.value = await api.retrievalLogs(); + if (activeMenu.value === "attention") attentionRecords.value = await api.attentionList(); } finally { loading.value = false; } @@ -711,6 +721,7 @@ async function debugAgent() { return; } agentPreviewMessages.value.push({ role: "assistant", content: result.answer }); + agentDebugTrace.value = result.retrievalTrace || []; ElMessage.success(result.message); } catch (error) { const message = error instanceof Error ? error.message : "Agent 调试失败"; @@ -725,6 +736,35 @@ function clearAgentPreview() { agentPreviewMessages.value = [ { role: "assistant", content: "预览已清空,可以继续发起新的 Agent 调试。" }, ]; + agentDebugTrace.value = []; +} + +async function openRetrievalDetail(row: RetrievalLogItem) { + selectedRetrievalLog.value = await api.retrievalLogDetail(row.id); + retrievalDetailOpen.value = true; +} + +async function updateAttentionStatus(row: AttentionItem, status: string) { + await api.updateAttention(row.id, status); + ElMessage.success("人工关注状态已更新"); + attentionRecords.value = await api.attentionList(); +} + +async function deleteAttentionRecord(row: AttentionItem) { + try { + await ElMessageBox.confirm("确定删除这条人工关注记录吗?操作将写入审计日志。", "删除人工关注记录", { + confirmButtonText: "确认删除", cancelButtonText: "取消", type: "warning", + }); + } catch { + return; + } + await api.deleteAttention(row.id); + ElMessage.success("人工关注记录已删除"); + attentionRecords.value = await api.attentionList(); +} + +function attentionPriorityLabel(priority: string) { + return { urgent: "紧急", important: "重要", normal: "普通" }[priority as "urgent" | "important" | "normal"] || priority; } async function clearFeishuCache() { @@ -750,6 +790,11 @@ async function openChatDetail(row: ChatRecord) { chatDetailOpen.value = true; } +async function openChatSession(sessionId: number) { + chatDetail.value = await api.chatDetail(sessionId); + chatDetailOpen.value = true; +} + async function openAiLogDetail(row: AiLogRecord) { selectedAiLog.value = await api.aiLogDetail(row.id); aiLogDetailOpen.value = true; @@ -792,6 +837,8 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") { + +
@@ -908,53 +955,7 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") { @@ -1212,6 +1226,36 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") {
+ + + +