Compare commits

...

22 Commits

Author SHA1 Message Date
213b11c707 feat: 智能体历史改为显示每次对话记录而非合并统计 2026-04-27 00:26:51 +08:00
0303ccabc0 fix: 智能体使用记录改为发送第一条消息时才记录 2026-04-26 23:52:14 +08:00
e6b3465aa7 fix: 最近使用改为标题右侧显示更多>>链接 2026-04-26 23:48:42 +08:00
b6455e4720 feat: 智能体历史使用列表 - 显示最近使用的智能体(最多5个)+ 使用次数和时间 + 查看全部历史页面 2026-04-26 23:24:58 +08:00
05d1b60671 fix: 智能体和我的页面头部统一为紫色渐变风格 2026-04-26 23:14:39 +08:00
484bdf07fe fix: 恢复对话页面头部样式 - 紫色渐变背景 + 搜索按钮 + 新建对话按钮 2026-04-26 23:06:42 +08:00
05ead34c64 feat: 首页重构 - 底部导航栏(对话/智能体/我的)+ 智能体分类列表 + 智能体对话界面 2026-04-26 22:59:25 +08:00
9098e6b4f7 feat: AI生成时智能滚动 - 用户可自由滚动查看,只在底部时自动滚动 2026-04-26 22:48:57 +08:00
fb09560259 feat: 对话总结标题改为不超过20字 2026-04-26 22:44:44 +08:00
83bdab3205 fix: 标题生成禁用思考模式并增加max_tokens 2026-04-26 22:38:08 +08:00
610ee8f409 fix: 标题生成添加详细日志和改进错误处理 2026-04-26 22:33:25 +08:00
8451f04302 fix: 标题自动总结判断条件修正 - 第一次对话(2条)和每5次对话(10条) 2026-04-26 22:10:40 +08:00
c6bdfb15cc fix: 思考内容正确显示 - 判断thinking字段存在而非值 2026-04-26 21:33:01 +08:00
ac5335ac4f fix: 思考内容先流式展开显示,思考完成后立即折叠再显示正式回复 2026-04-26 21:27:44 +08:00
99000f6f04 fix: 搜索结果改为10个,深度思考和联网搜索可独立选择 2026-04-26 18:17:44 +08:00
dc6838a0c1 feat: 联网搜索功能 - Tavily Search集成 2026-04-26 18:14:24 +08:00
691b7f0e08 feat: AI生成回复时显示停止生成按钮 2026-04-26 17:54:01 +08:00
d550461e0b feat: 搜索按钮移到顶部header,和新建按钮并列 2026-04-26 17:50:04 +08:00
6349cc70ae fix: 修复代码重复导致的语法错误 2026-04-26 17:46:01 +08:00
c8909595e4 feat: 添加对话搜索功能 - 支持搜索标题和内容 2026-04-26 17:43:01 +08:00
2e5fcca49e feat: 长按对话弹出操作菜单 - 重命名/分享/置顶/删除 2026-04-26 17:25:43 +08:00
05e900c5af feat: 添加置顶置底导航按钮 2026-04-26 17:16:38 +08:00
3 changed files with 2257 additions and 92 deletions

1476
www/app.js

File diff suppressed because it is too large Load Diff

View File

@@ -8,12 +8,12 @@
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>AI助手</title>
<link rel="stylesheet" href="style.css?v=2.3.0">
<link rel="stylesheet" href="style.css?v=3.1.3">
<link rel="manifest" href="manifest.json">
</head>
<body>
<div id="app"></div>
<script src="marked.min.js?v=2.3.0"></script>
<script src="app.js?v=2.3.0"></script>
<script src="marked.min.js?v=3.1.3"></script>
<script src="app.js?v=3.1.3"></script>
</body>
</html>

View File

