feat(demo): 初始化审核智能体演示基线

This commit is contained in:
2026-06-04 23:42:37 +08:00
commit 84e045f5ab
23 changed files with 1571 additions and 0 deletions

14
templates/base.html Normal file
View File

@@ -0,0 +1,14 @@
{% load static %}
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}DEMO-AGENT V2{% endblock %}</title>
<link rel="stylesheet" href="{% static 'css/login.css' %}">
</head>
<body class="{% block body_class %}{% endblock %}">
{% block content %}{% endblock %}
{% block scripts %}{% endblock %}
</body>
</html>

151
templates/home.html Normal file
View File

@@ -0,0 +1,151 @@
{% extends "base.html" %}
{% load static %}
{% block title %}审核智能体 - DEMO-AGENT V2{% endblock %}
{% block body_class %}app-body{% endblock %}
{% block content %}
<main class="workspace" data-sidebar-state="open">
<aside class="sidebar" id="sidebar">
<div class="sidebar-top">
<button class="icon-button sidebar-toggle" type="button" id="sidebarToggle" aria-label="折叠侧边栏">
<span></span>
<span></span>
</button>
<div class="brand">
<span class="brand-mark"></span>
<div class="brand-copy">
<strong class="brand-text">审核智能体</strong>
<span class="brand-subtitle">临床注册文件审核工作台</span>
</div>
</div>
<form method="post">
{% csrf_token %}
<input type="hidden" name="action" value="new_conversation">
<button class="new-chat" type="submit">+ 新对话</button>
</form>
<form class="search-form" method="get">
<label class="sr-only" for="conversationSearch">搜索会话</label>
<input id="conversationSearch" type="text" name="q" value="{{ search_query }}" placeholder="搜索会话...">
</form>
</div>
<div class="sidebar-group">
<p class="sidebar-label">对话记录</p>
<nav class="history-list" aria-label="对话历史">
{% for conversation in conversations %}
<a
class="history-item{% if current_conversation and current_conversation.pk == conversation.pk %} active{% endif %}"
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>
{% empty %}
<div class="history-empty">
<p>暂无会话记录</p>
<span>点击上方“新对话”开始审核。</span>
</div>
{% endfor %}
</nav>
</div>
</aside>
<section class="chat-shell">
<header class="topbar">
<div class="topbar-left">
<button class="icon-button mobile-toggle" type="button" id="mobileSidebarToggle" aria-label="展开侧边栏">
<span></span>
<span></span>
</button>
<div class="tabbar" role="tablist" aria-label="页面切换">
<button class="tab" type="button" role="tab" aria-selected="false">首页</button>
<button class="tab" type="button" role="tab" aria-selected="false">知识库管理</button>
<button class="tab active" type="button" role="tab" aria-selected="true">审核智能体</button>
<button class="tab" type="button" role="tab" aria-selected="false">视频实时监测</button>
</div>
</div>
<div class="topbar-right">
<div class="user-menu" id="userMenu">
<button class="user-menu-trigger" id="userMenuTrigger" type="button" aria-haspopup="menu" aria-expanded="false">
<span class="avatar large">{{ request.user.username|slice:":1"|upper }}</span>
<div class="user-copy">
<strong>{{ request.user.username }}</strong>
<span>当前登录用户</span>
</div>
<span class="caret"></span>
</button>
<div class="user-dropdown" id="userDropdown" role="menu">
<div class="user-dropdown-section" role="none">
<p class="user-dropdown-label">用户信息</p>
<strong class="user-dropdown-name">{{ request.user.username }}</strong>
</div>
<a class="user-dropdown-link" href="{% url 'password_change' %}" role="menuitem">修改密码</a>
<form action="{% url 'logout' %}" method="post" class="user-dropdown-form" role="none">
{% csrf_token %}
<button class="user-dropdown-link danger-link" type="submit" role="menuitem">退出登录</button>
</form>
</div>
</div>
</div>
</header>
<section class="chat-stage">
<div class="chat-scroll">
{% if current_conversation %}
<div class="conversation-header">
<div>
<p class="eyebrow">审核智能体</p>
<h1>{{ current_conversation.title|default:"新对话" }}</h1>
</div>
<span class="conversation-meta">最后更新 {{ current_conversation.updated_at|date:"Y-m-d H:i" }}</span>
</div>
{% for message in messages %}
<article class="message {{ message.role }}">
<div class="message-avatar{% if message.role == 'user' %} user-mark{% endif %}">
{% if message.role == "assistant" %}AI{% else %}{{ request.user.username|slice:":1"|upper }}{% endif %}
</div>
<div class="message-bubble">
<p>{{ message.content|linebreaksbr }}</p>
</div>
</article>
{% endfor %}
{% else %}
<div class="empty-state">
<p class="eyebrow">审核智能体</p>
<h1>开始新的审核对话</h1>
<p class="muted">输入资料疑点、法规条款、说明书问题或风险项,系统会为你保留真实会话记录。</p>
</div>
{% endif %}
</div>
<div class="composer-wrap">
<form class="composer" action="/" method="post">
{% csrf_token %}
<input type="hidden" name="action" value="send_message">
{% if current_conversation %}
<input type="hidden" name="conversation_id" value="{{ current_conversation.pk }}">
{% endif %}
<label class="sr-only" for="prompt">输入消息</label>
<textarea id="prompt" name="prompt" rows="1" placeholder="输入审核问题、法规条款、说明书疑点或上传需求"></textarea>
<div class="composer-actions">
<div class="composer-tools">
<span class="tool-chip passive-chip">法规核查</span>
<span class="tool-chip passive-chip">说明书审核</span>
<span class="tool-chip passive-chip">风险识别</span>
</div>
<button class="send-button" type="submit">发送</button>
</div>
</form>
</div>
</section>
</section>
</main>
{% endblock %}
{% block scripts %}
<script src="{% static 'js/app.js' %}"></script>
{% endblock %}

View File

@@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block title %}登录 - DEMO-AGENT V2{% endblock %}
{% block content %}
<main class="login-page">
<section class="login-card" aria-labelledby="login-title">
<p class="eyebrow">DEMO-AGENT V2</p>
<h1 id="login-title">登录系统</h1>
<p class="muted">请输入账号和密码进入 Django 基础后台。</p>
{% if form.errors %}
<div class="alert" role="alert">用户名或密码不正确,请重新输入。</div>
{% endif %}
<form method="post" novalidate>
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<label for="{{ form.username.id_for_label }}">用户名</label>
{{ form.username }}
<label for="{{ form.password.id_for_label }}">密码</label>
{{ form.password }}
<button class="button" type="submit">登录</button>
</form>
</section>
</main>
{% endblock %}

View File

@@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block title %}修改密码 - DEMO-AGENT V2{% endblock %}
{% block content %}
<main class="login-page">
<section class="login-card">
<p class="eyebrow">审核智能体</p>
<h1>修改密码</h1>
<p class="muted">输入当前密码,并设置新的登录密码。</p>
<form method="post">
{% csrf_token %}
{% if form.non_field_errors %}
<div class="alert" role="alert">{{ form.non_field_errors }}</div>
{% endif %}
{% for field in form %}
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field }}
{% if field.errors %}
<div class="alert" role="alert">{{ field.errors }}</div>
{% endif %}
{% endfor %}
<button class="button" type="submit">保存密码</button>
</form>
</section>
</main>
{% endblock %}