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,26 +1,39 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>上传文件</title>
</head>
<body>
<h1>上传文件</h1>
<nav><a href="{% url 'documents:list' %}">返回文件列表</a></nav>
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
<p>
<label for="id_scenario_id">场景</label>
<select name="scenario_id" id="id_scenario_id">
{% for scenario in scenarios %}
<option value="{{ scenario.id }}">{{ scenario.name }}</option>
{% endfor %}
</select>
</p>
<p>{{ form.file.label_tag }} {{ form.file }}</p>
{{ form.errors }}
<p>支持 .txt、.md、.pdf 和 .docx 文件。</p>
<button type="submit">上传</button>
</form>
</body>
</html>
{% 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">支持 `.txt`、`.md`、`.pdf` 和 `.docx`。上传后可以在文档中心手动执行入库。</p>
</header>
<article class="panel" style="max-width: 760px;">
<form method="post" enctype="multipart/form-data" class="stack">
{% csrf_token %}
<div>
<label for="id_scenario_id">关联场景</label>
<select name="scenario_id" id="id_scenario_id">
{% for scenario in scenarios %}
<option value="{{ scenario.id }}">{{ scenario.name }}</option>
{% endfor %}
</select>
</div>
<div>
{{ form.file.label_tag }}
{{ form.file }}
{% if form.file.errors %}
<p class="notice notice-error">{{ form.file.errors|join:" " }}</p>
{% endif %}
</div>
{% if form.errors %}
<div class="notice notice-error">{{ form.errors }}</div>
{% endif %}
<div style="display: flex; gap: 10px; flex-wrap: wrap;">
<button type="submit">上传文件</button>
<a class="button" href="{% url 'documents:list' %}">返回文件列表</a>
</div>
</form>
</article>
{% endblock %}