From 76dbd22df2e5032af6dd281c59f168f9ad54d1f1 Mon Sep 17 00:00:00 2001 From: wanghanlin <1533525126@qq.com> Date: Tue, 30 Jun 2026 09:27:00 +0800 Subject: [PATCH] =?UTF-8?q?:=20=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=94=B9=E9=80=A0=20+=20=E4=BA=A4=E4=BA=92=E4=BD=93?= =?UTF-8?q?=E9=AA=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/components/AuditLogManager.js | 103 +++++++++ .../resources/static/components/FaqManager.js | 10 +- .../static/components/ModelConfigManager.js | 99 ++++----- .../static/components/SensitiveWordManager.js | 65 +----- src/main/resources/static/css/main.css | 75 +++++-- src/main/resources/static/js/app.js | 202 ++++++++++++------ src/main/resources/static/js/store.js | 114 +++++++++- 7 files changed, 469 insertions(+), 199 deletions(-) create mode 100644 src/main/resources/static/components/AuditLogManager.js diff --git a/src/main/resources/static/components/AuditLogManager.js b/src/main/resources/static/components/AuditLogManager.js new file mode 100644 index 0000000..84769a0 --- /dev/null +++ b/src/main/resources/static/components/AuditLogManager.js @@ -0,0 +1,103 @@ +/** + * 内容审计日志组件 + * 展示敏感词命中记录,支持分页浏览 + */ +import { listAuditLogs } from '../js/api.js' +import { toast } from '../js/utils.js' + +export default { + template: ` +
+

📋 内容审计日志

+

记录所有敏感词命中事件,包含输入/输出方向、违规内容、命中词及处理方式。

+ + +
+ + + + + + + + + + + + + + + + + + + + + +
时间方向违规内容命中词处理方式
加载中...
暂无审计日志
{{ formatTime(log.createTime) }} + + {{ log.direction === 'INPUT' ? '输入' : '输出' }} + + {{ log.originalText }}{{ formatHitWords(log.hitWords) }} + + {{ log.actionTaken === 'BLOCK' ? '拦截' : log.actionTaken === 'MASK' ? '脱敏' : '通过' }} + +
+
+ + +
+ + 第 {{ page }} / {{ Math.ceil(total / pageSize) }} 页(共 {{ total }} 条) + +
+
+ `, + + data() { + return { + logs: [], + loading: false, + page: 1, + pageSize: 30, + total: 0 + } + }, + + mounted() { + this.loadLogs() + }, + + methods: { + async loadLogs() { + this.loading = true + try { + const res = await listAuditLogs(this.page, this.pageSize) + if (res.success) { + this.logs = res.data?.records || res.data || [] + this.total = res.data?.total || 0 + } else { + toast('加载审计日志失败: ' + (res.message || '未知错误'), 'error') + } + } catch (e) { + toast('加载审计日志失败: ' + e.message, 'error') + } + this.loading = false + }, + + formatTime(t) { return t ? new Date(t).toLocaleString('zh-CN') : '' }, + + formatHitWords(hw) { + if (!hw) return '' + if (hw.type === 'jsonb' && hw.value) { + try { hw = JSON.parse(hw.value) } catch { return hw.value } + } + if (typeof hw === 'string') { try { hw = JSON.parse(hw) } catch { return hw } } + if (hw && hw.hits && Array.isArray(hw.hits)) { + return hw.hits.map(h => `${h.word || ''}(${h.category || ''})`).join('、') + } + if (Array.isArray(hw)) return hw.map(h => typeof h === 'string' ? h : h.word || '').join('、') + return String(hw) + } + } +} diff --git a/src/main/resources/static/components/FaqManager.js b/src/main/resources/static/components/FaqManager.js index df97487..9f73634 100644 --- a/src/main/resources/static/components/FaqManager.js +++ b/src/main/resources/static/components/FaqManager.js @@ -77,8 +77,8 @@ export default { -
-
+
+

{{ editingFaq ? '编辑 FAQ' : '添加 FAQ' }}

@@ -86,7 +86,7 @@ export default {
- +
@@ -110,8 +110,8 @@ export default {
-
-
+
+

批量导入 FAQ

使用 JSON 格式批量导入,每条包含 question、answer、similarQuestions(可选数组)、category(可选)

diff --git a/src/main/resources/static/components/ModelConfigManager.js b/src/main/resources/static/components/ModelConfigManager.js index 3918ce9..1850c8d 100644 --- a/src/main/resources/static/components/ModelConfigManager.js +++ b/src/main/resources/static/components/ModelConfigManager.js @@ -162,41 +162,39 @@ export default {
-