div+css布局实现简洁的ai大模型聊天助手代码
代码语言:html
所属分类:布局界面
代码描述:div+css布局实现简洁的ai大模型聊天助手代码
代码标签: div css 布局 简洁 ai 大模型 聊天 助手 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!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>
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.4.0.css">
<style>
:root {
--primary-color: #641acf;
--user-bubble: #419fff;
--ai-bubble: #f0f4f8;
--text-dark: #333;
--text-light: #fff;
--shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: #f9f9f9;
color: var(--text-dark);
height: 100vh;
display: flex;
}
/* 侧边历史记录面板 */
.history-panel {
width: 280px;
background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
border-right: 1px solid #e0e0e0;
height: 100vh;
overflow-y: auto;
transition: all 0.3s ease;
}
.history-panel.collapsed {
transform: translateX(-100%);
width: 0;
opacity: 0;
}
.history-header {
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #e0e0e0;
}
.history-header h3 {
font-size: 18px;
color: var(--primary-color);
}
.toggle-history {
background: none;
border: none;
color: var(--primary-color);
cursor: pointer;
font-size: 14px;
}
.history-list {
padding: 10px;
}
.history-item {
padding: 12px;
margin-bottom: 8px;
background: white;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s;
box-shadow: var(--shadow);
}
.history-item:hover {
background: #f0f0f0;
}
.history-item.active {
background: var(--primary-color);
color: white;
}
.history-question {
font-size: 14px;
margin-bottom: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.history-time {
font-size: 12px;
color: #888;
}
.history-item.active .history-time {
color: rgba(255, 255, 255, 0.8);
}
.empty-history {
text-align: center;
padding: 40px 20px;
color: #888;
}
/* 主内容区域 */
.main-content {
flex: 1;
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
}
.header {
padding: 20px;
text-align: center;
background: white;
box-shadow: var(--shadow);
z-index: 10;
}
.header h1 {
font-size: 24px;
color: var(--primary-color);
margin-bottom: 8px;
}
.header .subtitle {
font-size: 14px;
color: #888;
}
.chat-container {
flex: 1;
padding: 20px;
overflow-y: auto;
background-color: #f5f5f5;
}
.message {
display: flex;
margin-bottom: 16px;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.message-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
margin-right: 12px;
flex-shrink: 0;
background-color: #ddd;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
}
.user-avatar {
background-color: var(--user-bubble);
}
.ai-a.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0