.chat-container { display: flex; flex-direction: column; height: calc(100vh - 60px); /* 减去header高度 */ background: #fcfcfd; /* 更浅的背景色,接近白色 */ } .chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; background: #fcfcfd; /* 与容器背景保持一致 */ } .message { display: flex; align-items: flex-start; max-width: 85%; margin-bottom: 4px; } .message.user { margin-left: auto; } .message-content { position: relative; padding: 12px 16px; border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); transition: all 0.3s ease; } .message.assistant .message-content { background: #f0f4f8; /* AI消息背景色 */ border-top-left-radius: 4px; } .message.user .message-content { background: #e8f4ff; /* 用户消息背景色 */ border-top-right-radius: 4px; } .message p { margin: 0; line-height: 1.5; color: #333; } .chat-input-container { padding: 16px; background: #fff; border-top: 1px solid #f0f0f0; } .input-wrapper { position: relative; display: flex; gap: 8px; background: #f0f4f8; /* 与AI消息框背景色保持一致 */ border-radius: 8px; padding: 8px 12px; transition: all 0.2s ease; } .input-wrapper:focus-within { box-shadow: 0 0 0 1px #1a73e8; } #chat-input { flex: 1; border: none; background: transparent; resize: none; padding: 8px; font-size: 14px; line-height: 1.5; max-height: 120px; outline: none; color: #333; } .input-buttons { display: flex; align-items: center; gap: 8px; } .icon-button { position: relative; overflow: hidden; background: none; border: none; padding: 6px; cursor: pointer; color: #666; border-radius: 4px; transition: all 0.2s; } .icon-button::after { content: ""; position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; background: currentColor; border-radius: 50%; transform: translate(-50%, -50%) scale(0); opacity: 0; transition: all 0.2s ease; } .icon-button:hover::after { transform: translate(-50%, -50%) scale(1.5); opacity: 0.1; } /* 快捷指令面板 */ .prompt-panel { position: absolute; bottom: 80px; left: 16px; right: 16px; background: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); display: none; } .prompt-panel.show { display: block; animation: slideUp 0.2s ease-out; } .prompt-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #eee; } .prompt-header h3 { margin: 0; font-size: 16px; color: #333; } .close-prompt { background: none; border: none; font-size: 20px; color: #666; cursor: pointer; padding: 4px 8px; } .prompt-list { padding: 8px; max-height: 300px; overflow-y: auto; } .prompt-item { width: 100%; padding: 12px; text-align: left; background: none; border: none; border-radius: 6px; cursor: pointer; transition: all 0.2s; } .prompt-item:hover { background: #f5f5f5; } @keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } /* 滚动条样式 */ .chat-messages::-webkit-scrollbar { width: 6px; } .chat-messages::-webkit-scrollbar-track { background: transparent; } .chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; } .chat-messages::-webkit-scrollbar-thumb:hover { background: #ccc; } /* 打字动画相关样式 */ .message-content.typing { display: flex; flex-direction: column; } .message-content.typing p { display: inline; white-space: pre-wrap; word-break: break-word; } .message-content.typing p::after { content: "|"; display: inline; margin-left: 1px; font-weight: bold; animation: blink 1s infinite; vertical-align: baseline; } @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } } /* 加载动画样式 */ .typing-indicator { display: flex; gap: 4px; padding: 4px 8px; } .typing-indicator span { width: 8px; height: 8px; background: #90a4ae; border-radius: 50%; animation: bounce 1.4s infinite ease-in-out; } .typing-indicator span:nth-child(1) { animation-delay: -0.32s; } .typing-indicator span:nth-child(2) { animation-delay: -0.16s; } @keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } } /* 消息内容的过渡效果 */ .message-content { transition: opacity 0.3s ease; } .message-content.loading { min-width: 60px; min-height: 24px; } /* 消息时间戳样式 */ .message-timestamp { font-size: 12px; color: #999; line-height: 24px; /* 与按钮高度一致 */ margin: 0; /* 移除可能的外边距 */ padding: 0 2px; /* 添加少许水平内边距 */ } /* 消息hover效果 */ .message-content:hover { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); } /* 添加头像占位 */ .message.assistant::before { content: ""; width: 32px; height: 32px; min-width: 32px; margin-right: 8px; border-radius: 50%; background: #fff url("../images/icon128.png") center/cover no-repeat; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; } /* 头像悬停效果 */ .message.assistant:hover::before { transform: scale(1.1); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); } /* 消息分组 */ .message + .message.assistant, .message + .message.user { margin-top: 2px; } .message:not(:first-child) { margin-top: 16px; } /* 添加新消息指示器 */ .new-messages-indicator { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%); background: rgba(33, 150, 243, 0.9); color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 14px; cursor: pointer; opacity: 0; transition: all 0.3s ease; pointer-events: none; } .new-messages-indicator.show { opacity: 1; pointer-events: auto; } /* 消息格式化样式 */ .message-content p { margin: 0; line-height: 1.5; } .message-content pre { background: #f6f8fa; padding: 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; } .message-content code { font-family: monospace; background: #f6f8fa; padding: 2px 4px; border-radius: 4px; font-size: 0.9em; } .message-content pre code { padding: 0; background: none; } .message-content a { color: #1a73e8; text-decoration: none; } .message-content a:hover { text-decoration: underline; } .message-content strong { font-weight: 600; } .message-content em { font-style: italic; } /* 消息操作栏样式 */ .message-actions { display: flex; justify-content: flex-end; align-items: center; /* 确保垂直居中对齐 */ gap: 8px; margin-top: 4px; min-height: 24px; /* 设置最小高度确保一致性 */ } /* 复制按钮样式 */ .copy-button { display: flex; align-items: center; gap: 4px; height: 24px; /* 固定高度 */ padding: 0 6px; /* 调整水平内边距 */ font-size: 12px; color: #666; background: none; border: none; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; } .copy-button:hover { background: rgba(0, 0, 0, 0.05); color: #1a73e8; } .copy-button svg { width: 14px; height: 14px; } /* 复制成功提示 */ .copy-button.copied { color: #00c853; pointer-events: none; } /* Markdown样式 */ .message-content h1, .message-content h2, .message-content h3, .message-content h4, .message-content h5, .message-content h6 { margin: 16px 0 8px; font-weight: 600; line-height: 1.25; color: #333; } .message-content h1 { font-size: 1.5em; } .message-content h2 { font-size: 1.3em; } .message-content h3 { font-size: 1.2em; } .message-content h4 { font-size: 1.1em; } .message-content h5 { font-size: 1em; } .message-content h6 { font-size: 0.9em; } .message-content ul, .message-content ol { margin: 8px 0; padding-left: 20px; } .message-content li { margin: 4px 0; } .message-content blockquote { margin: 8px 0; padding: 8px 16px; border-left: 4px solid #ddd; background: rgba(0, 0, 0, 0.02); color: #666; } .message-content hr { margin: 16px 0; border: none; border-top: 1px solid #eee; } /* 调整代码块样式 */ .message-content pre { background: #f6f8fa; padding: 16px; border-radius: 6px; overflow-x: auto; margin: 8px 0; } .message-content pre code { padding: 0; background: none; font-size: 0.9em; line-height: 1.5; } /* 打断按钮样式 */ .stop-button { display: none; /* 默认隐藏 */ padding: 6px 12px; color: #666; background: none; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; font-size: 12px; transition: all 0.2s ease; } .stop-button.show { display: flex; align-items: center; gap: 4px; } .stop-button:hover { color: #d32f2f; border-color: #d32f2f; background: rgba(211, 47, 47, 0.05); } .stop-button svg { width: 14px; height: 14px; } /* 中断消息样式 */ .message.assistant .message-content.interrupted { background: #fff1f0; border-left: 4px solid #ff4d4f; border-top-left-radius: 0; padding-left: 12px; color: #cf1322; } .message-content.interrupted .message-timestamp { color: rgba(207, 19, 34, 0.6); } /* 输入框禁用状态样式 */ #chat-input:disabled { cursor: not-allowed; color: #999; } .input-wrapper.generating { background: #f5f5f5; } /* 修改:只禁用输入框和其他按钮 */ .input-wrapper.generating #chat-input, .input-wrapper.generating .icon-button { pointer-events: none; opacity: 0.5; /* 添加透明度表示禁用状态 */ } .input-wrapper.generating #chat-input::placeholder { color: #999; opacity: 0.8; } /* 确保只有停止按钮可以点击 */ .input-wrapper.generating .stop-button { pointer-events: auto; opacity: 1; /* 保持完全不透明 */ cursor: pointer; }