Compare commits

...

17 Commits

Author SHA1 Message Date
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
7977057be5 feat: 自动总结对话标题 - 第一次和每隔5次对话自动更新 2026-04-26 16:59:42 +08:00
44cca59ec6 fix: 修正思考模式 - 使用thinking参数而非切换模型 2026-04-26 11:47:12 +08:00
0dfa76dad6 fix: 修正深度思考逻辑 - 只有开启时才处理思考内容 2026-04-26 11:38:42 +08:00
5a6c0c41b3 fix: 修正思考模型名称为glm-z1-flash 2026-04-26 11:29:40 +08:00
2285755b34 feat: 添加深度思考和联网搜索按钮,支持思考内容流式输出和折叠显示 2026-04-26 11:27:25 +08:00
b97abb0fc6 fix: HTTP环境下复制功能修复 2026-04-26 11:18:27 +08:00
b8e670978c fix: 修复上传按钮点击事件冒泡导致面板关闭问题 2026-04-26 11:16:45 +08:00
65360ad822 feat: 添加上传按钮支持图片和文件上传 2026-04-26 10:56:40 +08:00
41f06148b4 feat: 新建对话按钮样式美化 2026-04-26 10:49:50 +08:00
cafe530a72 feat: 禁用浏览器缓存确保每次使用最新版本 2026-04-26 10:47:16 +08:00
3 changed files with 1664 additions and 83 deletions

1098
www/app.js

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,16 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#667eea">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>AI助手</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="style.css?v=2.7.0">
<link rel="manifest" href="manifest.json">
</head>
<body>
<div id="app"></div>
<script src="marked.min.js"></script>
<script src="app.js"></script>
<script src="marked.min.js?v=2.7.0"></script>
<script src="app.js?v=2.7.0"></script>
</body>
</html>

View File

@@ -66,35 +66,63 @@ body {
font-weight: 600;
}
.header-actions {
display: flex;
align-items: center;
gap: 8px;
}
.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), inset 0 1px 0 rgba(255,255,255,0.5);
position: relative;
overflow: hidden;
}
.header-btn::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.7) 100%);
opacity: 0;
transition: opacity 0.25s;
}
.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;
}
.header-btn:hover::before {
opacity: 1;
}
.header-btn:active {
transform: scale(0.95);
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.header-btn svg {
filter: drop-shadow(0 1px 2px rgba(102,126,234,0.3));
}
.list-content {
flex: 1;
padding: 16px;
overflow-y: auto;
}
/* Header 中的新建对话按钮 */
.new-chat-btn-header {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background: rgba(255,255,255,0.2);
border: none;
border-radius: 10px;
color: white;
cursor: pointer;
transition: all 0.2s;
}
.new-chat-btn-header:hover {
background: rgba(255,255,255,0.3);
}
.new-chat-btn-header:active {
transform: scale(0.95);
}
/* 原样式保留(备用) */
.new-chat-btn {
display: flex;
@@ -129,7 +157,7 @@ body {
.conversation-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 16px;
background: white;
border: 1px solid var(--border-color);
@@ -137,6 +165,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 {
@@ -148,43 +182,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 {
@@ -477,6 +695,41 @@ body {
.message-content h2 { font-size: 1.2em; }
.message-content h3 { font-size: 1.1em; }
/* 图片消息样式 */
.message-image {
margin-bottom: 8px;
}
.message-image img {
max-width: 100%;
max-height: 300px;
border-radius: 12px;
cursor: pointer;
transition: transform 0.2s;
}
.message-image img:hover {
transform: scale(1.02);
}
/* 图片预览遮罩 */
.image-preview-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.9);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.image-preview-overlay img {
max-width: 90%;
max-height: 90%;
border-radius: 8px;
}
.message-content ul, .message-content ol {
margin: 8px 0;
padding-left: 20px;
@@ -524,6 +777,208 @@ body {
font-weight: 600;
}
/* 功能开关栏 */
.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;
gap: 4px;
padding: 6px 12px;
background: white;
border: 1px solid var(--border-color);
border-radius: 20px;
font-size: 13px;
color: var(--text-light);
cursor: pointer;
transition: all 0.2s;
}
.feature-btn:hover {
border-color: var(--primary);
color: var(--primary);
}
.feature-btn.active {
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
border-color: transparent;
color: white;
}
.feature-btn svg {
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;
background: rgba(102, 126, 234, 0.08);
border: 1px solid rgba(102, 126, 234, 0.2);
border-radius: 10px;
overflow: hidden;
cursor: pointer;
transition: all 0.2s;
}
.thinking-block:hover {
border-color: rgba(102, 126, 234, 0.4);
}
.thinking-header {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
background: rgba(102, 126, 234, 0.12);
font-size: 13px;
color: var(--primary);
font-weight: 500;
}
.thinking-header svg:first-child {
color: var(--primary);
}
.thinking-arrow {
margin-left: auto;
transition: transform 0.2s;
}
.thinking-block.expanded .thinking-arrow {
transform: rotate(180deg);
}
.thinking-content {
padding: 0 12px;
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease, padding 0.3s ease;
color: var(--text-light);
font-size: 14px;
line-height: 1.6;
}
.thinking-block.expanded .thinking-content {
padding: 12px;
max-height: 500px;
}
.thinking-content p {
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;
@@ -535,6 +990,85 @@ body {
bottom: 0;
}
/* 上传按钮 */
.attach-btn {
width: 44px;
height: 44px;
border-radius: 50%;
background: white;
border: 2px solid var(--border-color);
color: var(--text-light);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
flex-shrink: 0;
}
.attach-btn:hover {
border-color: var(--primary);
color: var(--primary);
background: rgba(102, 126, 234, 0.05);
}
.attach-btn:active {
transform: scale(0.95);
}
/* 上传选项面板 */
.attach-panel {
position: fixed;
bottom: 70px;
left: 16px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
padding: 16px;
display: none;
z-index: 200;
}
.attach-panel.show {
display: block;
animation: slideUp 0.2s ease;
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.attach-panel-content {
display: flex;
gap: 16px;
}
.attach-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
padding: 12px 16px;
background: rgba(102, 126, 234, 0.05);
border-radius: 12px;
cursor: pointer;
transition: all 0.2s;
}
.attach-item:hover {
background: rgba(102, 126, 234, 0.15);
}
.attach-icon {
font-size: 28px;
}
.attach-label {
font-size: 12px;
color: var(--text-color);
}
#userInput {
flex: 1;
padding: 12px 16px;
@@ -603,4 +1137,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;
}