1
0

ResourceCapsule.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. <template>
  2. <div ref="wrapRef" class="resource-capsule">
  3. <!-- 胶囊按钮 -->
  4. <button type="button" :class="['capsule-btn', { open: isOpen }]" title="会话资源" :aria-expanded="isOpen" @click="isOpen = !isOpen">
  5. <div class="capsule-icon"></div>
  6. <span class="capsule-text"> </span>
  7. <span v-if="totalCount > 0" class="capsule-count">{{ totalCount }}</span>
  8. <div class="capsule-arrow"></div>
  9. </button>
  10. <!-- 聚合下拉面板 -->
  11. <Transition name="capsule-fade">
  12. <div v-if="isOpen" class="capsule-popup" :style="{ width: `${popupWidth}px` }" @click.stop>
  13. <div class="popup-header">
  14. <div class="popup-title">
  15. <div class="popup-title-icon"></div>
  16. <span>会话资源</span>
  17. </div>
  18. <CloseOutlined class="close-icon" @click="isOpen = false" />
  19. </div>
  20. <div class="popup-body">
  21. <template v-if="files.length || links.length || agents.length">
  22. <div v-if="files.length" class="popup-section">
  23. <div
  24. :class="['section-title', { collapsed: collapsedFiles }]"
  25. role="button"
  26. tabindex="0"
  27. :aria-expanded="!collapsedFiles"
  28. @click="collapsedFiles = !collapsedFiles"
  29. @keydown.enter.prevent="collapsedFiles = !collapsedFiles"
  30. @keydown.space.prevent="collapsedFiles = !collapsedFiles"
  31. >
  32. <span class="section-title-text">文件</span>
  33. <span class="section-count">{{ files.length }}</span>
  34. <div class="section-arrow"></div>
  35. </div>
  36. <Transition name="collapse">
  37. <div v-show="!collapsedFiles" class="section-body">
  38. <div
  39. v-for="item in files"
  40. :key="fileKey(item)"
  41. class="popup-item file-item"
  42. :title="`预览 ${item.name}`"
  43. @click="handleFileClick(item)"
  44. >
  45. <div v-if="previewingKey === fileKey(item)" class="row-loading"></div>
  46. <div v-else class="item-icon" :style="{ backgroundImage: getFileIconVar(item.name) }"></div>
  47. <div class="item-info">
  48. <div class="item-name" :title="item.name">{{ item.name }}</div>
  49. <div class="item-meta">
  50. <span class="item-tag" :class="item.kind">{{ item.kind === 'upload' ? '上传' : 'AI生成' }}</span>
  51. <span v-if="item.size != null">{{ formatFileSize(item.size) }}</span>
  52. </div>
  53. </div>
  54. <button class="download-btn" :title="`下载 ${item.name}`" @click.stop="downloadFile(item)">
  55. <div class="download-btn-icon"></div>
  56. </button>
  57. </div>
  58. </div>
  59. </Transition>
  60. </div>
  61. <div v-if="links.length" class="popup-section">
  62. <div
  63. :class="['section-title', { collapsed: collapsedLinks }]"
  64. role="button"
  65. tabindex="0"
  66. :aria-expanded="!collapsedLinks"
  67. @click="collapsedLinks = !collapsedLinks"
  68. @keydown.enter.prevent="collapsedLinks = !collapsedLinks"
  69. @keydown.space.prevent="collapsedLinks = !collapsedLinks"
  70. >
  71. <span class="section-title-text">链接</span>
  72. <span class="section-count">{{ links.length }}</span>
  73. <div class="section-arrow"></div>
  74. </div>
  75. <Transition name="collapse">
  76. <div v-show="!collapsedLinks" class="section-body">
  77. <div v-for="link in links" :key="link.href" class="popup-item link-item" @click="openLink(link)">
  78. <div class="link-glyph"></div>
  79. <div class="item-info">
  80. <div class="item-name" :title="link.title">{{ link.title }}</div>
  81. <div class="item-meta link-href" :title="link.href">{{ link.href }}</div>
  82. </div>
  83. <div class="link-arrow"></div>
  84. </div>
  85. </div>
  86. </Transition>
  87. </div>
  88. <div v-if="agents.length" class="popup-section">
  89. <div
  90. :class="['section-title', { collapsed: collapsedAgents }]"
  91. role="button"
  92. tabindex="0"
  93. :aria-expanded="!collapsedAgents"
  94. @click="collapsedAgents = !collapsedAgents"
  95. @keydown.enter.prevent="collapsedAgents = !collapsedAgents"
  96. @keydown.space.prevent="collapsedAgents = !collapsedAgents"
  97. >
  98. <span class="section-title-text">智能体</span>
  99. <span class="section-count">{{ agents.length }}</span>
  100. <div class="section-arrow"></div>
  101. </div>
  102. <Transition name="collapse">
  103. <div v-show="!collapsedAgents" class="section-body">
  104. <div v-for="item in agents" :key="agentKey(item)" class="popup-item agent-item" @click="handleAgentClick(item)">
  105. <div class="agent-icon"></div>
  106. <div class="item-info">
  107. <div class="item-name" :title="item.agent">{{ item.agent }}</div>
  108. <div class="item-meta">
  109. <span class="agent-status" :class="item.status">
  110. <span class="status-dot"></span>
  111. {{ agentStatusText(item.status) }}
  112. </span>
  113. <span>第{{ item.round }}轮</span>
  114. <span v-if="item.toolCount > 0">{{ item.toolCount }} 次工具调用</span>
  115. <span v-if="item.hiddenAnswer" class="item-tag folded">折叠回答</span>
  116. </div>
  117. </div>
  118. <button class="locate-btn" :title="`定位到第 ${item.round} 轮消息`" @click.stop="handleLocateClick(item)">
  119. <div class="locate-btn-icon"></div>
  120. </button>
  121. <div class="link-arrow"></div>
  122. </div>
  123. </div>
  124. </Transition>
  125. </div>
  126. </template>
  127. <div v-else class="popup-empty">
  128. <div class="popup-empty-title">暂无内容</div>
  129. <div class="popup-empty-desc">AI 生成的文件、可跳转链接与智能体调用记录会汇总到这里</div>
  130. </div>
  131. </div>
  132. </div>
  133. </Transition>
  134. </div>
  135. </template>
  136. <script setup lang="ts">
  137. import { ref, computed, watch, nextTick } from 'vue';
  138. import { CloseOutlined } from '@ant-design/icons-vue';
  139. import { onClickOutside, onKeyStroke } from '@vueuse/core';
  140. import { message } from 'ant-design-vue';
  141. import { formatFileSize, getFileIconVar, fetchPreviewFile } from './utils';
  142. import type { AttachedFile, CapsuleFileItem, CapsuleLinkItem, CapsuleAgentItem } from './types';
  143. const props = defineProps<{
  144. files: CapsuleFileItem[];
  145. links: CapsuleLinkItem[];
  146. agents: CapsuleAgentItem[];
  147. // 当前任务 id:切换任务时收起弹层,避免用户误操作上一个任务的数据
  148. taskId?: string;
  149. }>();
  150. const emit = defineEmits<{
  151. (e: 'file-preview', file: AttachedFile): void;
  152. (e: 'agent-detail-click', data: { messageIndex: number; agent: string; agentId?: string }): void;
  153. (e: 'locate-message', messageIndex: number): void;
  154. }>();
  155. const wrapRef = ref<HTMLElement>();
  156. const isOpen = ref(false);
  157. // 分区默认折叠,点击标题后才展开
  158. const collapsedFiles = ref(true);
  159. const collapsedLinks = ref(true);
  160. const collapsedAgents = ref(true);
  161. // 正在拉取预览内容的文件行(显示加载态、防重复点击)
  162. const previewingKey = ref<string | null>(null);
  163. const totalCount = computed(() => props.files.length + props.links.length + props.agents.length);
  164. onClickOutside(wrapRef, () => {
  165. isOpen.value = false;
  166. });
  167. // Esc 收起弹层(键盘可达性)
  168. onKeyStroke('Escape', () => {
  169. isOpen.value = false;
  170. });
  171. watch(
  172. () => props.taskId,
  173. () => {
  174. isOpen.value = false;
  175. // 切换任务后分区回到默认折叠状态
  176. collapsedFiles.value = true;
  177. collapsedLinks.value = true;
  178. collapsedAgents.value = true;
  179. }
  180. );
  181. // 弹层宽度自适应:窄窗口/拖拽缩放后避免超出聊天面板左边界被裁切。
  182. // 容器带 scale 缩放,getBoundingClientRect 是缩放后的视口坐标,需换算回布局坐标
  183. const popupWidth = ref(300);
  184. const fitPopupWidth = () => {
  185. const btn = wrapRef.value;
  186. const panel = btn?.closest('.chat-panel') as HTMLElement | null;
  187. if (!btn || !panel) return;
  188. const btnRect = btn.getBoundingClientRect();
  189. const panelRect = panel.getBoundingClientRect();
  190. const scale = panel.offsetHeight ? panelRect.height / panel.offsetHeight : 1;
  191. const available = (btnRect.right - panelRect.left - 8) / scale;
  192. popupWidth.value = Math.max(200, Math.min(300, available));
  193. };
  194. watch(isOpen, (open) => {
  195. if (open) nextTick(fitPopupWidth);
  196. });
  197. // 稳定列表 key:文件按来源唯一标识(上传附件 id / 下载地址),智能体按消息×身份标识
  198. const fileKey = (item: CapsuleFileItem): string =>
  199. item.kind === 'upload' ? `upload-${item.file?.id || item.name}` : `download-${item.url || item.name}`;
  200. const agentKey = (item: CapsuleAgentItem): string => `agent-${item.messageIndex}-${item.agentId || item.agent}`;
  201. // 下载锚点挂在胶囊根节点内而非 body:
  202. // 程序化 a.click() 的合成点击(detail === 0)会被 onClickOutside 当作"外部点击"而关闭弹层,
  203. // 挂载到组件内部后合成点击的路径包含组件根节点,不会被误判
  204. const triggerDownload = (href: string, filename: string) => {
  205. const a = document.createElement('a');
  206. a.href = href;
  207. a.download = filename;
  208. const mountEl = wrapRef.value || document.body;
  209. mountEl.appendChild(a);
  210. a.click();
  211. mountEl.removeChild(a);
  212. };
  213. const downloadFile = async (item: CapsuleFileItem) => {
  214. // AI 下载链接直接走地址下载
  215. if (item.kind === 'download') {
  216. if (!item.url) return;
  217. triggerDownload(item.url, item.name);
  218. return;
  219. }
  220. // 上传附件:优先用原始文件对象下载(字节保真),否则由本地缓存内容构造 Blob
  221. const file = item.file;
  222. if (!file) return;
  223. if (file.originalFile) {
  224. const url = URL.createObjectURL(file.originalFile);
  225. triggerDownload(url, file.originalFile.name || file.name);
  226. URL.revokeObjectURL(url);
  227. return;
  228. }
  229. let blob: Blob | null = null;
  230. if (file.content != null) {
  231. blob = new Blob([file.content], { type: file.type || 'text/plain' });
  232. } else if (file.arrayBuffer) {
  233. blob = new Blob([file.arrayBuffer], { type: file.type || 'application/octet-stream' });
  234. } else if (file.preview) {
  235. try {
  236. blob = await (await fetch(file.preview)).blob();
  237. } catch {
  238. blob = null;
  239. }
  240. }
  241. if (!blob) {
  242. emit('file-preview', file);
  243. return;
  244. }
  245. const url = URL.createObjectURL(blob);
  246. triggerDownload(url, file.name);
  247. URL.revokeObjectURL(url);
  248. };
  249. // 点击文件行:统一在右侧面板打开预览(上传附件直接用本地数据,下载链接先拉取内容)
  250. const handleFileClick = async (item: CapsuleFileItem) => {
  251. const key = fileKey(item);
  252. // 该行正在拉取预览内容时忽略重复点击
  253. if (previewingKey.value === key) return;
  254. if (item.kind === 'upload') {
  255. if (item.file) emit('file-preview', item.file);
  256. return;
  257. }
  258. if (!item.url) return;
  259. previewingKey.value = key;
  260. try {
  261. const previewFile = await fetchPreviewFile(item.url, item.name);
  262. if (!previewFile) {
  263. downloadFile(item);
  264. return;
  265. }
  266. emit('file-preview', previewFile);
  267. } catch (err) {
  268. console.error('获取文件内容失败:', err);
  269. message.error('文件预览失败,请尝试下载查看');
  270. } finally {
  271. previewingKey.value = null;
  272. }
  273. };
  274. // 与消息正文中 markdown 链接的渲染行为一致:新标签页打开
  275. const openLink = (link: CapsuleLinkItem) => {
  276. if (!link.href) return;
  277. window.open(link.href, '_blank', 'noopener,noreferrer');
  278. };
  279. const agentStatusText = (status: CapsuleAgentItem['status']): string => {
  280. if (status === 'done') return '已完成';
  281. if (status === 'running') return '运行中';
  282. if (status === 'waiting') return '等待确认';
  283. return '已中断';
  284. };
  285. // 点击智能体条目:交给父组件打开右侧智能体详情面板(身份与思考卡片分组一致)
  286. const handleAgentClick = (item: CapsuleAgentItem) => {
  287. emit('agent-detail-click', { messageIndex: item.messageIndex, agent: item.agent, agentId: item.agentId });
  288. };
  289. // 定位到该智能体所在的消息(收起弹层后由父组件滚动消息列表)
  290. const handleLocateClick = (item: CapsuleAgentItem) => {
  291. isOpen.value = false;
  292. emit('locate-message', item.messageIndex);
  293. };
  294. </script>
  295. <style scoped lang="less">
  296. .resource-capsule {
  297. position: relative;
  298. flex-shrink: 0;
  299. margin-left: 8px;
  300. z-index: 10;
  301. .capsule-btn {
  302. display: flex;
  303. align-items: center;
  304. gap: 6px;
  305. height: 36px;
  306. padding: 0 12px;
  307. border-radius: 18px;
  308. background: linear-gradient(135deg, rgba(10, 132, 255, 0.22) 0%, rgba(10, 132, 255, 0.07) 100%);
  309. border: 1px solid rgba(10, 132, 255, 0.45);
  310. box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  311. cursor: pointer;
  312. user-select: none;
  313. font-family: inherit;
  314. transition:
  315. background 0.2s,
  316. border-color 0.2s,
  317. box-shadow 0.2s,
  318. transform 0.1s;
  319. &:hover {
  320. background: linear-gradient(135deg, rgba(10, 132, 255, 0.32) 0%, rgba(10, 132, 255, 0.14) 100%);
  321. border-color: rgba(10, 132, 255, 0.65);
  322. box-shadow:
  323. 0 0 10px rgba(10, 132, 255, 0.25),
  324. inset 0 1px 0 rgba(255, 255, 255, 0.08);
  325. }
  326. &:active {
  327. background: linear-gradient(135deg, rgba(10, 132, 255, 0.4) 0%, rgba(10, 132, 255, 0.2) 100%);
  328. transform: scale(0.97);
  329. }
  330. &:focus-visible {
  331. outline: 1px solid rgba(10, 132, 255, 0.8);
  332. outline-offset: 1px;
  333. }
  334. &.open {
  335. background: linear-gradient(135deg, rgba(10, 132, 255, 0.32) 0%, rgba(10, 132, 255, 0.14) 100%);
  336. border-color: rgba(10, 132, 255, 0.65);
  337. box-shadow:
  338. 0 0 10px rgba(10, 132, 255, 0.25),
  339. inset 0 1px 0 rgba(255, 255, 255, 0.08);
  340. }
  341. .capsule-icon {
  342. width: 14px;
  343. height: 14px;
  344. background-image: var(--img-chat-attach-icon);
  345. background-repeat: no-repeat;
  346. background-size: 100% 100%;
  347. flex-shrink: 0;
  348. filter: drop-shadow(0 0 3px rgba(10, 132, 255, 0.5));
  349. }
  350. .capsule-text {
  351. font-size: 12px;
  352. color: #e0e6ed;
  353. white-space: nowrap;
  354. }
  355. .capsule-count {
  356. min-width: 18px;
  357. height: 18px;
  358. line-height: 18px;
  359. padding: 0 5px;
  360. border-radius: 9px;
  361. background: linear-gradient(135deg, #2f9bff 0%, #0a84ff 100%);
  362. box-shadow: 0 1px 4px rgba(10, 132, 255, 0.45);
  363. color: #fff;
  364. font-size: 11px;
  365. text-align: center;
  366. flex-shrink: 0;
  367. }
  368. .capsule-arrow {
  369. width: 10px;
  370. height: 10px;
  371. background-image: var(--img-chat-arrow-icon);
  372. background-repeat: no-repeat;
  373. background-size: 100% 100%;
  374. flex-shrink: 0;
  375. transition: transform 0.2s;
  376. }
  377. &.open .capsule-arrow {
  378. transform: rotate(180deg);
  379. }
  380. }
  381. .capsule-popup {
  382. position: absolute;
  383. top: calc(100% + 8px);
  384. right: 0;
  385. width: 300px;
  386. max-height: 400px;
  387. background: linear-gradient(135deg, #0a1628 0%, #0d2137 50%, #0a1e35 100%);
  388. border: 1px solid #1a4a6f;
  389. border-radius: 10px;
  390. box-shadow:
  391. 0 8px 24px rgba(0, 0, 0, 0.5),
  392. 0 0 14px rgba(10, 132, 255, 0.08);
  393. z-index: 1000;
  394. display: flex;
  395. flex-direction: column;
  396. // 指向胶囊按钮的小箭头(与会话提示条箭头同一画法)
  397. &::before {
  398. content: '';
  399. position: absolute;
  400. top: -6px;
  401. right: 26px;
  402. width: 10px;
  403. height: 10px;
  404. transform: rotate(45deg);
  405. background: #0d2137;
  406. border-left: 1px solid #1a4a6f;
  407. border-top: 1px solid #1a4a6f;
  408. }
  409. .popup-header {
  410. padding: 12px 14px;
  411. border-bottom: 1px solid rgba(26, 74, 111, 0.55);
  412. background: linear-gradient(180deg, rgba(10, 132, 255, 0.1) 0%, rgba(10, 132, 255, 0.02) 100%);
  413. border-radius: 10px 10px 0 0;
  414. display: flex;
  415. justify-content: space-between;
  416. align-items: center;
  417. flex-shrink: 0;
  418. .popup-title {
  419. display: flex;
  420. align-items: center;
  421. gap: 8px;
  422. font-size: 13px;
  423. font-weight: 500;
  424. letter-spacing: 0.3px;
  425. color: #e6edf3;
  426. .popup-title-icon {
  427. width: 15px;
  428. height: 15px;
  429. background-image: var(--img-chat-attach-icon);
  430. background-repeat: no-repeat;
  431. background-size: 100% 100%;
  432. filter: drop-shadow(0 0 3px rgba(10, 132, 255, 0.5));
  433. flex-shrink: 0;
  434. }
  435. }
  436. .close-icon {
  437. cursor: pointer;
  438. font-size: 12px;
  439. color: #8b949e;
  440. width: 22px;
  441. height: 22px;
  442. display: flex;
  443. align-items: center;
  444. justify-content: center;
  445. border-radius: 50%;
  446. transition:
  447. color 0.2s,
  448. background 0.2s;
  449. &:hover {
  450. color: #e0e6ed;
  451. background: rgba(10, 132, 255, 0.2);
  452. }
  453. }
  454. }
  455. .popup-body {
  456. flex: 1;
  457. overflow-y: auto;
  458. padding: 6px;
  459. scrollbar-width: thin;
  460. scrollbar-color: rgba(139, 148, 158, 0.4) transparent;
  461. &::-webkit-scrollbar {
  462. width: 6px;
  463. }
  464. &::-webkit-scrollbar-track {
  465. background: transparent;
  466. }
  467. &::-webkit-scrollbar-thumb {
  468. background: rgba(139, 148, 158, 0.35);
  469. border-radius: 3px;
  470. &:hover {
  471. background: rgba(139, 148, 158, 0.6);
  472. }
  473. }
  474. .popup-section {
  475. & + .popup-section {
  476. margin-top: 4px;
  477. padding-top: 6px;
  478. border-top: 1px solid rgba(63, 80, 106, 0.35);
  479. }
  480. .section-title {
  481. display: flex;
  482. align-items: center;
  483. gap: 6px;
  484. padding: 6px 10px;
  485. border-radius: 6px;
  486. font-size: 12px;
  487. font-weight: 500;
  488. letter-spacing: 0.4px;
  489. color: #a9b9c9;
  490. cursor: pointer;
  491. user-select: none;
  492. transition:
  493. background 0.2s,
  494. color 0.2s;
  495. &:hover {
  496. background: rgba(10, 132, 255, 0.12);
  497. color: #e0e6ed;
  498. }
  499. .section-title-text {
  500. font-size: inherit;
  501. font-weight: inherit;
  502. letter-spacing: inherit;
  503. color: inherit;
  504. }
  505. .section-count {
  506. min-width: 16px;
  507. height: 16px;
  508. line-height: 16px;
  509. padding: 0 5px;
  510. border-radius: 8px;
  511. background: rgba(10, 132, 255, 0.14);
  512. color: #79c0ff;
  513. font-size: 11px;
  514. text-align: center;
  515. }
  516. .section-arrow {
  517. width: 10px;
  518. height: 10px;
  519. margin-left: auto;
  520. background-image: var(--img-chat-arrow-icon);
  521. background-repeat: no-repeat;
  522. background-size: 100% 100%;
  523. opacity: 0.7;
  524. transition:
  525. transform 0.2s,
  526. opacity 0.2s;
  527. }
  528. &:hover .section-arrow {
  529. opacity: 1;
  530. }
  531. &.collapsed .section-arrow {
  532. transform: rotate(180deg);
  533. }
  534. }
  535. }
  536. .popup-item {
  537. display: flex;
  538. align-items: center;
  539. gap: 10px;
  540. padding: 9px 10px;
  541. cursor: pointer;
  542. border-radius: 6px;
  543. transition: background 0.2s;
  544. &:hover {
  545. background: rgba(10, 132, 255, 0.14);
  546. }
  547. &:active {
  548. background: rgba(10, 132, 255, 0.22);
  549. }
  550. .item-icon {
  551. width: 26px;
  552. height: 26px;
  553. background-repeat: no-repeat;
  554. background-size: 100% 100%;
  555. flex-shrink: 0;
  556. }
  557. .row-loading {
  558. width: 16px;
  559. height: 16px;
  560. margin: 5px;
  561. border: 2px solid rgba(10, 132, 255, 0.3);
  562. border-top-color: #0a84ff;
  563. border-radius: 50%;
  564. flex-shrink: 0;
  565. animation: row-spin 0.8s linear infinite;
  566. }
  567. .item-info {
  568. flex: 1;
  569. min-width: 0;
  570. .item-name {
  571. font-size: 12px;
  572. color: #e0e6ed;
  573. overflow: hidden;
  574. text-overflow: ellipsis;
  575. white-space: nowrap;
  576. }
  577. .item-meta {
  578. display: flex;
  579. align-items: center;
  580. gap: 6px;
  581. margin-top: 2px;
  582. font-size: 11px;
  583. color: #8b949e;
  584. .item-tag {
  585. padding: 0 5px;
  586. border-radius: 3px;
  587. line-height: 16px;
  588. &.upload {
  589. color: #79c0ff;
  590. background: rgba(10, 132, 255, 0.15);
  591. }
  592. &.download {
  593. color: #8b949e;
  594. background: rgba(139, 148, 158, 0.15);
  595. }
  596. &.folded {
  597. color: #8b949e;
  598. background: rgba(139, 148, 158, 0.15);
  599. }
  600. }
  601. }
  602. .link-href {
  603. overflow: hidden;
  604. text-overflow: ellipsis;
  605. white-space: nowrap;
  606. }
  607. }
  608. .agent-icon {
  609. width: 26px;
  610. height: 26px;
  611. background-image: var(--img-chat-agent-icon);
  612. background-repeat: no-repeat;
  613. background-size: 100% 100%;
  614. flex-shrink: 0;
  615. }
  616. .agent-status {
  617. display: inline-flex;
  618. align-items: center;
  619. gap: 4px;
  620. padding: 0 5px;
  621. border-radius: 3px;
  622. line-height: 16px;
  623. .status-dot {
  624. width: 6px;
  625. height: 6px;
  626. border-radius: 50%;
  627. background: currentColor;
  628. }
  629. &.running {
  630. color: #0a84ff;
  631. background: rgba(10, 132, 255, 0.15);
  632. box-shadow: 0 0 6px rgba(10, 132, 255, 0.25);
  633. .status-dot {
  634. animation: status-pulse 1.2s ease-in-out infinite;
  635. }
  636. }
  637. &.waiting {
  638. color: #a371f7;
  639. background: rgba(163, 113, 247, 0.12);
  640. }
  641. &.done {
  642. color: #3fb950;
  643. background: rgba(63, 185, 80, 0.12);
  644. }
  645. &.interrupted {
  646. color: #d29922;
  647. background: rgba(210, 153, 34, 0.12);
  648. }
  649. }
  650. .download-btn {
  651. width: 24px;
  652. height: 24px;
  653. display: flex;
  654. align-items: center;
  655. justify-content: center;
  656. padding: 0;
  657. border: none;
  658. border-radius: 4px;
  659. background: transparent;
  660. cursor: pointer;
  661. flex-shrink: 0;
  662. transition:
  663. background 0.2s,
  664. transform 0.1s;
  665. .download-btn-icon {
  666. width: 14px;
  667. height: 14px;
  668. background-image: var(--img-chat-download-icon-btn);
  669. background-repeat: no-repeat;
  670. background-size: 100% 100%;
  671. }
  672. &:hover {
  673. background: rgba(10, 132, 255, 0.25);
  674. }
  675. &:active {
  676. background: rgba(10, 132, 255, 0.4);
  677. transform: scale(0.88);
  678. }
  679. &:focus-visible {
  680. outline: 1px solid rgba(10, 132, 255, 0.8);
  681. }
  682. }
  683. .locate-btn {
  684. width: 24px;
  685. height: 24px;
  686. display: flex;
  687. align-items: center;
  688. justify-content: center;
  689. padding: 0;
  690. border: none;
  691. border-radius: 4px;
  692. background: transparent;
  693. cursor: pointer;
  694. flex-shrink: 0;
  695. transition:
  696. background 0.2s,
  697. transform 0.1s;
  698. .locate-btn-icon {
  699. width: 14px;
  700. height: 14px;
  701. background-image: var(--img-chat-locate-icon);
  702. background-repeat: no-repeat;
  703. background-size: 100% 100%;
  704. opacity: 0.8;
  705. transition: opacity 0.2s;
  706. }
  707. &:hover {
  708. background: rgba(10, 132, 255, 0.25);
  709. .locate-btn-icon {
  710. opacity: 1;
  711. }
  712. }
  713. &:active {
  714. background: rgba(10, 132, 255, 0.4);
  715. transform: scale(0.88);
  716. }
  717. &:focus-visible {
  718. outline: 1px solid rgba(10, 132, 255, 0.8);
  719. }
  720. }
  721. .link-glyph {
  722. width: 26px;
  723. height: 26px;
  724. background-image: var(--img-chat-link-icon);
  725. background-repeat: no-repeat;
  726. background-size: 14px 14px;
  727. background-position: center;
  728. flex-shrink: 0;
  729. opacity: 0.8;
  730. transition: opacity 0.2s;
  731. }
  732. &:hover .link-glyph {
  733. opacity: 1;
  734. }
  735. .link-arrow {
  736. width: 10px;
  737. height: 10px;
  738. background-image: var(--img-chat-next-icon);
  739. background-repeat: no-repeat;
  740. background-size: 100% 100%;
  741. flex-shrink: 0;
  742. }
  743. }
  744. .popup-empty {
  745. padding: 20px 12px;
  746. text-align: center;
  747. .popup-empty-title {
  748. font-size: 12px;
  749. color: #c9d1d9;
  750. }
  751. .popup-empty-desc {
  752. margin-top: 4px;
  753. font-size: 11px;
  754. line-height: 1.5;
  755. color: #8b949e;
  756. }
  757. }
  758. }
  759. }
  760. }
  761. .capsule-fade-enter-active,
  762. .capsule-fade-leave-active {
  763. transition:
  764. opacity 0.15s ease,
  765. transform 0.15s ease;
  766. }
  767. .capsule-fade-enter-from,
  768. .capsule-fade-leave-to {
  769. opacity: 0;
  770. transform: translateY(-4px);
  771. }
  772. // 分区折叠过渡(与思考卡片折叠动画同一模式)
  773. .collapse-enter-active,
  774. .collapse-leave-active {
  775. transition: all 0.25s ease;
  776. overflow: hidden;
  777. }
  778. .collapse-enter-from,
  779. .collapse-leave-to {
  780. opacity: 0;
  781. max-height: 0;
  782. }
  783. .collapse-enter-to,
  784. .collapse-leave-from {
  785. opacity: 1;
  786. max-height: 600px;
  787. }
  788. @keyframes status-pulse {
  789. 0%,
  790. 100% {
  791. opacity: 1;
  792. }
  793. 50% {
  794. opacity: 0.3;
  795. }
  796. }
  797. @keyframes row-spin {
  798. to {
  799. transform: rotate(360deg);
  800. }
  801. }
  802. </style>