重构: AiChat 样式同步到子组件 scoped + 复用抽取(God 拆分遗漏修复)

根因:AiChat God 拆分(抽 ConversationSidebar/ChatInput/MessageList)时样式没移子组件,
留 AiChat <style scoped>。Vue scoped 不匹配子组件内部元素(子元素无父 data-v)→
对话列表/输入框样式丢失 → 布局塌陷(主导航被覆盖点击无反应 + 样式乱)。

修复(纯样式移动,不改选择器/属性/值):
- AiChat <style scoped> 886→151 行(瘦身 83%)
- 侧栏 .ai-conv-* 47 选择器 → ConversationSidebar <style scoped>(新建)
- 输入框 .ai-input-*/.ai-skill-*/.ai-mention-*/.ai-send-btn 40 → ChatInput <style scoped>(新建)
- 复用 .ai-btn-icon* 6 处 → components.css(全局,TopBar+ConversationSidebar 共用)
- 容器 .ai-panel/.ai-chat-area/.ai-queue-*/.ai-toast* 32 → AiChat 保留 scoped
- 清理 TopBar 重复块(AiChat 漏删死代码,零视觉变更)+ 删 TEMP DEBUG 参考线

自验: vite build ✓ + vue-tsc EXIT 0 + AiChat scoped CLEAN(0 子组件类)
This commit is contained in:
2026-06-20 00:28:14 +08:00
parent 5c395f4825
commit 4f8f1cf794
4 changed files with 596 additions and 742 deletions

View File

