feat(documents): 支持文档上传与本地RAG入库

This commit is contained in:
2026-05-30 00:10:05 +08:00
parent 7a6c110103
commit 4a831ee2c5
13 changed files with 403 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<!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 %}
<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>
</tr>
{% empty %}
<tr><td colspan="6">暂无文件。</td></tr>
{% endfor %}
</tbody>
</table>
</body>
</html>