ResourceCapsule.vue 28 KB

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