@@ -607,6 +607,9 @@ async function initContextEventListeners(): Promise<void> {
</script> </script>
<style scoped> <style scoped>
/* ═══ AiChat 容器 scoped(God 拆分遗漏修复:侧栏/输入/消息样式已下沉到对应子组件 scoped,
复用按钮抽 components.css 全局。本块仅保留 AiChat 自身元素:面板布局/聊天区/input-area
容器/agentic 进度/待发队列/toast。子组件元素由各子组件 scoped 负责,父级 scoped 不渗透。) ═══ */
.ai-panel { .ai-panel {
position: relative; /* 容纳 .ai-toast(absolute,相对面板定位,嵌入/分离模式均生效) */ position: relative; /* 容纳 .ai-toast(absolute,相对面板定位,嵌入/分离模式均生效) */
display: flex; display: flex;
@@ -616,309 +619,6 @@ async function initContextEventListeners(): Promise<void> {
border-left: 0.5px solid var(--df-border); border-left: 0.5px solid var(--df-border);
} }
/* ═══ 对话侧边栏 ═══ */
/* 宽度由 CSS 变量驱动(UX-2025-16 拖拽)::style 绑 --sidebar-width,不直接绑 width,
这样 sidebar-slide 过渡的 width:0(enter-from/leave-to)能正常覆盖,折叠/展开动画不破 */
.ai-conv-sidebar {
position: relative;
width: var(--sidebar-width, 200px);
min-width: var(--sidebar-width, 200px);
border-right: 0.5px solid var(--df-border);
display: flex;
flex-direction: column;
height: 100%;
background: var(--df-bg);
}
/* UX-2025-16:右边缘 2px 拖拽条。hover/active 显高亮;拖拽中 body.ai-sidebar-resizing 全局锁 cursor 防抖 */
.ai-sidebar-resize-handle {
position: absolute;
top: 0;
right: -1px; /* 跨过 0.5px border-right,确保命中区不被 border 遮挡 */
width: 4px; /* 命中区 4px(视觉 2px 由 background 控制),易抓取 */
height: 100%;
cursor: col-resize;
z-index: 5;
background: transparent;
transition: background 0.15s var(--df-ease);
}
.ai-sidebar-resize-handle:hover {
background: var(--df-accent, #4f8cff);
opacity: 0.5;
}
/* 拖拽中全局锁 cursor + 禁选中文本(挂在 body 上,跨元素生效) */
body.ai-sidebar-resizing,
body.ai-sidebar-resizing * {
cursor: col-resize !important;
user-select: none !important;
}
.ai-conv-sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 10px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-conv-sidebar-title {
font-size: 12px;
font-weight: 500;
color: var(--df-text);
}
/* UX-06 §3.1: 对话搜索框(紧贴 header 下,样式跟随周围输入控件) */
.ai-conv-search {
position: relative;
display: flex;
align-items: center;
padding: 6px 10px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-conv-search-icon {
flex: none;
color: var(--df-text-dim);
margin-right: 6px;
}
.ai-conv-search-input {
flex: 1;
min-width: 0;
border: none;
outline: none;
background: transparent;
font-size: 12px;
color: var(--df-text);
}
.ai-conv-search-input::placeholder {
color: var(--df-text-dim);
}
.ai-conv-search-kbd {
flex: none;
font-family: inherit;
font-size: 10px;
color: var(--df-text-dim);
border: 0.5px solid var(--df-border);
border-radius: 3px;
padding: 0 4px;
user-select: none;
}
.ai-conv-list {
flex: 1;
overflow-y: auto;
padding: 4px;
}
.ai-conv-group-title {
padding: 8px 8px 3px;
font-size: 10px;
font-weight: 600;
color: var(--df-text-dim);
user-select: none;
}
.ai-conv-group-title--fold {
cursor: pointer;
display: flex;
align-items: center;
gap: 3px;
}
.ai-conv-group-title--fold:hover {
color: var(--df-text);
}
.ai-conv-group-arrow {
display: inline-block;
transition: transform 0.15s;
font-size: 9px;
}
.ai-conv-group-arrow.is-folded {
transform: rotate(0deg);
}
.ai-conv-group-arrow:not(.is-folded) {
transform: rotate(90deg);
}
.ai-conv-group-count {
margin-left: 2px;
font-weight: 400;
opacity: 0.7;
}
.ai-conv-group-empty {
padding: 2px 8px 4px 20px;
font-size: 10px;
color: var(--df-text-dim);
font-style: italic;
}
.ai-conv-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 8px;
border-radius: var(--df-radius);
cursor: pointer;
transition: background 0.15s;
gap: 4px;
}
.ai-conv-item:hover {
background: var(--df-sidebar-hover);
}
.ai-conv-item--active {
background: var(--df-sidebar-active);
}
.ai-conv-item--archived .ai-conv-item-title {
opacity: 0.6;
}
.ai-conv-item-main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.ai-conv-item-title {
font-size: 11px;
color: var(--df-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 3px;
min-width: 0;
}
/* UX-2025-20 §7.4: AI 生成标题淡入(0.3s opacity + transform 过渡) */
.ai-conv-item-title--flash {
animation: ai-title-flash 0.3s var(--df-ease);
}
.ai-conv-item-title-badge {
flex-shrink: 0;
color: var(--df-success);
}
@keyframes ai-title-flash {
from { opacity: 0; transform: translateX(-3px); }
to { opacity: 1; transform: translateX(0); }
}
.ai-conv-item-edit {
font-size: 11px;
color: var(--df-text);
width: 100%;
height: 18px;
padding: 0 4px;
border: 1px solid var(--df-primary, #4f8cff);
border-radius: var(--df-radius-sm);
background: var(--df-bg, #fff);
outline: none;
box-sizing: border-box;
}
.ai-conv-item-time {
font-size: 9px;
color: var(--df-text-dim);
}
/* F-09: 多会话并发生成指示器(会话项标题行内脉冲点,多会话可同时显示) */
.ai-conv-gen-dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--df-primary, #4f8cff);
flex-shrink: 0;
animation: ai-conv-gen-pulse 1.4s ease-in-out infinite;
}
@keyframes ai-conv-gen-pulse {
0%, 100% { opacity: 0.35; transform: scale(0.85); }
50% { opacity: 1; transform: scale(1.15); }
}
.ai-conv-item-actions {
display: none;
align-items: center;
gap: 2px;
flex-shrink: 0;
}
.ai-conv-item:hover .ai-conv-item-actions {
display: flex;
}
.ai-conv-item-act {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
border: none;
border-radius: var(--df-radius-sm);
background: transparent;
color: var(--df-text-dim);
cursor: pointer;
flex-shrink: 0;
}
.ai-conv-item-act:hover {
background: var(--df-sidebar-hover);
color: var(--df-text);
}
.ai-conv-item-act:last-child:hover {
background: var(--df-danger-bg);
color: var(--df-danger);
}
/* UX-17: 置顶按钮高亮态(已置顶时常驻强调色,不依赖 hover) */
.ai-conv-item-act--pinned {
color: var(--df-accent, var(--df-text));
}
/* CR-22-1: 已置顶对话视觉强调(左边线,不依赖 hover 图钉一眼识别)。
原方案「图钉常驻」与 hover 浮出 actions 矛盾(父 display:none 压制子),
改用 :has 给已置顶 item 左 accent 边线,hover 浮出操作不变。 */
.ai-conv-item:has(.ai-conv-item-act--pinned) {
box-shadow: inset 2px 0 0 var(--df-accent, var(--df-text));
}
/* ── UX-18: 对话导出按钮 + 格式菜单 ──
导出按钮位于归档与删除之间(非 last-child,保持删除按钮 :last-child 红色态不被破坏)。
菜单绝对定位浮于 item 下方右侧,窄侧栏优先避免溢出。 */
.ai-conv-item-export {
position: relative;
display: flex;
align-items: center;
flex-shrink: 0;
}
.ai-conv-export-menu {
position: absolute;
top: 100%;
right: 0;
margin-top: 2px;
z-index: 20;
min-width: 84px;
padding: 2px;
display: flex;
flex-direction: column;
gap: 1px;
background: var(--df-bg, #fff);
border: 1px solid var(--df-border, #e2e2e2);
border-radius: var(--df-radius-sm);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.ai-conv-export-opt {
border: none;
background: transparent;
text-align: left;
padding: 4px 8px;
font-size: 11px;
color: var(--df-text);
cursor: pointer;
border-radius: var(--df-radius-sm);
white-space: nowrap;
}
.ai-conv-export-opt:hover {
background: var(--df-sidebar-hover);
}
.ai-conv-empty {
padding: 16px 8px;
text-align: center;
font-size: 11px;
color: var(--df-text-dim);
}
/* 侧边栏滑入动画 */
.sidebar-slide-enter-active { transition: width 0.2s var(--df-ease), opacity 0.15s; }
.sidebar-slide-leave-active { transition: width 0.15s var(--df-ease), opacity 0.1s; }
.sidebar-slide-enter-from, .sidebar-slide-leave-to {
width: 0;
min-width: 0;
opacity: 0;
overflow: hidden;
}
/* ═══ 聊天区域 ═══ */ /* ═══ 聊天区域 ═══ */
.ai-chat-area { .ai-chat-area {
position: relative; position: relative;
@@ -929,199 +629,9 @@ body.ai-sidebar-resizing * {
min-width: 0; min-width: 0;
} }
/* ═══ Header ═══ */ /* (Header/Provider Bar/模型选择器/.ai-btn-icon 样式已下沉:
.ai-header { TopBar.vue scoped 自持 + .ai-btn-icon* 抽 components.css 全局共享,
display: flex; 原 AiChat scoped 不渗透子组件根,删此重复块零视觉变更) */
align-items: center;
justify-content: space-between;
padding: 10px 14px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-header-left {
display: flex;
align-items: center;
gap: 6px;
}
.ai-header-icon {
display: flex;
align-items: center;
color: var(--df-accent);
}
.ai-header-title {
font-size: 13px;
font-weight: 500;
color: var(--df-text);
}
/* AE-2025-02:审批徽标(待审批>0 时显于头部,点击跳首个审批卡) */
.ai-approval-badge {
display: inline-flex;
align-items: center;
cursor: pointer;
background: var(--df-warning-bg);
color: var(--df-warning);
padding: 2px 8px;
border-radius: var(--df-radius-sm);
font-size: 11px;
font-weight: 500;
white-space: nowrap;
transition: opacity 0.15s var(--df-ease);
}
.ai-approval-badge:hover {
opacity: 0.85;
}
/* ═══ F-01 阶段6: 模型选择器(自动/指定 toggle + 下拉) ═══ */
/* 紧凑内联控件,header 中间区。空池时下拉隐藏 + toggle 禁用,强制自动。 */
.ai-model-picker {
display: flex;
align-items: center;
gap: 4px;
margin-left: auto;
margin-right: 4px;
padding-left: 8px;
min-width: 0;
}
.ai-model-mode {
display: inline-flex;
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm);
overflow: hidden;
flex-shrink: 0;
}
.ai-model-mode-btn {
border: none;
background: transparent;
color: var(--df-text-dim);
font-size: 10px;
padding: 3px 8px;
cursor: pointer;
transition: background 0.15s, color 0.15s;
white-space: nowrap;
}
.ai-model-mode-btn:hover:not(:disabled) {
background: var(--df-bg-card);
color: var(--df-text);
}
.ai-model-mode-btn--active {
background: var(--df-accent-bg);
color: var(--df-accent);
}
.ai-model-mode-btn:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.ai-model-select {
min-width: 0;
max-width: 180px;
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-sm);
background: var(--df-bg);
color: var(--df-text);
font-size: 10px;
font-family: var(--df-font-mono);
padding: 3px 6px;
outline: none;
cursor: pointer;
}
.ai-model-select:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.ai-model-empty {
font-size: 10px;
color: var(--df-text-dim);
white-space: nowrap;
}
.ai-header-actions {
display: flex;
gap: 4px;
}
.ai-btn-icon {
display: flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border: none;
border-radius: var(--df-radius-sm);
background: transparent;
color: var(--df-text-dim);
cursor: pointer;
transition: all 0.15s;
}
.ai-btn-icon:hover {
background: var(--df-bg-card);
color: var(--df-text-secondary);
}
.ai-btn-icon--active {
background: var(--df-accent-bg);
color: var(--df-accent);
}
/* ═══ Provider Bar ═══ */
.ai-provider-bar {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 14px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-provider-bar--switchable {
cursor: pointer;
}
.ai-provider-bar--switchable:hover {
background: var(--df-bg-card);
}
.provider-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--df-success);
}
.provider-name {
font-size: 11px;
font-family: var(--df-font-mono);
color: var(--df-text-dim);
}
.ai-provider-empty {
background: var(--df-danger-bg);
}
.provider-hint {
font-size: 11px;
color: var(--df-danger);
}
/* UX-2025-14: Provider 切换临时 bar(淡入淡出 0.15s) */
.ai-provider-switch-bar {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 14px;
background: color-mix(in srgb, var(--df-accent) 12%, transparent);
border-bottom: 0.5px solid color-mix(in srgb, var(--df-accent) 25%, transparent);
font-size: 11px;
color: var(--df-accent);
user-select: none;
}
.ai-provider-switch-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--df-accent);
flex-shrink: 0;
animation: ai-agentic-pulse 1s ease-in-out infinite;
}
.ai-provider-switch-text {
font-family: var(--df-font-mono);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ai-provider-switch-enter-active,
.ai-provider-switch-leave-active { transition: opacity 0.15s var(--df-ease), max-height 0.15s var(--df-ease); }
.ai-provider-switch-enter-from,
.ai-provider-switch-leave-to { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
.ai-provider-switch-enter-to,
.ai-provider-switch-leave-from { opacity: 1; max-height: 32px; }
/* ═══ Input ═══ */ /* ═══ Input ═══ */
.ai-input-area { .ai-input-area {
@@ -1160,71 +670,6 @@ body.ai-sidebar-resizing * {
0%, 100% { opacity: 1; } 0%, 100% { opacity: 1; }
50% { opacity: 0.3; } 50% { opacity: 0.3; }
} }
.ai-input-wrap {
position: relative;
display: flex;
/* F-260614-05 Phase 2b: flex-wrap 让全宽的图片预览行强制 textarea+按钮换行到下一行 */
flex-wrap: wrap;
align-items: center;
gap: 6px;
background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg);
padding: 6px 8px;
transition: border-color 0.15s;
}
/* F-260614-05 Phase 2b: 待发送图片预览行(粘贴/拖拽加入,发送前可移除) */
.ai-img-preview-row {
display: flex;
flex-wrap: wrap;
gap: 6px;
width: 100%; /* 全宽强制后续 textarea+按钮换行 */
padding-bottom: 4px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-img-preview {
position: relative;
width: 56px;
height: 56px;
border-radius: var(--df-radius);
overflow: hidden;
border: 0.5px solid var(--df-border);
background: var(--df-bg);
}
.ai-img-preview-thumb {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.ai-img-preview-x {
position: absolute;
top: 2px;
right: 2px;
width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 50%;
background: color-mix(in srgb, var(--df-bg) 80%, transparent);
color: var(--df-text-dim);
font-size: 14px;
line-height: 1;
cursor: pointer;
padding: 0;
transition: background 0.15s, color 0.15s;
}
.ai-img-preview-x:hover {
background: var(--df-danger);
color: #fff;
}
.ai-input-wrap:focus-within {
border-color: color-mix(in srgb, var(--df-accent) 40%, transparent);
}
/* ── 待发送队列 ── */ /* ── 待发送队列 ── */
.ai-queue { .ai-queue {
@@ -1289,187 +734,7 @@ body.ai-sidebar-resizing * {
outline: none; outline: none;
} }
/* ── 技能 chip / 联想浮层 ── */ /* (.ai-btn-icon:disabled / .ai-btn-spinner / @keyframes ai-btn-spin 已抽 components.css 全局共享) */
.ai-skill-chip {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 6px;
padding: 3px 8px;
background: color-mix(in srgb, var(--df-accent) 16%, transparent);
border: 0.5px solid color-mix(in srgb, var(--df-accent) 40%, transparent);
border-radius: var(--df-radius);
font-size: 12px;
}
.ai-skill-chip-name { color: var(--df-accent); font-weight: 600; flex-shrink: 0; }
.ai-skill-chip-desc { color: var(--df-text-dim); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 参数格式提示(技能自带 argument_hint 数据,不进 i18n) */
.ai-skill-chip-main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.ai-skill-chip-hint {
color: var(--df-text-dim);
font-family: var(--df-font-mono, ui-monospace, monospace);
font-size: 11px;
background: color-mix(in srgb, var(--df-text-dim) 14%, transparent);
padding: 1px 5px;
border-radius: 3px;
}
.ai-skill-chip-x { background: none; border: none; color: var(--df-text-dim); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
.ai-skill-chip-x:hover { color: var(--df-text); }
.ai-skill-popover {
position: absolute;
bottom: calc(100% + 4px);
left: 0;
right: 0;
max-height: 240px;
overflow-y: auto;
background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
z-index: 20;
}
.ai-skill-item {
display: flex;
flex-direction: column;
gap: 2px;
padding: 6px 10px;
cursor: pointer;
font-size: 12px;
}
.ai-skill-item-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-skill-item--active,
.ai-skill-item:hover {
background: color-mix(in srgb, var(--df-accent) 14%, transparent);
}
.ai-skill-item-name { color: var(--df-accent); font-weight: 600; min-width: 90px; }
.ai-skill-item-desc { color: var(--df-text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-skill-item-src { color: var(--df-text-dim); opacity: 0.6; font-size: 10px; text-transform: uppercase; }
/* 浮层内参数格式提示(等宽 dim 小字,仅在 skill.argument_hint 有值时显) */
.ai-skill-item-hint {
color: var(--df-text-dim);
font-family: var(--df-font-mono, ui-monospace, monospace);
font-size: 11px;
opacity: 0.85;
word-break: break-all;
}
.ai-skill-empty { padding: 8px 12px; color: var(--df-text-dim); opacity: 0.7; font-size: 12px; }
/* ── UX-10 §1.4: @ 实体引用浮层(复用 .ai-skill-popover 容器,仅新增组标题/类型标签) ── */
.ai-mention-popover { /* 同 .ai-skill-popover 定位,这里仅为语义占位,样式继承 */ }
.ai-mention-group {
padding: 4px 10px 2px;
font-size: 10px;
font-weight: 600;
color: var(--df-text-dim);
text-transform: uppercase;
letter-spacing: 0.5px;
user-select: none;
}
.ai-mention-item-name { color: var(--df-text); font-weight: 500; flex-shrink: 0; }
.ai-mention-item-desc {
color: var(--df-text-dim);
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 类型标签小色块(项目/任务区分) */
.ai-mention-item-type {
flex-shrink: 0;
padding: 1px 5px;
border-radius: var(--df-radius-sm);
font-size: 9px;
font-weight: 600;
letter-spacing: 0.3px;
background: var(--df-bg-hover);
color: var(--df-text-dim);
}
.ai-mention-item-type--project {
background: color-mix(in srgb, var(--df-accent) 16%, transparent);
color: var(--df-accent);
}
.ai-mention-item-type--task {
background: color-mix(in srgb, var(--df-success) 16%, transparent);
color: var(--df-success);
}
.ai-input {
flex: 1;
background: transparent;
border: none;
outline: none;
color: var(--df-text);
font-size: 13px;
font-family: var(--df-font-sans);
line-height: 1.5;
resize: vertical;
min-height: 20px;
height: 20px;
max-height: 200px;
overflow-y: auto;
}
.ai-input::placeholder {
color: var(--df-text-dim);
}
.ai-send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border: none;
border-radius: var(--df-radius);
background: var(--df-bg-raised);
color: var(--df-text-dim);
cursor: pointer;
transition: all 0.15s;
flex-shrink: 0;
}
.ai-send-btn--active {
background: var(--df-accent);
color: #fff;
}
.ai-send-btn--active:hover {
background: var(--df-accent-hover);
}
.ai-send-btn:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.ai-send-btn--stop {
background: #e5484d;
color: #fff;
}
.ai-send-btn--stop:hover {
background: #d63a3f;
}
.ai-input-hint {
font-size: 10px;
color: var(--df-text-dim);
text-align: right;
margin-top: 4px;
opacity: 0.6;
}
/* ── F-15 阶段2: 按钮禁用态(清空/压缩上下文,空会话/全归档/生成中)──
复用现有 .ai-btn-icon:hover 风格,禁用时降透明度 + not-allowed,不发 hover 高亮。 */
.ai-btn-icon:disabled {
opacity: 0.35;
cursor: not-allowed;
}
.ai-btn-icon:disabled:hover {
background: transparent;
color: var(--df-text-dim);
}
/* 压缩中 spinner 图标旋转动画 */
.ai-btn-spinner {
animation: ai-btn-spin 0.9s linear infinite;
}
@keyframes ai-btn-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* ═══ 错误 toast(复用 Settings.vue .toast 样式,前缀 ai- 防 scoped 冲突) ═══ */ /* ═══ 错误 toast(复用 Settings.vue .toast 样式,前缀 ai- 防 scoped 冲突) ═══ */
.ai-toast { .ai-toast {

View File

@@ -656,3 +656,237 @@ defineExpose({
sendExamplePrompt, sendExamplePrompt,
}) })
</script> </script>
<!-- ChatInput scoped 样式(第二批抽离遗漏修复: AiChat.vue <style scoped> 迁移,
零视觉变更 AiChat scoped 不渗透子组件根,输入框/技能联想/发送按钮元素失配 本组件自持
CSS 变量(--df-*)由根级 global.css 提供,共享同一份.ai-input-area 容器留父级 AiChat scoped) -->
<style scoped>
.ai-input-wrap {
position: relative;
display: flex;
/* F-260614-05 Phase 2b: flex-wrap 让全宽的图片预览行强制 textarea+按钮换行到下一行 */
flex-wrap: wrap;
align-items: center;
gap: 6px;
background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius-lg);
padding: 6px 8px;
transition: border-color 0.15s;
}
/* F-260614-05 Phase 2b: 待发送图片预览行(粘贴/拖拽加入,发送前可移除) */
.ai-img-preview-row {
display: flex;
flex-wrap: wrap;
gap: 6px;
width: 100%; /* 全宽强制后续 textarea+按钮换行 */
padding-bottom: 4px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-img-preview {
position: relative;
width: 56px;
height: 56px;
border-radius: var(--df-radius);
overflow: hidden;
border: 0.5px solid var(--df-border);
background: var(--df-bg);
}
.ai-img-preview-thumb {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.ai-img-preview-x {
position: absolute;
top: 2px;
right: 2px;
width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 50%;
background: color-mix(in srgb, var(--df-bg) 80%, transparent);
color: var(--df-text-dim);
font-size: 14px;
line-height: 1;
cursor: pointer;
padding: 0;
transition: background 0.15s, color 0.15s;
}
.ai-img-preview-x:hover {
background: var(--df-danger);
color: #fff;
}
.ai-input-wrap:focus-within {
border-color: color-mix(in srgb, var(--df-accent) 40%, transparent);
}
/* ── 技能 chip / 联想浮层 ── */
.ai-skill-chip {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 6px;
padding: 3px 8px;
background: color-mix(in srgb, var(--df-accent) 16%, transparent);
border: 0.5px solid color-mix(in srgb, var(--df-accent) 40%, transparent);
border-radius: var(--df-radius);
font-size: 12px;
}
.ai-skill-chip-name { color: var(--df-accent); font-weight: 600; flex-shrink: 0; }
.ai-skill-chip-desc { color: var(--df-text-dim); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 参数格式提示(技能自带 argument_hint 数据,不进 i18n) */
.ai-skill-chip-main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.ai-skill-chip-hint {
color: var(--df-text-dim);
font-family: var(--df-font-mono, ui-monospace, monospace);
font-size: 11px;
background: color-mix(in srgb, var(--df-text-dim) 14%, transparent);
padding: 1px 5px;
border-radius: 3px;
}
.ai-skill-chip-x { background: none; border: none; color: var(--df-text-dim); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
.ai-skill-chip-x:hover { color: var(--df-text); }
.ai-skill-popover {
position: absolute;
bottom: calc(100% + 4px);
left: 0;
right: 0;
max-height: 240px;
overflow-y: auto;
background: var(--df-bg-card);
border: 0.5px solid var(--df-border);
border-radius: var(--df-radius);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
z-index: 20;
}
.ai-skill-item {
display: flex;
flex-direction: column;
gap: 2px;
padding: 6px 10px;
cursor: pointer;
font-size: 12px;
}
.ai-skill-item-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-skill-item--active,
.ai-skill-item:hover {
background: color-mix(in srgb, var(--df-accent) 14%, transparent);
}
.ai-skill-item-name { color: var(--df-accent); font-weight: 600; min-width: 90px; }
.ai-skill-item-desc { color: var(--df-text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-skill-item-src { color: var(--df-text-dim); opacity: 0.6; font-size: 10px; text-transform: uppercase; }
/* 浮层内参数格式提示(等宽 dim 小字,仅在 skill.argument_hint 有值时显) */
.ai-skill-item-hint {
color: var(--df-text-dim);
font-family: var(--df-font-mono, ui-monospace, monospace);
font-size: 11px;
opacity: 0.85;
word-break: break-all;
}
.ai-skill-empty { padding: 8px 12px; color: var(--df-text-dim); opacity: 0.7; font-size: 12px; }
/* ── UX-10 §1.4: @ 实体引用浮层(复用 .ai-skill-popover 容器,仅新增组标题/类型标签) ── */
.ai-mention-popover { /* 同 .ai-skill-popover 定位,这里仅为语义占位,样式继承 */ }
.ai-mention-group {
padding: 4px 10px 2px;
font-size: 10px;
font-weight: 600;
color: var(--df-text-dim);
text-transform: uppercase;
letter-spacing: 0.5px;
user-select: none;
}
.ai-mention-item-name { color: var(--df-text); font-weight: 500; flex-shrink: 0; }
.ai-mention-item-desc {
color: var(--df-text-dim);
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 类型标签小色块(项目/任务区分) */
.ai-mention-item-type {
flex-shrink: 0;
padding: 1px 5px;
border-radius: var(--df-radius-sm);
font-size: 9px;
font-weight: 600;
letter-spacing: 0.3px;
background: var(--df-bg-hover);
color: var(--df-text-dim);
}
.ai-mention-item-type--project {
background: color-mix(in srgb, var(--df-accent) 16%, transparent);
color: var(--df-accent);
}
.ai-mention-item-type--task {
background: color-mix(in srgb, var(--df-success) 16%, transparent);
color: var(--df-success);
}
.ai-input {
flex: 1;
background: transparent;
border: none;
outline: none;
color: var(--df-text);
font-size: 13px;
font-family: var(--df-font-sans);
line-height: 1.5;
resize: vertical;
min-height: 20px;
height: 20px;
max-height: 200px;
overflow-y: auto;
}
.ai-input::placeholder {
color: var(--df-text-dim);
}
.ai-send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border: none;
border-radius: var(--df-radius);
background: var(--df-bg-raised);
color: var(--df-text-dim);
cursor: pointer;
transition: all 0.15s;
flex-shrink: 0;
}
.ai-send-btn--active {
background: var(--df-accent);
color: #fff;
}
.ai-send-btn--active:hover {
background: var(--df-accent-hover);
}
.ai-send-btn:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.ai-send-btn--stop {
background: #e5484d;
color: #fff;
}
.ai-send-btn--stop:hover {
background: #d63a3f;
}
.ai-input-hint {
font-size: 10px;
color: var(--df-text-dim);
text-align: right;
margin-top: 4px;
opacity: 0.6;
}
</style>

View File

@@ -463,3 +463,311 @@ defineExpose({
focusSearch, focusSearch,
}) })
</script> </script>
<!-- ConversationSidebar scoped 样式(第一批抽离遗漏修复: AiChat.vue <style scoped> 迁移,
零视觉变更 AiChat scoped 不渗透子组件根,导致侧栏元素失配 本组件自持样式
CSS 变量(--df-*)由根级 global.css 提供,共享同一份.ai-btn-icon 共享按钮抽 components.css 全局) -->
<style scoped>
/* ═══ 对话侧边栏 ═══ */
/* 宽度由 CSS 变量驱动(UX-2025-16 拖拽)::style 绑 --sidebar-width,不直接绑 width,
这样 sidebar-slide 过渡的 width:0(enter-from/leave-to)能正常覆盖,折叠/展开动画不破 */
.ai-conv-sidebar {
position: relative;
width: var(--sidebar-width, 200px);
min-width: var(--sidebar-width, 200px);
border-right: 0.5px solid var(--df-border);
display: flex;
flex-direction: column;
height: 100%;
background: var(--df-bg);
}
/* UX-2025-16:右边缘 2px 拖拽条。hover/active 显高亮;拖拽中 body.ai-sidebar-resizing 全局锁 cursor 防抖 */
.ai-sidebar-resize-handle {
position: absolute;
top: 0;
right: -1px; /* 跨过 0.5px border-right,确保命中区不被 border 遮挡 */
width: 4px; /* 命中区 4px(视觉 2px 由 background 控制),易抓取 */
height: 100%;
cursor: col-resize;
z-index: 5;
background: transparent;
transition: background 0.15s var(--df-ease);
}
.ai-sidebar-resize-handle:hover {
background: var(--df-accent, #4f8cff);
opacity: 0.5;
}
/* 拖拽中全局锁 cursor + 禁选中文本(挂在 body 上,跨元素生效) */
body.ai-sidebar-resizing,
body.ai-sidebar-resizing * {
cursor: col-resize !important;
user-select: none !important;
}
.ai-conv-sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 10px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-conv-sidebar-title {
font-size: 12px;
font-weight: 500;
color: var(--df-text);
}
/* UX-06 §3.1: 对话搜索框(紧贴 header 下,样式跟随周围输入控件) */
.ai-conv-search {
position: relative;
display: flex;
align-items: center;
padding: 6px 10px;
border-bottom: 0.5px solid var(--df-border);
}
.ai-conv-search-icon {
flex: none;
color: var(--df-text-dim);
margin-right: 6px;
}
.ai-conv-search-input {
flex: 1;
min-width: 0;
border: none;
outline: none;
background: transparent;
font-size: 12px;
color: var(--df-text);
}
.ai-conv-search-input::placeholder {
color: var(--df-text-dim);
}
.ai-conv-search-kbd {
flex: none;
font-family: inherit;
font-size: 10px;
color: var(--df-text-dim);
border: 0.5px solid var(--df-border);
border-radius: 3px;
padding: 0 4px;
user-select: none;
}
.ai-conv-list {
flex: 1;
overflow-y: auto;
padding: 4px;
}
.ai-conv-group-title {
padding: 8px 8px 3px;
font-size: 10px;
font-weight: 600;
color: var(--df-text-dim);
user-select: none;
}
.ai-conv-group-title--fold {
cursor: pointer;
display: flex;
align-items: center;
gap: 3px;
}
.ai-conv-group-title--fold:hover {
color: var(--df-text);
}
.ai-conv-group-arrow {
display: inline-block;
transition: transform 0.15s;
font-size: 9px;
}
.ai-conv-group-arrow.is-folded {
transform: rotate(0deg);
}
.ai-conv-group-arrow:not(.is-folded) {
transform: rotate(90deg);
}
.ai-conv-group-count {
margin-left: 2px;
font-weight: 400;
opacity: 0.7;
}
.ai-conv-group-empty {
padding: 2px 8px 4px 20px;
font-size: 10px;
color: var(--df-text-dim);
font-style: italic;
}
.ai-conv-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 8px;
border-radius: var(--df-radius);
cursor: pointer;
transition: background 0.15s;
gap: 4px;
}
.ai-conv-item:hover {
background: var(--df-sidebar-hover);
}
.ai-conv-item--active {
background: var(--df-sidebar-active);
}
.ai-conv-item--archived .ai-conv-item-title {
opacity: 0.6;
}
.ai-conv-item-main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.ai-conv-item-title {
font-size: 11px;
color: var(--df-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 3px;
min-width: 0;
}
/* UX-2025-20 §7.4: AI 生成标题淡入(0.3s opacity + transform 过渡) */
.ai-conv-item-title--flash {
animation: ai-title-flash 0.3s var(--df-ease);
}
.ai-conv-item-title-badge {
flex-shrink: 0;
color: var(--df-success);
}
@keyframes ai-title-flash {
from { opacity: 0; transform: translateX(-3px); }
to { opacity: 1; transform: translateX(0); }
}
.ai-conv-item-edit {
font-size: 11px;
color: var(--df-text);
width: 100%;
height: 18px;
padding: 0 4px;
border: 1px solid var(--df-primary, #4f8cff);
border-radius: var(--df-radius-sm);
background: var(--df-bg, #fff);
outline: none;
box-sizing: border-box;
}
.ai-conv-item-time {
font-size: 9px;
color: var(--df-text-dim);
}
/* F-09: 多会话并发生成指示器(会话项标题行内脉冲点,多会话可同时显示) */
.ai-conv-gen-dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--df-primary, #4f8cff);
flex-shrink: 0;
animation: ai-conv-gen-pulse 1.4s ease-in-out infinite;
}
@keyframes ai-conv-gen-pulse {
0%, 100% { opacity: 0.35; transform: scale(0.85); }
50% { opacity: 1; transform: scale(1.15); }
}
.ai-conv-item-actions {
display: none;
align-items: center;
gap: 2px;
flex-shrink: 0;
}
.ai-conv-item:hover .ai-conv-item-actions {
display: flex;
}
.ai-conv-item-act {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
border: none;
border-radius: var(--df-radius-sm);
background: transparent;
color: var(--df-text-dim);
cursor: pointer;
flex-shrink: 0;
}
.ai-conv-item-act:hover {
background: var(--df-sidebar-hover);
color: var(--df-text);
}
.ai-conv-item-act:last-child:hover {
background: var(--df-danger-bg);
color: var(--df-danger);
}
/* UX-17: 置顶按钮高亮态(已置顶时常驻强调色,不依赖 hover) */
.ai-conv-item-act--pinned {
color: var(--df-accent, var(--df-text));
}
/* CR-22-1: 已置顶对话视觉强调(左边线,不依赖 hover 图钉一眼识别)。
原方案「图钉常驻」与 hover 浮出 actions 矛盾(父 display:none 压制子),
改用 :has 给已置顶 item 左 accent 边线,hover 浮出操作不变。 */
.ai-conv-item:has(.ai-conv-item-act--pinned) {
box-shadow: inset 2px 0 0 var(--df-accent, var(--df-text));
}
/* ── UX-18: 对话导出按钮 + 格式菜单 ──
导出按钮位于归档与删除之间(非 last-child,保持删除按钮 :last-child 红色态不被破坏)。
菜单绝对定位浮于 item 下方右侧,窄侧栏优先避免溢出。 */
.ai-conv-item-export {
position: relative;
display: flex;
align-items: center;
flex-shrink: 0;
}
.ai-conv-export-menu {
position: absolute;
top: 100%;
right: 0;
margin-top: 2px;
z-index: 20;
min-width: 84px;
padding: 2px;
display: flex;
flex-direction: column;
gap: 1px;
background: var(--df-bg, #fff);
border: 1px solid var(--df-border, #e2e2e2);
border-radius: var(--df-radius-sm);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.ai-conv-export-opt {
border: none;
background: transparent;
text-align: left;
padding: 4px 8px;
font-size: 11px;
color: var(--df-text);
cursor: pointer;
border-radius: var(--df-radius-sm);
white-space: nowrap;
}
.ai-conv-export-opt:hover {
background: var(--df-sidebar-hover);
}
.ai-conv-empty {
padding: 16px 8px;
text-align: center;
font-size: 11px;
color: var(--df-text-dim);
}
/* 侧边栏滑入动画 */
.sidebar-slide-enter-active { transition: width 0.2s var(--df-ease), opacity 0.15s; }
.sidebar-slide-leave-active { transition: width 0.15s var(--df-ease), opacity 0.1s; }
.sidebar-slide-enter-from, .sidebar-slide-leave-to {
width: 0;
min-width: 0;
opacity: 0;
overflow: hidden;
}
</style>

View File

@@ -77,3 +77,50 @@
color: var(--df-text-secondary); color: var(--df-text-secondary);
border: 0.5px solid var(--df-border); border: 0.5px solid var(--df-border);
} }
/* — AiChat 图标按钮(共享工具类):TopBar header-actions + ConversationSidebar 新建按钮 —
原 AiChat.vue <style scoped> L1039-1072 抽取(非 scoped 全局,供两个 ai/ 子组件共享)。
复用原因:跨 TopBar + ConversationSidebar,无法归属单一 scoped;
原 AiChat scoped(拆分前)不渗透子组件根,ConversationSidebar 拿不到 → 抽全局。
TopBar.vue 内仍有 scoped 副本(第三批抽离时复制),与本全局块逐字一致,无视觉冲突。 */
.ai-btn-icon {
display: flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border: none;
border-radius: var(--df-radius-sm);
background: transparent;
color: var(--df-text-dim);
cursor: pointer;
transition: all 0.15s;
}
.ai-btn-icon:hover {
background: var(--df-bg-card);
color: var(--df-text-secondary);
}
.ai-btn-icon--active {
background: var(--df-accent-bg);
color: var(--df-accent);
}
/* ── F-15 阶段2: 按钮禁用态(清空/压缩上下文,空会话/全归档/生成中)──
复用现有 .ai-btn-icon:hover 风格,禁用时降透明度 + not-allowed,不发 hover 高亮。 */
.ai-btn-icon:disabled {
opacity: 0.35;
cursor: not-allowed;
}
.ai-btn-icon:disabled:hover {
background: transparent;
color: var(--df-text-dim);
}
/* 压缩中 spinner 图标旋转动画(原 AiChat.vue <style scoped> 抽取;
TopBar.vue .ai-btn-spinner 按名引用,Vue 不对 @keyframes scoped 故全局可见) */
.ai-btn-spinner {
animation: ai-btn-spin 0.9s linear infinite;
}
@keyframes ai-btn-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}