feat: 重构 AuditView 支持规则/技能分类,新增 Agent 开发文档

This commit is contained in:
caoxiaozhu
2026-05-11 01:53:30 +00:00
parent 0c6ac50b31
commit f738b6cdd4
33 changed files with 5853 additions and 204 deletions

View File

@@ -1,9 +1,9 @@
import { computed, ref, watch } from 'vue'
const TYPE_META = {
skills: {
createButtonLabel: '新建 Skill',
hintText: 'Skills 对应报销审查规则 .md 文件,点击任意行查看规则配置与命中产出。',
rules: {
createButtonLabel: '新建规则',
hintText: '规则对应报销审查 .md 文件,点击任意行查看规则内容、审核状态与版本。',
filters: ['按规则场景筛选', '按风险等级筛选', '按负责人筛选'],
tableColumns: {
name: '规则文件',
@@ -15,6 +15,20 @@ const TYPE_META = {
metric: '命中率'
}
},
skills: {
createButtonLabel: '新建技能',
hintText: '技能用于承载可复用的审批、问答、解释和数据处理能力。',
filters: ['按技能场景筛选', '按调用方式筛选', '按负责人筛选'],
tableColumns: {
name: '技能名称',
category: '技能分类',
owner: '负责人',
scope: '适用范围',
runtime: '调用方式',
version: '版本',
metric: '命中率'
}
},
mcp: {
createButtonLabel: '接入 MCP',
hintText: 'MCP 管理外部服务连接如发票验真、预算、银行流水、OCR 与差旅平台。',
@@ -30,8 +44,8 @@ const TYPE_META = {
}
},
schedules: {
createButtonLabel: '新建定时任务',
hintText: '定时任务用于每日风险检查、知识积累、报销报账和账款信息统计。',
createButtonLabel: '新建任务',
hintText: '任务用于每日风险检查、知识积累、报销报账和账款信息统计。',
filters: ['按运行频率筛选', '按产出类型筛选', '按告警级别筛选'],
tableColumns: {
name: '任务名称',
@@ -133,8 +147,8 @@ function buildAsset({
const assets = [
buildAsset({
type: 'skills',
typeLabel: 'Skills',
type: 'rules',
typeLabel: '规则',
id: 'SKL-001',
short: 'DR',
name: '重复报销识别规则.md',
@@ -225,7 +239,7 @@ const assets = [
],
titles: {
configTitle: '规则文件配置',
configDesc: 'Skills 以 .md 文件维护报销审查规则,配置规则路径、等级和执行节点。',
configDesc: '技能以 .md 文件维护报销审查规则,配置规则路径、等级和执行节点。',
detailTitle: '规则结构',
detailDesc: '按输入字段、判断逻辑和输出格式组织审查规则。',
outputTitle: '产出与校验',
@@ -244,8 +258,8 @@ const assets = [
publish: { meta: '最近评审2026-05-09 08:10', state: '可发布' }
}),
buildAsset({
type: 'skills',
typeLabel: 'Skills',
type: 'rules',
typeLabel: '规则',
id: 'SKL-002',
short: 'TS',
name: '差旅标准超额检查.md',
@@ -351,6 +365,241 @@ const assets = [
},
publish: { meta: '最近评审2026-05-08 18:35', state: '待评审' }
}),
buildAsset({
type: 'rules',
typeLabel: '规则',
id: 'SKL-003',
short: 'AT',
name: '异常附件完整性检查.md',
summary: '检查报销附件是否缺失、重复、模糊或与费用类型不匹配。',
category: '附件审查规则',
owner: '财务共享组',
reviewer: '赵宁',
scope: '票据与附件',
model: '提交时触发',
version: 'v1.3',
status: '草稿中',
statusTone: 'draft',
hitRate: '84.6%',
updatedAt: '2026-05-07 16:20',
badgeTone: 'violet',
triggerMode: '申请提交 / 补件复核',
fields: [
{ label: '规则名称', value: '异常附件完整性检查.md' },
{ label: '文件路径', value: 'skills/reimbursement/attachment-integrity.md' },
{ label: '规则等级', value: '中风险' },
{ label: '执行节点', value: '提交时触发' }
],
markdownContent: `# 异常附件完整性检查
## 目标
检查报销单据附件是否完整、清晰,并确认附件类型与费用明细匹配。
## 适用范围
- 单据类型:日常报销、差旅报销、供应商报账
- 附件类型:发票、行程单、合同、审批截图、付款凭证
- 执行节点:申请提交、补件复核
## 输入字段
- reimbursement_id报销单号
- expense_type费用类型
- attachment_list附件列表
- attachment_ocr_text附件 OCR 文本
- required_attachment_types必需附件类型
- applicant_note申请人说明
## 判断规则
1. 必需附件缺失时,标记补件风险。
2. 附件 OCR 置信度低于 0.75 时,标记影像不清晰。
3. 附件类型与费用类型不匹配时,进入人工复核。
4. 相同附件重复上传时,提示申请人清理重复附件。
## 输出
\`\`\`json
{
"risk_code": "attachment_integrity",
"risk_level": "medium",
"missing_attachments": [],
"invalid_attachments": [],
"suggestion": "补充缺失附件或重新上传清晰附件"
}
\`\`\`
## 管理员备注
- 必需附件清单由费用类型配置驱动。
- 新增费用类型时必须同步补充 required_attachment_types。`,
sections: [
{ title: '附件清单', intent: '审查依赖', content: '读取费用类型对应的必需附件、已上传附件、OCR 文本和申请人说明。' },
{ title: '判断逻辑', intent: '规则主体', content: '检查缺失、模糊、重复和类型不匹配四类附件问题。' },
{ title: '输出格式', intent: '补件结果', content: '输出缺失附件、异常附件、风险等级和补件建议。' }
],
rules: ['缺少必需附件时必须阻断提交。', '影像不清晰时允许提交但标记补件。', '重复附件只提示清理,不计入高风险。'],
checks: [
{ name: '缺少发票', input: '费用类型要求发票但未上传', result: '通过', tone: 'success' },
{ name: '附件模糊', input: 'OCR 置信度 0.62', result: '通过', tone: 'success' },
{ name: '合同附件误判', input: '合同页被识别为发票', result: '待修复', tone: 'warning' }
],
triggers: ['附件缺失', '附件模糊', '补件复核', '类型不匹配'],
tools: [
{ name: '附件 OCR MCP', scope: '附件文字识别', mode: '只读', tone: 'safe' },
{ name: '费用类型配置', scope: '必需附件清单', mode: '只读', tone: 'safe' }
],
history: [
{ version: 'v1.3', note: '新增附件类型与费用类型匹配检查', time: '05-07 16:20' },
{ version: 'v1.2', note: '补充 OCR 置信度阈值', time: '05-04 11:35' },
{ version: 'v1.1', note: '加入重复附件提示', time: '04-29 15:10' },
{ version: 'v1.0', note: '上线缺失附件检查', time: '04-24 09:00' },
{ version: 'v0.9', note: '完成规则草案评审', time: '04-20 17:45' }
],
titles: {
configTitle: '规则文件配置',
configDesc: '技能以 .md 文件维护报销审查规则,配置规则路径、等级和执行节点。',
detailTitle: '规则结构',
detailDesc: '按附件清单、判断逻辑和输出格式组织规则。',
outputTitle: '产出与校验',
outputDesc: '附件检查结果进入提交拦截和补件提示。',
ruleListTitle: '输出要求',
checkListTitle: '测试样例',
triggerTitle: '触发规则',
triggerDesc: '当前命中策略',
toolTitle: '依赖能力',
toolDesc: '规则运行时调用',
historyTitle: '版本历史',
historyDesc: '最近变更',
publishTitle: '评审控制',
publishDesc: '当前规则仍有误判样例待修复。',
},
publish: { meta: '最近评审2026-05-07 16:20', state: '草稿中' }
}),
buildAsset({
type: 'skills',
typeLabel: '技能',
id: 'SKL-AI-001',
short: 'AP',
name: '审批意见生成技能',
summary: '基于单据、规则命中和制度依据生成可复用的审批意见。',
category: '审批辅助技能',
owner: '审批运营组',
reviewer: '韩悦',
scope: '财务审批',
model: '审批中心按钮调用',
version: 'v1.8',
status: '已上线',
statusTone: 'success',
hitRate: '88.4%',
updatedAt: '2026-05-09 10:20',
badgeTone: 'blue',
triggerMode: '审批中心显式调用',
fields: [
{ label: '技能名称', value: '审批意见生成技能' },
{ label: '技能分类', value: '审批辅助技能' },
{ label: '调用入口', value: '审批中心 / 单据详情' },
{ label: '默认模型', value: 'GPT-5.4' }
],
sections: [
{ title: '输入上下文', intent: '读取范围', content: '读取当前单据、规则命中结果、制度引用、附件状态和历史审批结论。' },
{ title: '生成策略', intent: '审批表达', content: '按通过、驳回、补件三类场景生成审批意见,并明确对应依据。' },
{ title: '输出格式', intent: '写回字段', content: '输出审批意见、判断依据、补件动作和可编辑的推荐话术。' }
],
rules: ['必须引用规则命中或制度条款。', '驳回意见必须给出补充动作。', '不替代审批人最终决策。'],
checks: [
{ name: '高风险驳回意见', input: '重复发票 + 缺附件', result: '通过', tone: 'success' },
{ name: '低风险通过意见', input: '规则全部通过', result: '通过', tone: 'success' }
],
triggers: ['生成审批意见', '通过意见', '驳回意见', '补件说明'],
tools: [
{ name: '规则命中结果', scope: '读取风险依据', mode: '只读', tone: 'safe' },
{ name: '制度知识库', scope: '条款引用', mode: '只读', tone: 'safe' },
{ name: '审批意见草稿', scope: '写入建议', mode: '写入', tone: 'active' }
],
history: [
{ version: 'v1.8', note: '优化高风险驳回话术', time: '05-09 10:20' },
{ version: 'v1.7', note: '补充补件意见模板', time: '05-04 14:30' }
],
titles: {
configTitle: '技能配置',
configDesc: '定义技能入口、适用范围、默认模型和上下文读取边界。',
detailTitle: '技能流程',
detailDesc: '按输入上下文、生成策略和输出格式组织技能行为。',
outputTitle: '输出契约与测试样例',
outputDesc: '确保技能在审批场景下输出稳定、可编辑且可追溯。',
ruleListTitle: '输出要求',
checkListTitle: '测试样例',
triggerTitle: '触发入口',
triggerDesc: '当前可调用场景',
toolTitle: '依赖能力',
toolDesc: '技能运行时调用',
historyTitle: '版本历史',
historyDesc: '最近变更',
publishTitle: '发布控制',
publishDesc: '当前技能已通过核心测试,可在审批中心使用。',
},
publish: { meta: '最近评审2026-05-09 10:20', state: '可用' }
}),
buildAsset({
type: 'skills',
typeLabel: '技能',
id: 'SKL-AI-002',
short: 'EX',
name: '风险解释技能',
summary: '把规则命中的风险原因解释成员工可理解的补件或修正建议。',
category: '风险解释技能',
owner: '财务共享组',
reviewer: '赵宁',
scope: '员工自助',
model: '风险提示入口调用',
version: 'v1.4',
status: '待评审',
statusTone: 'warning',
hitRate: '82.1%',
updatedAt: '2026-05-08 15:10',
badgeTone: 'amber',
triggerMode: '风险拦截后调用',
fields: [
{ label: '技能名称', value: '风险解释技能' },
{ label: '技能分类', value: '风险解释技能' },
{ label: '调用入口', value: '提交拦截 / 补件提示' },
{ label: '默认模型', value: 'GPT-5.4-Mini' }
],
sections: [
{ title: '输入上下文', intent: '读取范围', content: '读取风险标签、规则证据、附件状态、制度条款和当前流程节点。' },
{ title: '解释策略', intent: '用户表达', content: '用原因、影响、处理建议三段式解释风险,不暴露内部评分细节。' },
{ title: '输出格式', intent: '员工提示', content: '输出可执行的补件动作、重传要求或人工复核说明。' }
],
rules: ['不展示内部风控分值。', '建议必须可执行。', '附件缺失时必须列出材料名称。'],
checks: [
{ name: '住宿超标解释', input: '酒店单晚超标 18%', result: '通过', tone: 'success' },
{ name: '附件缺失解释', input: '缺少发票附件', result: '评审中', tone: 'warning' }
],
triggers: ['为什么被拦截', '补件说明', '风险原因', '重新提交建议'],
tools: [
{ name: '风险标签读取', scope: '异常原因', mode: '只读', tone: 'safe' },
{ name: '规则文件引用', scope: '解释依据', mode: '只读', tone: 'safe' }
],
history: [
{ version: 'v1.4', note: '新增补件导向模板', time: '05-08 15:10' },
{ version: 'v1.3', note: '优化员工侧语气', time: '05-03 11:40' }
],
titles: {
configTitle: '技能配置',
configDesc: '定义技能入口、适用范围、默认模型和风险解释边界。',
detailTitle: '技能流程',
detailDesc: '按输入上下文、解释策略和输出格式组织技能行为。',
outputTitle: '输出契约与测试样例',
outputDesc: '确保风险解释清晰、可执行且不过度暴露内部规则。',
ruleListTitle: '输出要求',
checkListTitle: '测试样例',
triggerTitle: '触发入口',
triggerDesc: '当前可调用场景',
toolTitle: '依赖能力',
toolDesc: '技能运行时调用',
historyTitle: '版本历史',
historyDesc: '最近变更',
publishTitle: '发布控制',
publishDesc: '当前技能仍需补充附件缺失场景样例。',
},
publish: { meta: '最近评审2026-05-08 15:10', state: '待评审' }
}),
buildAsset({
type: 'mcp',
typeLabel: 'MCP',
@@ -400,7 +649,7 @@ const assets = [
detailTitle: '服务协议',
detailDesc: '按输入参数、调用链路和返回结构描述 MCP 能力。',
outputTitle: '返回与检查',
outputDesc: '服务输出会被审查规则、审批中心和定时任务消费。',
outputDesc: '服务输出会被审查规则、审批中心和任务消费。',
ruleListTitle: '调用约束',
checkListTitle: '健康检查',
triggerTitle: '服务场景',
@@ -410,13 +659,13 @@ const assets = [
historyTitle: '调用记录',
historyDesc: '最近运行',
publishTitle: '连接状态',
publishDesc: '服务健康,可供规则与定时任务调用。',
publishDesc: '服务健康,可供规则与任务调用。',
},
publish: { meta: '最近探活2026-05-09 07:50', state: '可用' }
}),
buildAsset({
type: 'schedules',
typeLabel: '定时任务',
typeLabel: '任务',
id: 'JOB-001',
short: 'RK',
name: '每日风险巡检',
@@ -440,7 +689,7 @@ const assets = [
],
sections: [
{ title: '数据抽取', intent: '扫描范围', content: '读取昨日新增报销、报账、发票、付款流水和审批反馈。' },
{ title: '规则执行', intent: '风险判断', content: '运行重复报销、超标、作废票、异常付款等 Skills,并调用必要 MCP。' },
{ title: '规则执行', intent: '风险判断', content: '运行重复报销、超标、作废票、异常付款等技能,并调用必要 MCP。' },
{ title: '结果写入', intent: '任务产出', content: '生成风险日报、风险工单、审计日志,并通知负责人。' }
],
rules: ['任务失败必须告警。', '每次运行记录规则版本和扫描窗口。', '高风险工单必须进入审批中心。'],
@@ -450,7 +699,7 @@ const assets = [
],
triggers: ['每日风险检查', '发票验真', '账款核对', '风险日报'],
tools: [
{ name: '报销审查 Skills', scope: '规则执行', mode: '调用', tone: 'active' },
{ name: '报销审查技能', scope: '规则执行', mode: '调用', tone: 'active' },
{ name: '发票验真 MCP', scope: '票据核验', mode: '调用', tone: 'active' },
{ name: '账款流水 MCP', scope: '付款核对', mode: '调用', tone: 'active' }
],
@@ -459,12 +708,12 @@ const assets = [
{ version: '02:00', note: '任务开始,扫描 2026-05-08 数据', time: '今日' }
],
titles: {
configTitle: '定时任务配置',
configTitle: '任务配置',
configDesc: '配置运行频率、扫描范围、依赖能力和告警出口。',
detailTitle: '任务流程',
detailDesc: '从数据抽取、规则执行到结果写入描述调度链路。',
outputTitle: '产出与检查',
outputDesc: '定时任务产出进入风险看板、审批中心和审计留痕。',
outputDesc: '任务产出进入风险看板、审批中心和审计留痕。',
ruleListTitle: '运行要求',
checkListTitle: '最近检查',
triggerTitle: '任务场景',
@@ -480,7 +729,7 @@ const assets = [
}),
buildAsset({
type: 'schedules',
typeLabel: '定时任务',
typeLabel: '任务',
id: 'JOB-002',
short: 'FN',
name: '每日报销报账与账款统计',
@@ -522,7 +771,7 @@ const assets = [
{ version: '06:04', note: '账款匹配完成,识别 8 条超期待付款', time: '今日' }
],
titles: {
configTitle: '定时任务配置',
configTitle: '任务配置',
configDesc: '配置统计口径、维度、账款数据源和看板刷新策略。',
detailTitle: '任务流程',
detailDesc: '从账款同步、指标聚合到日报刷新描述调度链路。',
@@ -548,20 +797,39 @@ export default {
emits: ['detail-open-change'],
setup(props, { emit }) {
const tabs = [
{ id: 'skills', label: 'Skills' },
{ id: 'rules', label: '规则' },
{ id: 'skills', label: '技能' },
{ id: 'mcp', label: 'MCP' },
{ id: 'schedules', label: '定时任务' }
{ id: 'schedules', label: '任务' }
]
const activeType = ref('skills')
const activeType = ref('rules')
const selectedSkill = ref(null)
const versionSwitchTarget = ref(null)
const keyword = ref('')
const activeMeta = computed(() => TYPE_META[activeType.value])
const filters = computed(() => activeMeta.value.filters)
const createButtonLabel = computed(() => activeMeta.value.createButtonLabel)
const hintText = computed(() => activeMeta.value.hintText)
const tableColumns = computed(() => activeMeta.value.tableColumns)
const visibleSkills = computed(() => assets.filter((item) => item.type === activeType.value))
const searchPlaceholder = computed(() => {
const label = tabs.find((tab) => tab.id === activeType.value)?.label || '内容'
return `搜索${label}`
})
const visibleSkills = computed(() => {
const normalizedKeyword = keyword.value.trim().toLowerCase()
const scopedAssets = assets.filter((item) => item.type === activeType.value)
if (!normalizedKeyword) {
return scopedAssets
}
return scopedAssets.filter((item) =>
[item.name, item.summary, item.category, item.owner, item.scope]
.filter(Boolean)
.some((value) => String(value).toLowerCase().includes(normalizedKeyword))
)
})
watch(
selectedSkill,
@@ -606,6 +874,8 @@ export default {
activeType,
createButtonLabel,
hintText,
keyword,
searchPlaceholder,
tableColumns,
selectedSkill,
versionSwitchTarget,