feat: 重构处理历史与通知留痕追踪

This commit is contained in:
2026-06-04 00:49:33 +08:00
parent d0841e533f
commit 77d9420d43
13 changed files with 431 additions and 96 deletions

View File

@@ -1,43 +1,38 @@
{% extends "base.html" %}
{% block title %}审计日志{% endblock %}
{% block title %}处理历史{% endblock %}
{% block content %}
<section class="page-header">
<span class="eyebrow">Audit Trail</span>
<h1 class="page-title">审计日志与执行留痕中心</h1>
<p class="page-lead">每次 Agent 执行都会保留输入、结构化结果、引用片段、工具调用和最终输出。这个页面用于说明系统为何可追溯、可复核、可解释</p>
{% if selected_scenario_id %}
<div class="badge-row">
<span class="pill pill-accent">当前筛选场景:{{ selected_scenario_id }}</span>
<a class="button" href="{% url 'audit:list' %}">清空筛选</a>
</div>
{% endif %}
<span class="eyebrow">Processing History</span>
<h1 class="page-title">处理历史</h1>
<p class="page-lead">按批次、产品和会话回看审核执行、结构化结论与通知留痕</p>
</section>
<section class="hero-metrics">
<article class="metric-card">
<div class="metric-label">日志总数</div>
<div class="metric-value">{{ logs|length }}</div>
<div class="metric-note">当前页面加载的执行快照数量</div>
</article>
<article class="metric-card">
<div class="metric-label">最近状态</div>
<div class="metric-value">{% if logs %}{{ logs.0.get_status_display_text }}{% else %}暂无{% endif %}</div>
<div class="metric-note">默认按时间倒序展示最近一次 Agent 执行。</div>
</article>
<article class="metric-card">
<div class="metric-label">最近场景</div>
<div class="metric-value">{% if logs %}{{ logs.0.scenario_name }}{% else %}暂无{% endif %}</div>
<div class="metric-note">便于快速定位当前复试演示对应的执行记录。</div>
</article>
<section class="panel">
<div class="section-heading">
<div>
<h2 class="section-title">历史筛选</h2>
<p class="section-copy">支持按产品名称或批次号搜索</p>
</div>
</div>
<form method="get" class="grid-2">
<div>
<label for="id_keyword">产品名称 / 批次号</label>
<input id="id_keyword" type="text" name="keyword" value="{{ keyword }}" placeholder="例如:新型冠状病毒 或 SUB-20260604-001">
</div>
<div class="button-row" style="align-items: end;">
<button type="submit">筛选历史</button>
<a class="button" href="{% url 'audit:list' %}">清空</a>
</div>
</form>
</section>
<section class="panel">
<div class="section-heading">
<div>
<h2 class="section-title">执行快照列表</h2>
<p class="section-copy">保留真实审计数据列表,同时把展示形式升级为与首页、大屏一致的分析板风格</p>
<p class="section-copy">围绕 `batch_id / conversation_id / product_name` 展示处理历史</p>
</div>
</div>
<div class="table-wrap">
@@ -46,11 +41,13 @@
<tr>
<th>ID</th>
<th>场景</th>
<th>产品名称</th>
<th>批次号</th>
<th>会话</th>
<th>输入摘要</th>
<th>状态</th>
<th>模型</th>
<th></th>
<th>创建时间</th>
<th></th>
<th>详情</th>
</tr>
</thead>
@@ -59,17 +56,19 @@
<tr>
<td>{{ log.id }}</td>
<td>{{ log.scenario_name }}</td>
<td>{{ log.product_name|default:"-" }}</td>
<td>{{ log.batch_id|default:"-" }}</td>
<td>{{ log.conversation_id|default:"-" }}</td>
<td>{{ log.get_user_input_summary }}</td>
<td>
<span class="pill {% if log.status == 'success' %}pill-success{% else %}pill-danger{% endif %}">{{ log.get_status_display_text }}</span>
</td>
<td>{{ log.model_name }}</td>
<td>{{ log.latency_ms }} ms</td>
<td>{{ log.created_at|date:"Y-m-d H:i" }}</td>
<td><a class="button" href="{% url 'audit:detail' log.id %}">查看详情</a></td>
</tr>
{% empty %}
<tr><td colspan="8">暂无审计日志,先去执行一次审核工作台任务。</td></tr>
<tr><td colspan="10">暂无处理历史,先去执行一次审核任务。</td></tr>
{% endfor %}
</tbody>
</table>