feat(conversations): 支持删除对话并优化侧栏

This commit is contained in:
2026-06-08 21:39:38 +08:00
parent 2244b69d62
commit ef0a9ee13e
7 changed files with 918 additions and 17 deletions

View File

@@ -10,8 +10,8 @@
<div class="topbar-left">
<div class="tabbar" role="tablist" aria-label="页面切换">
<a class="tab" href="/" role="tab" aria-selected="false">首页</a>
<button class="tab" type="button" role="tab" aria-selected="false">知识库管理</button>
<a class="tab active" href="/" role="tab" aria-selected="true">审核智能体</a>
<a class="tab" href="{% url 'knowledge_base_manager' %}" role="tab" aria-selected="false">知识库管理</a>
<a class="tab" href="{% url 'attachment_manager' %}" role="tab" aria-selected="false">附件管理</a>
</div>
</div>
@@ -72,14 +72,26 @@
<p class="sidebar-label">对话记录</p>
<nav class="history-list" aria-label="对话历史">
{% for conversation in conversations %}
<a
<div
class="history-item{% if current_conversation and current_conversation.pk == conversation.pk %} active{% endif %}"
data-conversation-id="{{ conversation.pk }}"
href="/?conversation={{ conversation.pk }}{% if search_query %}&q={{ search_query|urlencode }}{% endif %}"
data-delete-url="{% url 'review_agent_conversation_detail' conversation.pk %}"
>
<span class="history-title">{{ conversation.title|default:"新对话" }}</span>
<span class="history-meta">{{ conversation.updated_at|date:"m月d日 H:i" }}</span>
</a>
<a
class="history-link"
href="/?conversation={{ conversation.pk }}{% if search_query %}&q={{ search_query|urlencode }}{% endif %}"
>
<span class="history-title">{{ conversation.title|default:"新对话" }}</span>
<span class="history-meta">{{ conversation.updated_at|date:"m月d日 H:i" }}</span>
</a>
<button
class="history-delete"
type="button"
data-conversation-delete
aria-label="删除对话 {{ conversation.title|default:'新对话' }}"
title="删除对话"
>×</button>
</div>
{% empty %}
<div class="history-empty">
<p>暂无会话记录</p>
@@ -350,5 +362,5 @@
{% block scripts %}
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.2.6/dist/purify.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked@15.0.12/marked.min.js"></script>
<script src="{% static 'js/app.js' %}"></script>
<script src="{% static 'js/app.js' %}?v=20260608-chat-delete1"></script>
{% endblock %}