/* ===================================================================== * chat.css — AI 聊天面板、消息气泡、设置相关 * AiPanel 根元素为 .panel-pane.ai-pane,布局在 editor.css 定义 * ===================================================================== */ /* 快捷操作工具条 */ .ai-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; margin: 0; border-bottom: 1px solid var(--ui-border, #e2e8f0); flex-shrink: 0; background: var(--ui-panel, #f8fafc); } .ai-action { height: 28px; padding: 0 10px; border: 1px solid var(--ui-border, #e2e8f0); background: #fff; color: var(--ui-text, #1e293b); border-radius: 5px; font-size: 12px; font-weight: 500; line-height: 1; cursor: pointer; transition: all .12s; white-space: nowrap; } .ai-action:hover { border-color: var(--ui-primary, #5b5bd6); color: var(--ui-primary, #5b5bd6); background: var(--ui-primary-soft, rgba(91,91,214,.06)); } .ai-action:disabled { opacity: .45; cursor: not-allowed; } .ai-action:disabled:hover { border-color: var(--ui-border, #e2e8f0); color: var(--ui-text, #1e293b); background: #fff; } /* 破坏性操作(清空)再轻一点 */ .ai-action.ghost { border-color: transparent; background: transparent; color: var(--ui-muted, #64748b); } .ai-action.ghost:hover { border-color: transparent; background: transparent; color: var(--ui-danger, #e11d48); } /* 选中元素提示条 */ .selected-hint { display: flex; align-items: center; gap: .45em; padding: 7px 10px; margin: 0 2px 8px; background: var(--ui-primary-soft, rgba(91,91,214,.08)); border: 1px solid var(--ui-primary, #5b5bd6); border-radius: 6px; font-size: 12px; color: var(--ui-text, #1e293b); flex-shrink: 0; } .selected-hint-icon { color: var(--ui-primary, #5b5bd6); font-weight: 700; } .selected-hint-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; } .selected-hint-flag { font-size: 11px; color: var(--ui-primary, #5b5bd6); flex-shrink: 0; } /* 消息列表 */ .chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 2px; display: flex; flex-direction: column; gap: 12px; } .chat-empty { color: var(--ui-muted); font-size: 13px; text-align: center; padding: 28px 10px; line-height: 1.9; } .chat-empty b { color: var(--ui-text); } .msg { display: flex; } .msg.user { justify-content: flex-end; } .msg .bubble { max-width: 90%; padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.65; word-break: break-word; } .msg.user .bubble { background: var(--ui-primary); color: #fff; border-bottom-right-radius: 4px; } .msg.ai .bubble { background: var(--ui-hover); color: var(--ui-text); border-bottom-left-radius: 4px; } .msg.system .bubble { background: transparent; color: var(--ui-muted); font-size: 12px; font-style: italic; } .msg.ai .bubble.error { background: #fff1f2; color: var(--ui-danger); } .msg.ai .bubble.success { background: #f0fdf4; color: var(--ui-success); } .msg .bubble .diff-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; margin-bottom: 6px; background: rgba(5,150,105,.12); color: var(--ui-success); font-weight: 600; } .msg .bubble .stream-text { white-space: pre-wrap; } /* Markdown 正文排版(marked 渲染后的气泡内容) */ .msg .bubble .md-body > *:first-child { margin-top: 0; } .msg .bubble .md-body > *:last-child { margin-bottom: 0; } .msg .bubble .md-body p { margin: 6px 0; } .msg .bubble .md-body h1, .msg .bubble .md-body h2, .msg .bubble .md-body h3, .msg .bubble .md-body h4 { margin: 10px 0 6px; font-size: 14px; font-weight: 600; } .msg .bubble .md-body h1 { font-size: 16px; } .msg .bubble .md-body h2 { font-size: 15px; } .msg .bubble .md-body ul, .msg .bubble .md-body ol { margin: 6px 0; padding-left: 1.4em; } .msg .bubble .md-body li { margin: 3px 0; } .msg .bubble .md-body strong { font-weight: 600; } .msg .bubble .md-body code { font-family: 'Consolas','Monaco','Courier New',monospace; font-size: 12px; padding: 1px 5px; border-radius: 4px; background: rgba(15,23,42,.08); } .msg.user .md-body code { background: rgba(255,255,255,.2); } .msg .bubble .md-body blockquote { margin: 6px 0; padding: 2px 10px; border-left: 3px solid var(--ui-border); color: var(--ui-muted); } .msg .bubble .md-body table { border-collapse: collapse; margin: 6px 0; font-size: 12px; } .msg .bubble .md-body th, .msg .bubble .md-body td { border: 1px solid var(--ui-border); padding: 4px 8px; } .msg .bubble .md-body hr { border: none; border-top: 1px solid var(--ui-border); margin: 8px 0; } /* 消息中的代码块 */ .msg .msg-code { margin: 6px 0; padding: 10px 12px; background: rgba(15,23,42,.06); border-radius: 8px; overflow-x: auto; max-width: 100%; font-size: 12px; line-height: 1.5; font-family: 'Consolas','Monaco','Courier New',monospace; } .msg.user .msg-code { background: rgba(255,255,255,.15); } .msg .msg-code code { font-family: inherit; white-space: pre; } /* JSON 语法着色 */ .msg .msg-code .jk { color: #5b5bd6; font-weight: 600; } /* key */ .msg .msg-code .js { color: #059669; } /* string value */ .msg .msg-code .jn { color: #d97706; } /* number */ .msg .msg-code .jb { color: #e11d48; font-weight: 600; } /* boolean/null */ /* 流式打字机光标(参考 devflow:细竖线 + 柔和步进闪烁) */ .cursor { display: inline-block; width: 2px; height: 14px; background: var(--ui-primary, #5b5bd6); margin-left: 2px; vertical-align: text-bottom; animation: blink 0.8s step-end infinite; } @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } } /* 输入栏 */ .chat-input-bar { border-top: 1px solid var(--ui-border); padding-top: 10px; margin-top: 4px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; } #chatInput { resize: none; line-height: 1.5; } .chat-input-bar .btns { display: flex; gap: 8px; justify-content: flex-end; }