feat(ai_chat): 添加Markdown渲染和图片生成功能
支持将AI回复的Markdown内容转换为HTML并渲染为美观的图片格式返回,提升聊天体验 ``` ```msg feat(knowledge_base): 扩展知识库支持个人和群聊独立记忆 - 新增个人知识库功能,支持独立记忆 - 添加清除个人/群聊记忆命令 - 优化知识搜索逻辑,优先搜索个人记忆 - 更新插件帮助信息
This commit is contained in:
220
templates/ai_chat.html
Normal file
220
templates/ai_chat.html
Normal file
@@ -0,0 +1,220 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AI 聊天回复</title>
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Noto+Sans+SC:wght@400;500;700&display=swap');
|
||||
|
||||
:root {
|
||||
--bg-color: #0f172a;
|
||||
--window-bg: rgba(30, 41, 59, 0.85);
|
||||
--border-color: rgba(255, 255, 255, 0.08);
|
||||
--accent: #6366f1;
|
||||
--text-title: #f8fafc;
|
||||
--text-desc: #94a3b8;
|
||||
--text-content: #e2e8f0;
|
||||
--user-bg: rgba(99, 102, 241, 0.15);
|
||||
--ai-bg: rgba(16, 185, 129, 0.1);
|
||||
--user-border: rgba(99, 102, 241, 0.3);
|
||||
--ai-border: rgba(16, 185, 129, 0.3);
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Noto Sans SC', system-ui, sans-serif;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-title);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
min-height: 100vh;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.window {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
background: var(--window-bg);
|
||||
backdrop-filter: blur(20px);
|
||||
border-radius: 16px;
|
||||
border: 1px solid var(--border-color);
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 20px 30px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dots { display: flex; gap: 8px; }
|
||||
.dot { width: 12px; height: 12px; border-radius: 50%; }
|
||||
.red { background: #ef4444; }
|
||||
.yellow { background: #f59e0b; }
|
||||
.green { background: #10b981; }
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
color: var(--text-desc);
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.message-card {
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
background: var(--user-bg);
|
||||
border-color: var(--user-border);
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
.ai-card {
|
||||
background: var(--ai-bg);
|
||||
border-color: var(--ai-border);
|
||||
margin-left: 40px;
|
||||
}
|
||||
|
||||
.message-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
background: #6366f1;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.ai-avatar {
|
||||
background: #10b981;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--text-title);
|
||||
}
|
||||
|
||||
.message-body {
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
color: var(--text-content);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* Markdown 样式支持 */
|
||||
.message-body code {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9em;
|
||||
color: #a5f3fc;
|
||||
}
|
||||
|
||||
.message-body pre {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 16px;
|
||||
border-radius: 8px;
|
||||
overflow-x: auto;
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.message-body pre code {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
color: #e2e8f0;
|
||||
}
|
||||
|
||||
.message-body p {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.message-body p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 数学公式支持 */
|
||||
.math {
|
||||
font-family: 'Times New Roman', Times, serif;
|
||||
font-style: italic;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="window">
|
||||
<div class="header">
|
||||
<div class="dots">
|
||||
<div class="dot red"></div>
|
||||
<div class="dot yellow"></div>
|
||||
<div class="dot green"></div>
|
||||
</div>
|
||||
<div class="title">AI CHAT</div>
|
||||
<div style="width: 44px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<!-- 用户消息 -->
|
||||
<div class="message-card user-card">
|
||||
<div class="message-header">
|
||||
<div class="avatar user-avatar">{{ user_name[0] if user_name else 'U' }}</div>
|
||||
<div class="name">{{ user_name }}</div>
|
||||
</div>
|
||||
<div class="message-body">{{ user_message }}</div>
|
||||
</div>
|
||||
|
||||
<!-- AI 回复 -->
|
||||
<div class="message-card ai-card">
|
||||
<div class="message-header">
|
||||
<div class="avatar ai-avatar">AI</div>
|
||||
<div class="name">NeoBot AI</div>
|
||||
</div>
|
||||
<div class="message-body">{{ ai_reply }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user