feat(frontend): 优化对话与管理页面展示体验

This commit is contained in:
2026-05-30 00:26:18 +08:00
parent df45a89eb1
commit 905067277a
10 changed files with 776 additions and 218 deletions

View File

@@ -1,50 +1,53 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>文件列表</title>
</head>
<body>
<h1>件列表</h1>
<nav>
<a href="/">返回首页</a>
<a href="{% url 'documents:upload' %}">上传文件</a>
</nav>
<table>
<thead>
<tr>
<th>文件名</th>
<th>场景</th>
<th>类型</th>
<th>大小</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for document in documents %}
{% extends "base.html" %}
{% block title %}文档中心{% endblock %}
{% block content %}
<header class="page-header">
<span class="eyebrow">知识库资料</span>
<h1 class="page-title">档中心</h1>
<p class="page-lead">上传题目材料后,可以在这里管理文件状态,并手动触发入库。</p>
<p style="margin-top: 14px;"><a class="button button-primary" href="{% url 'documents:upload' %}">上传新文件</a></p>
</header>
<article class="panel">
<table class="kv-table">
<thead>
<tr>
<td>{{ document.original_name }}</td>
<td>{{ document.scenario_id }}</td>
<td>{{ document.file_type }}</td>
<td>{{ document.size }}</td>
<td>{{ document.status }}</td>
<td>
{% if document.status != "indexed" %}
<form action="{% url 'documents:index' document.id %}" method="post">
{% csrf_token %}
<button type="submit">入库</button>
</form>
{% endif %}
{% if document.error_message %}
<pre>{{ document.error_message }}</pre>
{% endif %}
</td>
<th>文件名</th>
<th>场景</th>
<th>类型</th>
<th>大小</th>
<th>状态</th>
<th>操作</th>
</tr>
{% empty %}
<tr><td colspan="6">暂无文件。</td></tr>
{% endfor %}
</tbody>
</table>
</body>
</html>
</thead>
<tbody>
{% for document in documents %}
<tr>
<td>{{ document.original_name }}</td>
<td>{{ document.scenario_id }}</td>
<td>{{ document.file_type }}</td>
<td>{{ document.size }}</td>
<td>{{ document.status }}</td>
<td>
{% if document.status != "indexed" %}
<form action="{% url 'documents:index' document.id %}" method="post">
{% csrf_token %}
<button type="submit">执行入库</button>
</form>
{% else %}
<span class="status status-success">已可用于检索</span>
{% endif %}
{% if document.error_message %}
<pre class="code-block" style="margin-top: 10px;">{{ document.error_message }}</pre>
{% endif %}
</td>
</tr>
{% empty %}
<tr><td colspan="6">暂无文件,请先上传题目材料。</td></tr>
{% endfor %}
</tbody>
</table>
</article>
{% endblock %}