@@ -29,6 +29,490 @@ body {
min-height: 100dvh;
}
/* ==================== 主页布局 ==================== */
.main-page {
display: flex;
flex-direction: column;
height: 100vh;
height: 100dvh;
background: #f5f5f5;
}
.main-content {
flex: 1;
overflow-y: auto;
}
/* 底部导航栏 */
.bottom-nav {
display: flex;
justify-content: space-around;
align-items: center;
padding: 8px 0;
background: white;
border-top: 1px solid var(--border-color);
position: sticky;
bottom: 0;
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
padding: 8px 16px;
color: var(--text-light);
cursor: pointer;
transition: all 0.2s;
}
.nav-item svg {
flex-shrink: 0;
}
.nav-item span {
font-size: 12px;
}
.nav-item:hover {
color: var(--primary);
}
.nav-item.active {
color: var(--primary);
}
/* ==================== 页面通用头部(紫色渐变) ==================== */
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
}
.page-header h1 {
font-size: 18px;
font-weight: 600;
}
/* ==================== 对话页面 ==================== */
.chats-page {
display: flex;
flex-direction: column;
height: 100%;
}
.chats-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
}
.chats-header h1 {
font-size: 18px;
font-weight: 600;
}
.chats-header-actions {
display: flex;
align-items: center;
gap: 8px;
}
.chats-header-btn {
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
background: rgba(255,255,255,0.95);
border: none;
border-radius: 50%;
color: var(--primary);
cursor: pointer;
transition: all 0.25s ease;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.chats-header-btn:hover {
transform: scale(1.08);
box-shadow: 0 4px 16px rgba(102,126,234,0.4);
color: #5a67d8;
}
.chats-header-btn:active {
transform: scale(0.95);
}
.chats-content {
flex: 1;
padding: 16px;
overflow-y: auto;
background: #f5f5f5;
}
/* ==================== 智能体页面 ==================== */
.agents-page {
display: flex;
flex-direction: column;
height: 100%;
}
.agents-content {
flex: 1;
padding: 16px;
overflow-y: auto;
background: #f5f5f5;
}
.agents-section {
margin-bottom: 24px;
}
.section-title {
font-size: 16px;
font-weight: 600;
color: var(--text-color);
margin-bottom: 12px;
}
.section-title-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.section-title-row .section-title {
margin-bottom: 0;
}
.section-more {
font-size: 14px;
color: var(--primary);
cursor: pointer;
transition: color 0.2s;
}
.section-more:hover {
color: #5a67d8;
}
.agents-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.agent-card {
display: flex;
flex-direction: column;
align-items: center;
padding: 16px;
background: white;
border: 1px solid var(--border-color);
border-radius: 12px;
cursor: pointer;
transition: all 0.2s;
}
.agent-card:hover {
border-color: var(--primary);
background: rgba(102, 126, 234, 0.05);
transform: translateY(-2px);
}
.agent-avatar {
font-size: 32px;
margin-bottom: 8px;
}
.agent-name {
font-size: 14px;
font-weight: 600;
color: var(--text-color);
margin-bottom: 4px;
}
.agent-desc {
font-size: 12px;
color: var(--text-light);
text-align: center;
}
/* 最近使用的智能体列表 */
.recent-agents-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.recent-agent-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
background: white;
border: 1px solid var(--border-color);
border-radius: 10px;
cursor: pointer;
transition: all 0.2s;
}
.recent-agent-item:hover {
border-color: var(--primary);
background: rgba(102, 126, 234, 0.05);
}
.recent-agent-left {
display: flex;
align-items: center;
gap: 12px;
}
.recent-agent-avatar {
font-size: 20px;
}
.recent-agent-name {
font-size: 14px;
font-weight: 500;
color: var(--text-color);
}
.recent-agent-right {
display: flex;
align-items: center;
gap: 12px;
font-size: 12px;
color: var(--text-light);
}
.recent-agent-usage {
color: var(--primary);
}
.recent-agent-agent-name {
font-size: 12px;
color: var(--primary);
background: rgba(102, 126, 234, 0.1);
padding: 2px 8px;
border-radius: 4px;
}
/* 智能体历史页面 */
.agent-history-page {
display: flex;
flex-direction: column;
height: 100vh;
height: 100dvh;
}
.back-btn-white {
background: transparent;
border: none;
color: white;
padding: 8px;
cursor: pointer;
}
.agent-history-content {
flex: 1;
padding: 16px;
overflow-y: auto;
background: #f5f5f5;
}
.agent-history-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 14px 16px;
background: white;
border: 1px solid var(--border-color);
border-radius: 10px;
margin-bottom: 8px;
cursor: pointer;
transition: all 0.2s;
}
.agent-history-item:hover {
border-color: var(--primary);
background: rgba(102, 126, 234, 0.05);
}
.agent-history-left {
display: flex;
align-items: center;
gap: 12px;
}
.agent-history-avatar {
font-size: 24px;
}
.agent-history-name {
font-size: 15px;
font-weight: 500;
color: var(--text-color);
}
.agent-history-right {
display: flex;
align-items: center;
gap: 12px;
font-size: 13px;
color: var(--text-light);
}
.agent-history-usage {
color: var(--primary);
}
.agent-history-agent {
font-size: 12px;
color: var(--primary);
background: rgba(102, 126, 234, 0.1);
padding: 2px 8px;
border-radius: 4px;
}
/* ==================== 我的页面 ==================== */
.profile-page {
display: flex;
flex-direction: column;
height: 100%;
}
.profile-content {
flex: 1;
padding: 16px;
background: #f5f5f5;
}
.profile-card {
display: flex;
flex-direction: column;
align-items: center;
padding: 32px;
background: white;
border-radius: 12px;
margin-bottom: 16px;
}
.profile-avatar {
font-size: 48px;
margin-bottom: 12px;
}
.profile-name {
font-size: 18px;
font-weight: 600;
color: var(--text-color);
}
.profile-section {
background: white;
border-radius: 12px;
overflow: hidden;
}
.profile-item {
display: flex;
align-items: center;
gap: 12px;
padding: 16px;
border-bottom: 1px solid var(--border-color);
cursor: pointer;
transition: all 0.2s;
}
.profile-item:last-child {
border-bottom: none;
}
.profile-item:hover {
background: rgba(102, 126, 234, 0.05);
}
.profile-item svg {
color: var(--primary);
}
.profile-item span {
font-size: 16px;
color: var(--text-color);
}
.profile-footer {
margin-top: 32px;
text-align: center;
color: var(--text-light);
font-size: 14px;
}
.profile-footer p {
margin: 4px 0;
}
/* ==================== 智能体对话界面 ==================== */
.chat-page {
display: flex;
flex-direction: column;
height: 100vh;
height: 100dvh;
}
.chat-header {
display: flex;
align-items: center;
padding: 12px 16px;
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
}
.back-btn {
background: transparent;
border: none;
color: white;
padding: 8px;
cursor: pointer;
}
.header-info {
display: flex;
align-items: center;
gap: 12px;
flex: 1;
}
.agent-avatar-header {
font-size: 28px;
}
.header-text h1 {
font-size: 16px;
font-weight: 600;
margin: 0;
}
.agent-desc-header {
font-size: 12px;
opacity: 0.8;
margin: 0;
}
/* ==================== 对话列表页面 ==================== */
.conversation-list-page {
@@ -66,14 +550,13 @@ body {
font-weight: 600;
}
.list-content {
flex: 1;
padding: 16px;
overflow-y: auto;
.header-actions {
display: flex;
align-items: center;
gap: 8px;
}
/* Header 中的新建对话按钮 - 美化版 */
.new-chat-btn-header {
.header-btn {
display: flex;
align-items: center;
justify-content: center;
@@ -90,7 +573,7 @@ body {
overflow: hidden;
}
.new-chat-btn-header::before {
.header-btn::before {
content: '';
position: absolute;
inset: 0;
@@ -99,25 +582,31 @@ body {
transition: opacity 0.25s;
}
.new-chat-btn-header:hover {
.header-btn:hover {
transform: scale(1.08);
box-shadow: 0 4px 16px rgba(102,126,234,0.4), 0 2px 8px rgba(0,0,0,0.2);
color: #5a67d8;
}
.new-chat-btn-header:hover::before {
.header-btn:hover::before {
opacity: 1;
}
.new-chat-btn-header:active {
.header-btn:active {
transform: scale(0.95);
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.new-chat-btn-header svg {
.header-btn svg {
filter: drop-shadow(0 1px 2px rgba(102,126,234,0.3));
}
.list-content {
flex: 1;
padding: 16px;
overflow-y: auto;
}
/* 原样式保留(备用) */
.new-chat-btn {
display: flex;
@@ -152,7 +641,7 @@ body {
.conversation-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 16px;
background: white;
border: 1px solid var(--border-color);
@@ -160,6 +649,12 @@ body {
cursor: pointer;
transition: all 0.2s;
position: relative;
gap: 8px;
}
.conversation-item.pinned {
border-color: var(--primary);
background: rgba(102, 126, 234, 0.08);
}
.conversation-item:hover {
@@ -171,43 +666,227 @@ body {
background: rgba(102, 126, 234, 0.1);
}
.pin-icon {
font-size: 14px;
}
.conv-title {
font-size: 16px;
font-weight: 500;
color: var(--text-color);
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
}
.conv-meta {
font-size: 12px;
color: var(--text-light);
white-space: nowrap;
}
.conv-delete-btn {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
/* 操作菜单 */
.action-menu {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: transparent;
border: none;
color: var(--text-light);
padding: 6px;
display: none;
z-index: 1000;
}
.action-menu.show {
display: block;
}
.action-menu-content {
background: white;
border-radius: 16px 16px 0 0;
padding: 16px;
box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
animation: slideUp 0.2s ease;
}
@keyframes slideUp {
from { transform: translateY(100%); }
to { transform: translateY(0); }
}
.action-menu-item {
display: flex;
align-items: center;
gap: 12px;
padding: 14px 16px;
border-radius: 10px;
cursor: pointer;
opacity: 0;
transition: all 0.2s;
}
.conversation-item:hover .conv-delete-btn {
opacity: 1;
.action-menu-item:hover {
background: rgba(102, 126, 234, 0.1);
}
.conv-delete-btn:hover {
.action-menu-item:active {
background: rgba(102, 126, 234, 0.2);
}
.action-menu-item svg {
color: var(--primary);
}
.action-menu-item span {
font-size: 16px;
color: var(--text-color);
}
.action-menu-item.delete-action svg,
.action-menu-item.delete-action span {
color: #e53e3e;
}
.action-menu-item.delete-action:hover {
background: rgba(229, 62, 62, 0.1);
}
/* 搜索栏 */
.search-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
display: none;
z-index: 1100;
}
.search-bar.show {
display: flex;
flex-direction: column;
}
.search-input-wrapper {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: white;
border-bottom: 1px solid var(--border-color);
}
.search-input-wrapper svg {
color: var(--text-light);
}
.search-input-wrapper input {
flex: 1;
font-size: 16px;
border: none;
outline: none;
background: transparent;
}
.search-close-btn {
padding: 8px;
background: transparent;
border: none;
color: var(--text-light);
cursor: pointer;
}
.search-close-btn:hover {
color: var(--text-color);
}
.search-results {
flex: 1;
background: white;
overflow-y: auto;
padding: 8px 16px;
}
.search-empty {
padding: 40px 20px;
text-align: center;
color: var(--text-light);
}
.search-result-item {
display: flex;
flex-direction: column;
gap: 4px;
padding: 12px 16px;
background: white;
border: 1px solid var(--border-color);
border-radius: 12px;
margin-bottom: 8px;
cursor: pointer;
transition: all 0.2s;
}
.search-result-item:hover {
border-color: var(--primary);
background: rgba(102, 126, 234, 0.05);
}
.search-result-item.pinned {
border-color: var(--primary);
background: rgba(102, 126, 234, 0.08);
}
.search-result-title {
font-size: 16px;
font-weight: 500;
color: var(--text-color);
}
.search-result-snippet {
font-size: 14px;
color: var(--text-light);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.search-result-meta {
font-size: 12px;
color: var(--text-light);
}
/* 底部工具栏 */
.list-footer {
display: flex;
justify-content: center;
padding: 12px 16px;
background: white;
border-top: 1px solid var(--border-color);
}
.footer-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 10px 20px;
background: white;
border: 1px solid var(--border-color);
border-radius: 20px;
font-size: 14px;
color: var(--text-light);
cursor: pointer;
transition: all 0.2s;
}
.footer-btn:hover {
border-color: var(--primary);
color: var(--primary);
}
.footer-btn:active {
background: rgba(102, 126, 234, 0.1);
}
/* ==================== 对话页面 ==================== */
#chatPage {
@@ -585,12 +1264,24 @@ body {
/* 功能开关栏 */
.feature-bar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
padding: 8px 16px;
background: rgba(255,255,255,0.95);
border-top: 1px solid var(--border-color);
}
.feature-left {
display: flex;
gap: 8px;
}
.feature-right {
display: flex;
gap: 4px;
}
.feature-btn {
display: flex;
align-items: center;
@@ -620,6 +1311,18 @@ body {
flex-shrink: 0;
}
/* 导航按钮样式 */
.nav-btn {
padding: 6px 8px;
min-width: 32px;
}
.nav-btn:hover {
background: var(--primary);
border-color: var(--primary);
color: white;
}
/* 思考内容块 */
.thinking-block {
margin-bottom: 12px;
@@ -678,6 +1381,88 @@ body {
margin: 8px 0;
}
/* 搜索结果块 */
.search-results-block {
margin-bottom: 12px;
background: rgba(102, 126, 234, 0.05);
border: 1px solid rgba(102, 126, 234, 0.15);
border-radius: 10px;
overflow: hidden;
cursor: pointer;
transition: all 0.2s;
}
.search-results-block:hover {
border-color: rgba(102, 126, 234, 0.3);
}
.search-results-header {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
background: rgba(102, 126, 234, 0.1);
font-size: 13px;
color: var(--primary);
font-weight: 500;
}
.search-results-header svg:first-child {
color: var(--primary);
}
.search-results-arrow {
margin-left: auto;
transition: transform 0.2s;
}
.search-results-block.expanded .search-results-arrow {
transform: rotate(180deg);
}
.search-results-content {
padding: 0 12px;
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease, padding 0.3s ease;
}
.search-results-block.expanded .search-results-content {
padding: 8px 12px;
max-height: 300px;
}
.search-result-link {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 0;
}
.search-result-num {
display: flex;
align-items: center;
justify-content: center;
min-width: 20px;
height: 20px;
background: var(--primary);
color: white;
border-radius: 50%;
font-size: 12px;
font-weight: 500;
}
.search-result-link a {
color: var(--text-color);
font-size: 14px;
text-decoration: none;
transition: color 0.2s;
}
.search-result-link a:hover {
color: var(--primary);
}
/* 输入区域 */
.input-area {
display: flex;
@@ -836,4 +1621,36 @@ body {
.input-area {
padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
}
/* 停止生成按钮 */
.stop-generate-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 24px;
margin: 16px auto;
background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
color: white;
border: none;
border-radius: 24px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}
.stop-generate-btn:hover {
transform: scale(1.05);
box-shadow: 0 4px 16px rgba(229, 62, 62, 0.4);
}
.stop-generate-btn:active {
transform: scale(0.98);
}
.stop-generate-btn svg {
flex-shrink: 0;
}