@lsamien/yaoyao 0.4.76 → 0.4.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/build-info.json +18 -3
- package/desktop/main.mjs +6 -2
- package/dist/assets/{AboutDialog-fbm5CG09.js → AboutDialog-k7oUOua0.js} +2 -2
- package/dist/assets/AboutDialog-k7oUOua0.js.map +1 -0
- package/dist/assets/{BotAutomationsView-DPAAYyuy.js → BotAutomationsView-CUaMkVfT.js} +2 -2
- package/dist/assets/{BotAutomationsView-DPAAYyuy.js.map → BotAutomationsView-CUaMkVfT.js.map} +1 -1
- package/dist/assets/{BotPluginsDialog-MwGpwjgu.js → BotPluginsDialog-BqfqrWdq.js} +2 -2
- package/dist/assets/{BotPluginsDialog-MwGpwjgu.js.map → BotPluginsDialog-BqfqrWdq.js.map} +1 -1
- package/dist/assets/{BotSettingsDialog-DXtsSzi8.js → BotSettingsDialog-BfW0Jxhg.js} +4 -4
- package/dist/assets/{BotSettingsDialog-DXtsSzi8.js.map → BotSettingsDialog-BfW0Jxhg.js.map} +1 -1
- package/dist/assets/{ChatView-BNqHa6Ma.js → ChatView-CTWvNlNq.js} +2 -2
- package/dist/assets/{ChatView-BNqHa6Ma.js.map → ChatView-CTWvNlNq.js.map} +1 -1
- package/dist/assets/{ComputerPanel-B0QyKQkF.js → ComputerPanel-D_wWUzlj.js} +2 -2
- package/dist/assets/{ComputerPanel-B0QyKQkF.js.map → ComputerPanel-D_wWUzlj.js.map} +1 -1
- package/dist/assets/{ComputerViewerView-CaOkTXpc.js → ComputerViewerView-C2nS7MWX.js} +2 -2
- package/dist/assets/{ComputerViewerView-CaOkTXpc.js.map → ComputerViewerView-C2nS7MWX.js.map} +1 -1
- package/dist/assets/{ConversationsView-CYNc59hv.js → ConversationsView-D5KvMs7J.js} +2 -2
- package/dist/assets/{ConversationsView-CYNc59hv.js.map → ConversationsView-D5KvMs7J.js.map} +1 -1
- package/dist/assets/{FilesView-CluNyIk8.js → FilesView-xOEZGSrD.js} +2 -2
- package/dist/assets/{FilesView-CluNyIk8.js.map → FilesView-xOEZGSrD.js.map} +1 -1
- package/dist/assets/{FloatingResourceSearch-Bg5rUZMy.js → FloatingResourceSearch-D5XwWF0V.js} +2 -2
- package/dist/assets/{FloatingResourceSearch-Bg5rUZMy.js.map → FloatingResourceSearch-D5XwWF0V.js.map} +1 -1
- package/dist/assets/{HistoryView-DSbSDzsB.js → HistoryView-CnUN9Qik.js} +2 -2
- package/dist/assets/{HistoryView-DSbSDzsB.js.map → HistoryView-CnUN9Qik.js.map} +1 -1
- package/dist/assets/{KanbanView-D5AdRwqi.js → KanbanView-DXJCj1E6.js} +2 -2
- package/dist/assets/{KanbanView-D5AdRwqi.js.map → KanbanView-DXJCj1E6.js.map} +1 -1
- package/dist/assets/{LocalVmSettingsPanel-BILcGHmu.js → LocalVmSettingsPanel-8wF6wA3P.js} +2 -2
- package/dist/assets/{LocalVmSettingsPanel-BILcGHmu.js.map → LocalVmSettingsPanel-8wF6wA3P.js.map} +1 -1
- package/dist/assets/{RunnerSettingsPanel-IHLAFIh8.js → RunnerSettingsPanel-DDEMgUS9.js} +2 -2
- package/dist/assets/{RunnerSettingsPanel-IHLAFIh8.js.map → RunnerSettingsPanel-DDEMgUS9.js.map} +1 -1
- package/dist/assets/{StandaloneDialog-DdcL_wV2.js → StandaloneDialog-BN6RJ3uh.js} +2 -2
- package/dist/assets/{StandaloneDialog-DdcL_wV2.js.map → StandaloneDialog-BN6RJ3uh.js.map} +1 -1
- package/dist/assets/{UpdateCheckDialog-CJQezkXo.js → UpdateCheckDialog-CZ6NZSkP.js} +2 -2
- package/dist/assets/{UpdateCheckDialog-CJQezkXo.js.map → UpdateCheckDialog-CZ6NZSkP.js.map} +1 -1
- package/dist/assets/{WorkspaceKnowledgePanel-DS0kOQgg.js → WorkspaceKnowledgePanel-BA7yVvWK.js} +2 -2
- package/dist/assets/{WorkspaceKnowledgePanel-DS0kOQgg.js.map → WorkspaceKnowledgePanel-BA7yVvWK.js.map} +1 -1
- package/dist/assets/{WorkspaceRoutinesPanel-DpVAtnDX.js → WorkspaceRoutinesPanel-DgCqaACO.js} +2 -2
- package/dist/assets/{WorkspaceRoutinesPanel-DpVAtnDX.js.map → WorkspaceRoutinesPanel-DgCqaACO.js.map} +1 -1
- package/dist/assets/{WorkspaceShell-Bykfy3AR.js → WorkspaceShell-DQZKvx2p.js} +4 -4
- package/dist/assets/{WorkspaceShell-Bykfy3AR.js.map → WorkspaceShell-DQZKvx2p.js.map} +1 -1
- package/dist/assets/{WorkspaceView-Cco3Umfn.js → WorkspaceView-jMPyO8oT.js} +2 -2
- package/dist/assets/{WorkspaceView-Cco3Umfn.js.map → WorkspaceView-jMPyO8oT.js.map} +1 -1
- package/dist/assets/{docx-preview-C6qrP-g2.js → docx-preview-Ba7Ciq-i.js} +2 -2
- package/dist/assets/{docx-preview-C6qrP-g2.js.map → docx-preview-Ba7Ciq-i.js.map} +1 -1
- package/dist/assets/{index-CEqMqiJr.js → index-dvKMU4Xy.js} +3 -3
- package/dist/assets/{index-CEqMqiJr.js.map → index-dvKMU4Xy.js.map} +1 -1
- package/dist/assets/{pdf-G3DUsfMb.js → pdf-C3k8l1DI.js} +2 -2
- package/dist/assets/{pdf-G3DUsfMb.js.map → pdf-C3k8l1DI.js.map} +1 -1
- package/dist/assets/{sessionOwnership-DMfBRINe.js → sessionOwnership-HZsbONG-.js} +2 -2
- package/dist/assets/{sessionOwnership-DMfBRINe.js.map → sessionOwnership-HZsbONG-.js.map} +1 -1
- package/dist/assets/{viewModels-DfaKvI0x.js → viewModels-OLQqqyt3.js} +4 -4
- package/dist/assets/{viewModels-DfaKvI0x.js.map → viewModels-OLQqqyt3.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/runner/agent.js +13 -2
- package/dist-server/runner/hermes-bots-bridge/README.md +4 -2
- package/dist-server/runner/hermes-bots-bridge/bridge_runtime.py +21 -2
- package/dist-server/runner/hermes-bots-bridge/plugin.yaml +1 -1
- package/dist-server/runner/worker/gateway.js +52 -22
- package/dist-server/runner/worker/profileSession.js +2 -12
- package/dist-server/server/chatTranscriptApi.js +2 -2
- package/dist-server/server/desktopEnvironments.js +2 -2
- package/dist-server/server/hermesRuntimeEnvironment.js +14 -0
- package/dist-server/server/openVikingMemoryProvider.js +29 -10
- package/dist-server/server/openVikingService.js +44 -14
- package/dist-server/server/realtimeApi.js +11 -2
- package/dist-server/server/realtimeBroker.js +1 -1
- package/dist-server/server/realtimeReceipts.js +39 -8
- package/dist-server/server/runnerHub.js +3 -3
- package/dist-server/server/sessionStop.js +19 -0
- package/dist-server/server/taskCoordinator.js +3 -1
- package/dist-server/server/workspaceAssets.js +54 -11
- package/dist-server/server/workspaceEnvironment.js +1 -0
- package/dist-server/server/workspaceMemorySynthesis.js +5 -1
- package/dist-server/server/workspacePrompt.js +5 -1
- package/dist-server/server/workspaceRoutes.js +25 -20
- package/dist-server/server/workspaceRuntime.js +71 -6
- package/dist-server/server/workspaceScheduler.js +5 -1
- package/dist-server/server/workspaceStore.js +21 -4
- package/dist-server/server/workspaceSync.js +4 -1
- package/dist-server/shared/botEnvironment.js +3 -3
- package/package.json +5 -4
- package/release.json +3 -3
- package/dist/assets/AboutDialog-fbm5CG09.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./WorkspaceShell-
|
|
2
|
-
//# sourceMappingURL=FilesView-
|
|
1
|
+
import{o as e}from"./WorkspaceShell-DQZKvx2p.js";import{A as t,F as n,H as r,L as i,M as a,W as o,_ as s,at as c,ct as l,d as u,et as d,g as f,h as p,l as m,m as h,nt as g,ot as _,p as v,st as y,t as b,u as x,v as S,x as C,y as w}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as T,B as E,F as D,L as O,P as k,U as A,V as j,Y as M,nt as N,o as P,p as F,z as I}from"./index-dvKMU4Xy.js";import{_ as L,g as R,i as z,p as B,r as V}from"./viewModels-OLQqqyt3.js";import{t as H}from"./WorkspaceView-jMPyO8oT.js";var U={class:`library-scroll`},W={key:0,class:`library-skeleton`},G={key:2,class:`library-grid`},K=[`onClick`,`onKeydown`],q=[`src`,`alt`],J=[`src`],Y={key:2},X={class:`library-thumb__actions`},Z=[`onClick`],Q=[`onClick`],$={class:`library-copy`},ee=[`title`],te=[`disabled`],ne=b(C({__name:`LibraryGrid`,props:{items:{},selectedId:{default:``},loading:{type:Boolean,default:!1},hasMore:{type:Boolean,default:!1},emptyTitle:{default:`暂无文件`},emptyDescription:{default:`这里会显示来自 Hermes 的文件。`},kind:{default:`files`}},emits:[`select`,`loadMore`,`addToComposer`,`source`],setup(t,{emit:r}){let a=r;function o(e){return e.kind===`document`||e.kind===`pdf`||e.kind===`code`||e.kind===`text`?`file`:e.kind}function c(e){return{image:`图片`,video:`视频`,audio:`音频`,pdf:`文档`,document:`文档`,code:`文档`,text:`文档`,link:`网页`,file:`其他`}[e.kind]}function d(e){return e===void 0?``:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function g(e){if(!e)return``;let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`}).format(t)}return(r,v)=>(n(),s(`div`,U,[t.loading&&!t.items.length?(n(),s(`div`,W,[(n(),s(u,null,i(10,e=>h(`i`,{key:e,style:y({opacity:.95-e*.04})},null,4)),64))])):t.items.length?(n(),s(`div`,G,[(n(!0),s(u,null,i(t.items,e=>(n(),s(`article`,{key:e.id,class:_({selected:e.id===t.selectedId}),tabindex:`0`,onClick:t=>a(`select`,e),onKeydown:m(t=>a(`select`,e),[`enter`])},[h(`div`,{class:_([`library-thumb`,`library-thumb--${e.kind}`])},[e.kind===`image`&&e.previewUrl?(n(),s(`img`,{key:0,src:e.previewUrl,alt:e.name,loading:`lazy`},null,8,q)):e.kind===`video`&&e.previewUrl?(n(),s(`video`,{key:1,src:e.previewUrl,muted:``,preload:`metadata`},null,8,J)):(n(),s(`span`,Y,[w(M,{name:o(e),size:36},null,8,[`name`]),h(`em`,null,l(e.name.split(`.`).at(-1)?.slice(0,5).toUpperCase())+` · `+l(c(e)),1)])),h(`div`,X,[h(`button`,{type:`button`,title:`加入输入框`,"aria-label":`加入输入框`,onClick:x(t=>a(`addToComposer`,e),[`stop`])},[w(M,{name:`plus`,size:14})],8,Z),e.sourceSessionId?(n(),s(`button`,{key:0,type:`button`,title:`查看来源`,"aria-label":`查看来源`,onClick:x(t=>a(`source`,e),[`stop`])},[w(M,{name:`external`,size:14})],8,Q)):f(``,!0)])],2),h(`div`,$,[h(`strong`,{title:e.name},l(e.title||e.name),9,ee),h(`span`,null,[h(`small`,null,l(e.sourceLabel||d(e.size)||e.kind),1),h(`time`,null,l(g(e.updatedAt||e.createdAt)),1)])])],42,K))),128))])):(n(),p(e,{key:1,icon:t.kind===`files`?`files`:`artifacts`,title:t.emptyTitle,description:t.emptyDescription},null,8,[`icon`,`title`,`description`])),t.hasMore?(n(),s(`button`,{key:3,class:`load-more`,type:`button`,disabled:t.loading,onClick:v[0]||=e=>a(`loadMore`)},l(t.loading?`加载中…`:`加载更多`),9,te)):f(``,!0)]))}}),[[`__scopeId`,`data-v-36fcc00e`]]);async function re(e={}){let t=e.kind===`image`||e.kind===`video`?e.kind:void 0,n=O(await k(D(`/api/app/files`,{search:e.search,kind:t,profile:e.profile,conversationOnly:e.conversationOnly||void 0,cursor:e.cursor,limit:Math.max(1,Math.min(100,e.limit??50))}))),r=j(n),i=typeof r.profile==`string`?r.profile:e.profile;return{items:A(r.items??r.files??n).map(e=>I(e,i)).filter(e=>e.id),nextCursor:typeof r.nextCursor==`string`?r.nextCursor:typeof r.next_cursor==`string`?r.next_cursor:null,total:E(r.total)||void 0}}var ie=N(`files`,()=>{let e=F(),t=g([]),n=d(),i=d(!0),a=d(!1),o=d(),s=d(``),c=d(`all`),l=d(),u=new Set,f=0,p=v(()=>t.value.filter(e=>c.value===`all`||e.kind===c.value));async function m(e=!0){if(a.value&&!e)return;let r=++f;if(e)t.value=[],n.value=void 0,i.value=!0,u.clear();else if(!i.value)return;a.value=!0,o.value=void 0;try{let a=new Map(t.value.map(e=>[e.id,e])),d=e?void 0:n.value,p=0;for(;p<20;){let e=d??`<first-page>`;if(u.has(e)){i.value=!1,o.value=`文件分页返回了重复游标,已停止加载`;break}u.add(e);let t=await re({search:s.value.trim()||void 0,kind:c.value,profile:l.value,cursor:d,limit:50});if(r!==f)return;for(let e of t.items)a.set(e.id,e);p+=1,d=t.nextCursor??void 0,n.value=d,i.value=!!d;let m=[...a.values()].filter(e=>c.value===`all`||e.kind===c.value).length;if(!d||c.value===`all`||m>=50)break}t.value=[...a.values()]}catch(e){r===f&&(o.value=e instanceof Error?e.message:`文件库加载失败`)}finally{r===f&&(a.value=!1)}}return r(()=>e.user?.id,()=>{f+=1,t.value=[],l.value=void 0,n.value=void 0,u.clear(),a.value=!1,o.value=void 0},{flush:`sync`}),{items:t,filteredItems:p,nextCursor:n,hasMore:i,isLoading:a,error:o,query:s,kindFilter:c,profile:l,load:m,reset:()=>m(!0),loadMore:()=>m(!1)}}),ae={class:`library-workspace`},oe={class:`library-header`},se={class:`file-search`},ce=[`value`],le={class:`file-tabs`,"aria-label":`文件类型筛选`},ue=[`onClick`],de={key:0},fe={class:`file-tabs__status`},pe={key:0,class:`error`},me={key:1},he=[`disabled`],ge=b(C({__name:`FilesView`,setup(e){let m=ie(),g=F(),y=P(),b=T(),x=d(null),C=d(null),E=d(``),D,O=v(()=>m.filteredItems.map(V)),k=v(()=>O.value.filter(e=>e.kind===`image`||e.kind===`video`).map(e=>({url:e.previewUrl||e.downloadUrl||``,name:e.name,type:e.kind})).filter(e=>e.url)),A=v(()=>new Map(g.profiles.map(e=>[e.name,e.agentName||e.displayName||e.name]))),j=v(()=>y.sessions.filter(e=>![`cron`,`ios_group`].includes(e.source)).filter(e=>!E.value.trim()||`${e.title} ${e.preview||``}`.toLocaleLowerCase().includes(E.value.trim().toLocaleLowerCase())).map(e=>z(e,y.unreadCounts[e.id]??0,A.value.get(e.profile||g.activeProfile?.name||``)))),N=v(()=>{let e=e=>m.items.filter(t=>t.kind===e).length;return[{id:`all`,label:`全部`,count:m.items.length,icon:`files`},{id:`image`,label:`图片`,count:e(`image`),icon:`image`},{id:`video`,label:`视频`,count:e(`video`),icon:`video`},{id:`audio`,label:`音频`,count:e(`audio`),icon:`audio`},{id:`document`,label:`文档`,count:e(`document`),icon:`file`},{id:`other`,label:`其他`,count:e(`other`),icon:`file`}]});function I(e){m.query=e,window.clearTimeout(D),D=window.setTimeout(()=>void m.load(!0),260)}function U(e){m.kindFilter=e,m.load(!0)}async function W(e){if(e.sourceWorkspaceConversationId){await b.push(`/conversations/${encodeURIComponent(e.sourceWorkspaceConversationId)}`);return}e.sourceSessionId&&(e.sourceProfile&&g.profiles.some(t=>t.name===e.sourceProfile)&&g.selectProfile(e.sourceProfile),await b.push({path:`/chat/${encodeURIComponent(e.sourceSessionId)}`,query:{...e.sourceMessageId?{message:e.sourceMessageId}:{},...e.sourceProfile?{profile:e.sourceProfile}:{}}}))}function G(e){if(e.kind===`image`||e.kind===`video`){let t=k.value.findIndex(t=>t.url===(e.previewUrl||e.downloadUrl));C.value=t>=0?t:null;return}x.value=e}async function K(e){let t=y.sessions.find(t=>t.id===e)?.profile||g.activeProfile?.name;await b.push({path:`/chat/${encodeURIComponent(e)}`,query:t?{profile:t}:{}})}return a(()=>{m.profile=void 0,m.load(!0),y.loadSessions(g.activeProfile?.name),y.loadUnread(g.activeProfile?.name)}),t(()=>window.clearTimeout(D)),r(()=>m.items,()=>{x.value&&!m.items.some(e=>e.id===x.value?.id)&&(x.value=null)}),r(()=>g.activeProfile?.name,e=>{x.value=null,m.profile=e,m.load(!0),y.loadSessions(e),y.loadUnread(e)}),(e,t)=>(n(),s(u,null,[w(H,{"sidebar-title":`历史记录`,"sidebar-subtitle":`${c(y).sessions.length} 个会话`},{sidebar:o(()=>[w(B,{items:j.value,"active-id":c(y).activeSessionId,loading:c(y).isLoading,search:E.value,"single-line":``,"search-placeholder":`搜索会话`,"empty-title":`还没有会话`,"empty-description":`原生 Hermes 会话会在这里以只读历史显示。`,onSearch:t[0]||=e=>E.value=e,onSelect:K},null,8,[`items`,`active-id`,`loading`,`search`])]),default:o(()=>[h(`section`,ae,[h(`header`,oe,[h(`div`,null,[t[5]||=h(`h2`,null,`文件库`,-1),h(`span`,null,[w(M,{name:`files`,size:15}),S(l(O.value.length),1)])]),h(`label`,se,[w(M,{name:`search`,size:15}),h(`input`,{value:c(m).query,type:`search`,placeholder:`搜索文件名、路径或会话`,onInput:t[1]||=e=>I(e.target.value)},null,40,ce)])]),h(`nav`,le,[(n(!0),s(u,null,i(N.value,e=>(n(),s(`button`,{key:e.id,type:`button`,class:_({active:e.id===c(m).kindFilter}),onClick:t=>U(e.id)},[S(l(e.label),1),e.count===void 0?f(``,!0):(n(),s(`small`,de,l(e.count),1))],10,ue))),128)),h(`div`,fe,[c(m).error?(n(),s(`span`,pe,[w(M,{name:`alert`,size:13}),S(l(c(m).error),1)])):(n(),s(`span`,me,l(c(m).nextCursor?`还有更多文件可加载`:O.value.length?`已同步到最新`:``),1)),h(`button`,{class:`icon-button`,type:`button`,"aria-label":`刷新文件库`,title:`刷新文件库`,disabled:c(m).isLoading,onClick:t[2]||=e=>c(m).load(!0)},[w(M,{name:`refresh`,size:15})],8,he)])]),w(ne,{items:O.value,"selected-id":x.value?.id,loading:c(m).isLoading,"has-more":c(m).hasMore,"empty-title":`文件库还是空的`,"empty-description":`聊天中的图片、文档和附件会出现在这里。`,onSelect:G,onLoadMore:c(m).loadMore,onSource:W},null,8,[`items`,`selected-id`,`loading`,`has-more`,`onLoadMore`])])]),_:1},8,[`sidebar-subtitle`]),x.value?(n(),p(L,{key:0,item:x.value,items:O.value,"can-add-to-composer":!1,onClose:t[3]||=e=>x.value=null,onSource:W},null,8,[`item`,`items`])):f(``,!0),w(R,{modelValue:C.value,"onUpdate:modelValue":t[4]||=e=>C.value=e,images:k.value,"can-add":!1},null,8,[`modelValue`,`images`])],64))}}),[[`__scopeId`,`data-v-dc0c445f`]]);export{ge as default};
|
|
2
|
+
//# sourceMappingURL=FilesView-xOEZGSrD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesView-CluNyIk8.js","names":[],"sources":["../../src/client/components/library/LibraryGrid.vue","../../src/client/components/library/LibraryGrid.vue","../../src/client/api/files.ts","../../src/client/stores/files.ts","../../src/client/views/FilesView.vue","../../src/client/views/FilesView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","import type { FileKind, FileLibraryPage } from '@shared/types'\nimport { apiRequest, apiUrl, unwrapData } from './client'\nimport { normalizeFile, number, record, values } from '@/utils/normalize'\n\nexport interface FileQuery {\n search?: string\n kind?: FileKind | 'all'\n profile?: string\n conversationOnly?: boolean\n cursor?: string\n limit?: number\n}\n\nexport async function getFiles(query: FileQuery = {}): Promise<FileLibraryPage> {\n const serverKind = query.kind === 'image' || query.kind === 'video' ? query.kind : undefined\n const payload = unwrapData(await apiRequest<unknown>(apiUrl('/api/app/files', {\n search: query.search,\n kind: serverKind,\n profile: query.profile,\n conversationOnly: query.conversationOnly || undefined,\n cursor: query.cursor,\n limit: Math.max(1, Math.min(100, query.limit ?? 50)),\n })))\n const source = record(payload)\n const responseProfile = typeof source.profile === 'string' ? source.profile : query.profile\n return {\n items: values(source.items ?? source.files ?? payload)\n .map(item => normalizeFile(item, responseProfile)).filter(file => file.id),\n nextCursor: typeof source.nextCursor === 'string' ? source.nextCursor : typeof source.next_cursor === 'string' ? source.next_cursor : null,\n total: number(source.total) || undefined,\n }\n}\n\nexport function fileDownloadUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/download`, { profile })\n}\n\nexport function filePreviewUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/preview`, { profile })\n}\n","import { computed, ref, shallowRef, watch } from 'vue'\nimport { defineStore } from 'pinia'\nimport type { FileKind, FileLibraryItem } from '@shared/types'\nimport { getFiles } from '@/api/files'\nimport { useAuthStore } from './auth'\n\nexport const useFilesStore = defineStore('files', () => {\n const auth = useAuthStore()\n const items = shallowRef<FileLibraryItem[]>([])\n const nextCursor = ref<string>()\n const hasMore = ref(true)\n const isLoading = ref(false)\n const error = ref<string>()\n const query = ref('')\n const kindFilter = ref<FileKind | 'all'>('all')\n const profile = ref<string>()\n const visitedCursors = new Set<string>()\n let loadGeneration = 0\n\n const filteredItems = computed<FileLibraryItem[]>(() => items.value.filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value))\n\n async function load(reset = true): Promise<void> {\n if (isLoading.value && !reset) return\n const generation = ++loadGeneration\n if (reset) {\n items.value = []\n nextCursor.value = undefined\n hasMore.value = true\n visitedCursors.clear()\n } else if (!hasMore.value) return\n isLoading.value = true\n error.value = undefined\n try {\n const existing = new Map(items.value.map(item => [item.id, item]))\n let cursor = reset ? undefined : nextCursor.value\n let pages = 0\n while (pages < 20) {\n const cursorKey = cursor ?? '<first-page>'\n if (visitedCursors.has(cursorKey)) {\n hasMore.value = false\n error.value = '文件分页返回了重复游标,已停止加载'\n break\n }\n visitedCursors.add(cursorKey)\n const page = await getFiles({\n search: query.value.trim() || undefined,\n kind: kindFilter.value,\n profile: profile.value,\n cursor,\n limit: 50,\n })\n if (generation !== loadGeneration) return\n for (const item of page.items) existing.set(item.id, item)\n pages += 1\n cursor = page.nextCursor ?? undefined\n nextCursor.value = cursor\n hasMore.value = Boolean(cursor)\n const matching = [...existing.values()].filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value).length\n if (!cursor || kindFilter.value === 'all' || matching >= 50) break\n }\n items.value = [...existing.values()]\n } catch (cause) {\n if (generation === loadGeneration) error.value = cause instanceof Error ? cause.message : '文件库加载失败'\n } finally {\n if (generation === loadGeneration) isLoading.value = false\n }\n }\n\n const reset = () => load(true)\n watch(() => auth.user?.id, () => {\n loadGeneration += 1\n items.value = []\n profile.value = undefined\n nextCursor.value = undefined\n visitedCursors.clear()\n isLoading.value = false\n error.value = undefined\n }, { flush: 'sync' })\n const loadMore = () => load(false)\n return { items, filteredItems, nextCursor, hasMore, isLoading, error, query, kindFilter, profile, load, reset, loadMore }\n})\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n"],"mappings":"4kCAiBA,IAAM,EAAO,EAOb,SAAS,EAAQ,EAAqB,CAEpC,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,MAAM,QAAS,SAAU,EAAA,CAAA,CAAK,CAAC,UAAY,QAAK,AAAA,EAAA,KAAA,GAAE,EAAA,CAAA,CAAK,CAAC,KAAI,EAAA,CAAQ,EAAA,CAAA,EAAqC,EAAA,CAA5B,KAAK,UAAW,KAAM,gBAE1X,EAUE,GAAA,CATC,MAAO,EAAA,MACP,cAAa,EAAA,OAAU,GACvB,QAAS,EAAA,CAAA,CAAK,CAAC,UACf,WAAU,EAAA,CAAA,CAAK,CAAC,QACjB,cAAY,UACZ,oBAAkB,sBACjB,SAAQ,EACR,WAAW,EAAA,CAAA,CAAK,CAAC,SACjB,SAAQ,sGAIK,EAAA,OAApB,EAAA,EAAA,EAA2I,EAAA,OAA5G,KAAM,EAAA,MAAW,MAAO,EAAA,MAAQ,sBAAqB,GAAQ,QAAK,AAAA,EAAA,KAAA,GAAE,EAAA,MAAQ,KAAU,SAAQ,sCAC7H,EAAsF,EAAA,CAAvD,WAAA,EAAA,MAAA,sBAAA,AAAA,EAAA,KAAA,GAAA,EAAU,MAAA,EAAG,OAAQ,EAAA,MAAgB,UAAS"}
|
|
1
|
+
{"version":3,"file":"FilesView-xOEZGSrD.js","names":[],"sources":["../../src/client/components/library/LibraryGrid.vue","../../src/client/components/library/LibraryGrid.vue","../../src/client/api/files.ts","../../src/client/stores/files.ts","../../src/client/views/FilesView.vue","../../src/client/views/FilesView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","import type { FileKind, FileLibraryPage } from '@shared/types'\nimport { apiRequest, apiUrl, unwrapData } from './client'\nimport { normalizeFile, number, record, values } from '@/utils/normalize'\n\nexport interface FileQuery {\n search?: string\n kind?: FileKind | 'all'\n profile?: string\n conversationOnly?: boolean\n cursor?: string\n limit?: number\n}\n\nexport async function getFiles(query: FileQuery = {}): Promise<FileLibraryPage> {\n const serverKind = query.kind === 'image' || query.kind === 'video' ? query.kind : undefined\n const payload = unwrapData(await apiRequest<unknown>(apiUrl('/api/app/files', {\n search: query.search,\n kind: serverKind,\n profile: query.profile,\n conversationOnly: query.conversationOnly || undefined,\n cursor: query.cursor,\n limit: Math.max(1, Math.min(100, query.limit ?? 50)),\n })))\n const source = record(payload)\n const responseProfile = typeof source.profile === 'string' ? source.profile : query.profile\n return {\n items: values(source.items ?? source.files ?? payload)\n .map(item => normalizeFile(item, responseProfile)).filter(file => file.id),\n nextCursor: typeof source.nextCursor === 'string' ? source.nextCursor : typeof source.next_cursor === 'string' ? source.next_cursor : null,\n total: number(source.total) || undefined,\n }\n}\n\nexport function fileDownloadUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/download`, { profile })\n}\n\nexport function filePreviewUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/preview`, { profile })\n}\n","import { computed, ref, shallowRef, watch } from 'vue'\nimport { defineStore } from 'pinia'\nimport type { FileKind, FileLibraryItem } from '@shared/types'\nimport { getFiles } from '@/api/files'\nimport { useAuthStore } from './auth'\n\nexport const useFilesStore = defineStore('files', () => {\n const auth = useAuthStore()\n const items = shallowRef<FileLibraryItem[]>([])\n const nextCursor = ref<string>()\n const hasMore = ref(true)\n const isLoading = ref(false)\n const error = ref<string>()\n const query = ref('')\n const kindFilter = ref<FileKind | 'all'>('all')\n const profile = ref<string>()\n const visitedCursors = new Set<string>()\n let loadGeneration = 0\n\n const filteredItems = computed<FileLibraryItem[]>(() => items.value.filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value))\n\n async function load(reset = true): Promise<void> {\n if (isLoading.value && !reset) return\n const generation = ++loadGeneration\n if (reset) {\n items.value = []\n nextCursor.value = undefined\n hasMore.value = true\n visitedCursors.clear()\n } else if (!hasMore.value) return\n isLoading.value = true\n error.value = undefined\n try {\n const existing = new Map(items.value.map(item => [item.id, item]))\n let cursor = reset ? undefined : nextCursor.value\n let pages = 0\n while (pages < 20) {\n const cursorKey = cursor ?? '<first-page>'\n if (visitedCursors.has(cursorKey)) {\n hasMore.value = false\n error.value = '文件分页返回了重复游标,已停止加载'\n break\n }\n visitedCursors.add(cursorKey)\n const page = await getFiles({\n search: query.value.trim() || undefined,\n kind: kindFilter.value,\n profile: profile.value,\n cursor,\n limit: 50,\n })\n if (generation !== loadGeneration) return\n for (const item of page.items) existing.set(item.id, item)\n pages += 1\n cursor = page.nextCursor ?? undefined\n nextCursor.value = cursor\n hasMore.value = Boolean(cursor)\n const matching = [...existing.values()].filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value).length\n if (!cursor || kindFilter.value === 'all' || matching >= 50) break\n }\n items.value = [...existing.values()]\n } catch (cause) {\n if (generation === loadGeneration) error.value = cause instanceof Error ? cause.message : '文件库加载失败'\n } finally {\n if (generation === loadGeneration) isLoading.value = false\n }\n }\n\n const reset = () => load(true)\n watch(() => auth.user?.id, () => {\n loadGeneration += 1\n items.value = []\n profile.value = undefined\n nextCursor.value = undefined\n visitedCursors.clear()\n isLoading.value = false\n error.value = undefined\n }, { flush: 'sync' })\n const loadMore = () => load(false)\n return { items, filteredItems, nextCursor, hasMore, isLoading, error, query, kindFilter, profile, load, reset, loadMore }\n})\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n"],"mappings":"4kCAiBA,IAAM,EAAO,EAOb,SAAS,EAAQ,EAAqB,CAEpC,OADI,EAAK,OAAS,YAAc,EAAK,OAAS,OAAS,EAAK,OAAS,QAAU,EAAK,OAAS,OAAe,OACrG,EAAK,IACd,CAEA,SAAS,EAAU,EAAqB,CACtC,MAAQ,CAAE,MAAO,KAAM,MAAO,KAAM,MAAO,KAAM,IAAK,KAAM,SAAU,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,IAAK,EAAY,EAAK,KAC9I,CAEA,SAAS,EAAW,EAAe,CAIjC,OAHI,IAAS,IAAA,GAAkB,GAC3B,EAAO,KAAa,GAAG,EAAK,IAC5B,EAAO,QAAoB,IAAI,EAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,KACpD,IAAI,EAAO,KAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,IAC5C,CAEA,SAAS,EAAW,EAAgC,CAClD,GAAI,CAAC,EAAO,MAAO,GACnB,IAAM,EAAO,aAAiB,KAAO,EAAQ,IAAI,KAAK,CAAK,EAE3D,OADI,OAAO,MAAM,EAAK,QAAQ,CAAC,EAAU,GAClC,IAAI,KAAK,eAAe,QAAS,CAAE,MAAO,QAAS,IAAK,SAAU,CAAC,CAAC,CAAC,OAAO,CAAI,CACz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D5XwWF0V.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,D as t,F as n,G as r,H as i,L as a,M as o,R as s,W as c,_ as l,a as u,at as d,ct as f,d as p,et as m,f as h,g,h as _,l as v,m as y,n as b,ot as x,p as S,s as ee,st as C,t as w,u as T,v as E,x as D,y as O}from"./_plugin-vue_export-helper-CscYwSBt.js";import{K as k,Y as A,i as j,k as te,r as M}from"./index-
|
|
1
|
+
import{A as e,D as t,F as n,G as r,H as i,L as a,M as o,R as s,W as c,_ as l,a as u,at as d,ct as f,d as p,et as m,f as h,g,h as _,l as v,m as y,n as b,ot as x,p as S,s as ee,st as C,t as w,u as T,v as E,x as D,y as O}from"./_plugin-vue_export-helper-CscYwSBt.js";import{K as k,Y as A,i as j,k as te,r as M}from"./index-dvKMU4Xy.js";import{S as N,b as P,h as F,y as I}from"./viewModels-OLQqqyt3.js";var ne={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 24 24`},L=D({name:`At`,render:function(e,t){return n(),l(`svg`,ne,t[0]||=[y(`g`,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[y(`circle`,{cx:`12`,cy:`12`,r:`4`}),y(`path`,{d:`M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28`})],-1)])}}),R={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 24 24`},re=D({name:`Target`,render:function(e,t){return n(),l(`svg`,R,t[0]||=[y(`g`,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[y(`circle`,{cx:`12`,cy:`12`,r:`1`}),y(`circle`,{cx:`12`,cy:`12`,r:`5`}),y(`circle`,{cx:`12`,cy:`12`,r:`9`})],-1)])}}),ie={class:`composer-area`},z={key:0,class:`composer-attachments`,"aria-label":`附件`},ae=[`src`,`alt`],oe=[`aria-label`,`onClick`],se={key:1,class:`composer-reference`},ce={key:2,class:`composer-activity-slot`},le={key:0,class:`composer-activity`,role:`status`,"aria-label":`机器人输入状态`,"aria-live":`polite`,"aria-atomic":`true`},ue=[`title`],de=[`disabled`,`placeholder`],fe={class:`composer-toolbar`},pe={class:`composer-tools`},me=[`disabled`,`aria-expanded`],he={key:0,class:`composer-popover composer-add-menu`,role:`menu`,"aria-label":`添加到消息`},ge=[`disabled`],_e=[`disabled`],ve=[`disabled`,`title`],ye=[`disabled`],be={key:3,class:`composer-popover-anchor`},xe=[`disabled`,`title`,`aria-label`,`aria-expanded`],Se={key:0,class:`composer-popover composer-popover--reasoning`,role:`dialog`,"aria-label":`推理强度`},Ce={class:`composer-popover__heading`},we=[`max`,`value`],Te={class:`composer-popover__range`},Ee={key:4,class:`composer-popover-anchor`},De=[`disabled`,`aria-expanded`],Oe={key:0,class:`composer-popover composer-popover--settings`,role:`dialog`,"aria-label":`输入设置`},ke=[`aria-checked`],Ae=[`disabled`],je=[`disabled`,`title`],Me=[`disabled`,`aria-pressed`,`aria-label`],Ne=[`disabled`],Pe={class:`composer-actions`},Fe=[`title`],Ie={key:1,class:`composer-sending`,role:`status`,"aria-live":`polite`},Le={key:2,class:`composer-stop-hitbox`},Re={class:`composer-send-hitbox`},ze=[`disabled`,`aria-label`],Be={key:0,class:`composer-menu`,role:`listbox`},Ve={class:`composer-menu__label`},He=[`aria-selected`,`disabled`,`onMousedown`,`onMouseenter`],Ue={class:`composer-menu__avatar`},We={key:0},Ge={key:0},Ke={key:1,class:`composer-drop-hint`},qe={key:0,class:`composer-error`,role:`alert`},Je=26214400,Ye=8,B=w(D({__name:`ComposerShell`,props:{mode:{default:`chat`},draftKey:{default:``},placeholder:{default:`输入消息,Enter 发送,Shift + Enter 换行`},disabled:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1},stopWhileRunning:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},modelLabel:{default:`选择模型`},fastMode:{type:Boolean,default:!1},fastModeDisabled:{type:Boolean,default:!1},reasoningEffort:{default:`默认`},reasoningValue:{default:``},reasoningOptions:{default:()=>[]},contextUsed:{default:0},contextLimit:{default:0},contextEstimated:{type:Boolean,default:!1},queueMode:{type:Boolean,default:!1},toolTraceVisible:{type:Boolean,default:!0},reference:{default:null},mentionOptions:{default:()=>[]},slashCommands:{default:()=>[]},attachmentsEnabled:{type:Boolean,default:!0},activityText:{default:``},deliveryAvailable:{type:Boolean,default:!1},deliveryMode:{type:Boolean,default:!1},deliveryDisabled:{type:Boolean,default:!1},deliveryDisabledReason:{default:``}},emits:[`send`,`stop`,`modelClick`,`fastModeToggle`,`reasoningChange`,`settingsClick`,`queueToggle`,`toolTraceToggle`,`clearReference`,`error`,`update:deliveryMode`],setup(u,{expose:h,emit:w}){let D=u,k=w,j=m(``),M=m(null),N=m(null),P=m([]),F=m(!1),I=m(0),ne=S(()=>I.value>0),R=m(null),B=m(0),V=m(null),Xe=m(``),H=m([]),U=m(!1),W=m(!1),G=m(!1),K=m(null),Ze=m(null),Qe=S(()=>D.mode===`group`&&(D.mentionOptions.length>0||D.deliveryAvailable)),$e=m(``),et,tt=S(()=>!D.disabled&&!D.sending&&(j.value.trim().length>0||P.value.length>0)),nt=S(()=>D.streaming&&(D.stopWhileRunning||D.mode===`chat`)),q=S(()=>nt.value&&!j.value.trim()&&!P.value.length),rt=S(()=>D.modelLabel.split(`/`).filter(Boolean).at(-1)||D.modelLabel),it=S(()=>D.contextLimit>0?Math.min(100,Math.round(D.contextUsed/D.contextLimit*100)):0),at=S(()=>D.contextLimit>0),ot=S(()=>Math.max(0,D.contextLimit-D.contextUsed)),st=S(()=>Math.max(0,D.reasoningOptions.findIndex(e=>e.id===D.reasoningValue))),J=S(()=>D.reasoningOptions[st.value]?.label||D.reasoningEffort),Y=S(()=>{let e=V.value===`slash`?D.slashCommands:D.mentionOptions,t=Xe.value.trim().toLocaleLowerCase();return e.filter(e=>!t||e.label.toLocaleLowerCase().includes(t)||e.detail?.toLocaleLowerCase().includes(t)).slice(0,10)});function X(e=D.draftKey){return e?`hermes-yaoyao:composer:${D.mode}:${e}`:``}let ct=!1,lt=!1,ut=new Map;i([j,P,H],()=>{if(lt&&!ct){let e=X();ut.set(e,(ut.get(e)??0)+1)}},{deep:!0,flush:`sync`});function dt(){lt=!0;let e=X();return{key:e,revision:ut.get(e)??0}}function ft(){let e=X();ct=!0;try{j.value=e&&localStorage.getItem(e)||``}finally{ct=!1}t(Q)}function pt(e){let t=X();t&&(e?localStorage.setItem(t,e):localStorage.removeItem(t))}function Z(e){$e.value=e,k(`error`,e),window.clearTimeout(et),et=window.setTimeout(()=>{$e.value=``},4500)}function mt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function ht(e){return e.startsWith(`image/`)}function gt(e){if(!D.attachmentsEnabled){Z(`当前上游不支持团队附件`);return}let t=Ye-P.value.length;if(t<=0)return Z(`最多添加 ${Ye} 个文件`);let n=[];for(let r of e.slice(0,t)){if(r.size>Je){Z(`${r.name} 超过 25 MiB`);continue}n.push({id:`${r.name}:${r.size}:${r.lastModified}:${te(`attachment`)}`,file:r,name:r.name,size:r.size,type:r.type||`application/octet-stream`,previewUrl:ht(r.type)?URL.createObjectURL(r):void 0})}P.value.push(...n),e.length>t&&Z(`最多添加 ${Ye} 个文件`)}function _t(e){let t=P.value.findIndex(t=>t.id===e);if(t<0)return;let[n]=P.value.splice(t,1);n?.previewUrl&&URL.revokeObjectURL(n.previewUrl)}function vt(){P.value.forEach(e=>e.previewUrl&&URL.revokeObjectURL(e.previewUrl)),P.value=[],N.value&&(N.value.value=``)}function yt(e){let t=e.target;gt(Array.from(t.files??[])),t.value=``}function bt(e){let t=Array.from(e.clipboardData?.files??[]);t.length&>(t)}function xt(e){e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),I.value+=1)}function St(e){e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))}function Ct(e){e.preventDefault(),I.value=Math.max(0,I.value-1)}function wt(e){e.preventDefault(),I.value=0,gt(Array.from(e.dataTransfer?.files??[]))}function Q(){let e=M.value;!e||R.value!==null||(e.style.height=`auto`,e.style.height=`${Math.min(400,Math.max(30,e.scrollHeight))}px`)}function Tt(){R.value=null,M.value&&(M.value.style.height=`auto`),t(Q)}function Et(e){let t=M.value;if(!t)return;e.preventDefault();let n=e.clientY,r=t.clientHeight,i=e.pointerId,a=e.currentTarget;a.setPointerCapture(i);let o=e=>{R.value=Math.min(400,Math.max(30,r-(e.clientY-n)))},s=()=>{a.removeEventListener(`pointermove`,o),a.removeEventListener(`pointerup`,s),a.removeEventListener(`pointercancel`,s)};a.addEventListener(`pointermove`,o),a.addEventListener(`pointerup`,s),a.addEventListener(`pointercancel`,s)}function Dt(){let e=M.value;if(!e||F.value)return;let t=j.value.slice(0,e.selectionStart);if(t.startsWith(`/`)&&!t.includes(` `)&&!t.includes(`
|
|
2
2
|
`)&&D.slashCommands.length){V.value=`slash`,Xe.value=t.slice(1),B.value=0;return}if(D.mode===`group`&&D.mentionOptions.length){let e=t.match(/(?<![A-Za-z0-9_.%+/@-])@([^\s@]*)$/u);if(e&&!/https?:\/\/\S*$/u.test(t)){V.value=`mention`,Xe.value=e[1]??``,B.value=0;return}}V.value=null}function Ot(){G.value=!G.value,U.value=!1,W.value=!1,V.value=null,G.value&&t(()=>K.value?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus())}function $(e=!1){G.value=!1,e&&Ze.value?.focus()}function kt(e){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),$(!0);else if(e.key===`Tab`)$(!0);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault();let t=Array.from(K.value?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowUp`?-1:1)+t.length)%t.length]?.focus()}}function At(){$(!0),N.value?.click()}function jt(){$();let e=M.value;if(!e)return;let n=e.selectionStart,r=j.value.slice(0,n),i=`${r&&!/\s$/.test(r)?` `:``}@`;j.value=r+i+j.value.slice(e.selectionEnd),t(()=>{e.focus(),e.setSelectionRange(n+i.length,n+i.length),Dt(),Q()})}function Mt(e){D.disabled||D.deliveryDisabled||D.sending||(k(`update:deliveryMode`,e),$(),t(()=>M.value?.focus()))}function Nt(e){if(e.disabled)return;let n=M.value;if(!n)return;let r=n.selectionStart,i=j.value.slice(0,r),a=j.value.slice(r);if(V.value===`slash`){let r=e.insertText??`/${e.label} `;j.value=r+a,t(()=>n.setSelectionRange(r.length,r.length))}else{let o=i.match(/(?<![A-Za-z0-9_.%+/@-])@([^\s@]*)$/u),s=o?r-o[0].length:r,c=j.value.slice(0,s),l=`@${e.label} `;j.value=c+l+a,e.id!==`all`&&!H.value.includes(e.id)&&H.value.push(e.id),t(()=>{let e=c.length+l.length;n.setSelectionRange(e,e)})}V.value=null,t(()=>{n.focus(),Q()})}function Pt(e){if(V.value&&Y.value.length){if(e.key===`ArrowDown`){e.preventDefault(),B.value=(B.value+1)%Y.value.length;return}if(e.key===`ArrowUp`){e.preventDefault(),B.value=(B.value-1+Y.value.length)%Y.value.length;return}if(e.key===`Escape`){e.preventDefault(),V.value=null;return}if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey){e.preventDefault();let t=Y.value[B.value];t&&Nt(t);return}}e.key!==`Enter`||e.shiftKey||F.value||e.isComposing||e.keyCode===229||(e.preventDefault(),It())}function Ft(){requestAnimationFrame(()=>{F.value=!1,Dt()})}function It(){if(!tt.value)return;let e={text:j.value.trim(),files:P.value.map(e=>e.file),mentionIds:[...H.value]};k(`send`,e),t(()=>M.value?.focus())}function Lt(e){if(e){if((ut.get(e.key)??0)!==e.revision)return!1;if(e.key!==X())return e.key&&localStorage.removeItem(e.key),!1}return j.value=``,H.value=[],pt(``),vt(),Tt(),t(()=>M.value?.focus()),!0}function Rt(e){e.target.closest(`button, input, textarea, [role="option"], .composer-resize`)||M.value?.focus()}function zt(e){return e>=1048576?`${(e/1048576).toFixed(1)}m`:e>=1024?`${(e/1024).toFixed(1)}k`:`${e}`}function Bt(e){let t=Number(e.target.value),n=D.reasoningOptions[t];n&&k(`reasoningChange`,n.id)}function Vt(e){let t=e.target;K.value?.contains(t)||$(),t.closest(`.composer-shell`)||(V.value=null,U.value=!1,W.value=!1)}return i(j,e=>{pt(e),t(Q)}),i(()=>D.draftKey,()=>{ft(),U.value=!1,W.value=!1,G.value=!1}),i(()=>D.disabled,e=>{e&&$()}),o(()=>{ft(),document.addEventListener(`pointerdown`,Vt)}),e(()=>{vt(),window.clearTimeout(et),document.removeEventListener(`pointerdown`,Vt)}),h({attachFiles:gt,filesSnapshot:()=>P.value.map(e=>e.file),focus:()=>M.value?.focus(),clearAfterSend:Lt,submissionToken:dt}),(e,t)=>(n(),l(`div`,ie,[P.value.length?(n(),l(`div`,z,[(n(!0),l(p,null,a(P.value,e=>(n(),l(`div`,{key:e.id,class:x([`composer-attachment`,{image:ht(e.type)}])},[e.previewUrl?(n(),l(`img`,{key:0,src:e.previewUrl,alt:e.name},null,8,ae)):(n(),_(A,{key:1,name:`file`,size:19})),y(`span`,null,[y(`strong`,null,f(e.name),1),y(`small`,null,f(mt(e.size)),1)]),y(`button`,{type:`button`,"aria-label":`移除 ${e.name}`,onClick:t=>_t(e.id)},[O(A,{name:`close`,size:12})],8,oe)],2))),128))])):g(``,!0),u.reference?(n(),l(`div`,se,[O(A,{name:`quote`,size:14}),y(`span`,null,[y(`small`,null,f(u.reference.author?`回复 ${u.reference.author}`:`回复消息`),1),y(`strong`,null,f(u.reference.content.replace(/\s+/g,` `).trim()),1)]),y(`button`,{type:`button`,"aria-label":`取消引用`,onClick:t[0]||=e=>k(`clearReference`)},[O(A,{name:`close`,size:13})])])):g(``,!0),u.mode===`group`?(n(),l(`div`,ce,[O(b,{name:`composer-activity`},{default:c(()=>[u.activityText?(n(),l(`div`,le,[t[17]||=y(`span`,{class:`composer-typing-dots`,"aria-hidden":`true`},[y(`i`),y(`i`),y(`i`)],-1),y(`strong`,null,f(u.activityText),1)])):g(``,!0)]),_:1})])):g(``,!0),s(e.$slots,`before-input`,{},void 0,!0),y(`div`,{class:x([`composer-shell`,{"composer-shell--drag":ne.value,"composer-shell--disabled":u.disabled}]),onMousedown:Rt,onDragenter:xt,onDragover:St,onDragleave:Ct,onDrop:wt},[y(`input`,{ref_key:`fileInput`,ref:N,class:`composer-file-input`,type:`file`,multiple:``,onChange:yt},null,544),y(`div`,{class:`composer-resize`,title:`拖动调整高度;双击复位`,onPointerdown:Et,onDblclick:Tt},null,32),at.value?(n(),l(`div`,{key:0,class:x([`composer-context`,{warning:it.value>80}]),title:u.contextEstimated?`Hermes 未提供实时上下文用量;此数值按当前会话内容估算。`:void 0},[y(`span`,null,f(u.contextEstimated?`约 `:``)+f(zt(u.contextUsed))+` / `+f(zt(u.contextLimit))+` · 剩余 `+f(zt(ot.value)),1),y(`i`,null,[y(`b`,{style:C({width:`${it.value}%`})},null,4)])],10,ue)):g(``,!0),r(y(`textarea`,{ref_key:`textarea`,ref:M,"onUpdate:modelValue":t[1]||=e=>j.value=e,class:`composer-textarea`,style:C(R.value===null?void 0:{height:`${R.value}px`}),rows:`1`,disabled:u.disabled,placeholder:u.deliveryAvailable&&u.deliveryMode?`描述希望团队交付的结果…`:u.placeholder,onInput:Dt,onClick:Dt,onKeydown:Pt,onPaste:bt,onCompositionstart:t[2]||=e=>F.value=!0,onCompositionend:Ft},null,44,de),[[ee,j.value]]),y(`div`,fe,[y(`div`,pe,[Qe.value?(n(),l(`div`,{key:0,ref_key:`actionsAnchor`,ref:K,class:`composer-popover-anchor composer-actions-anchor`,onKeydown:kt},[y(`button`,{ref_key:`actionsTrigger`,ref:Ze,class:`composer-tool composer-add`,type:`button`,disabled:u.disabled,"aria-label":`添加`,"aria-haspopup":`menu`,"aria-expanded":G.value,onClick:Ot,onKeydown:t[3]||=v(T(e=>!G.value&&Ot(),[`prevent`]),[`down`])},[O(A,{name:`plus`,size:20})],40,me),O(b,{name:`composer-menu`},{default:c(()=>[G.value?(n(),l(`div`,he,[y(`button`,{type:`button`,role:`menuitem`,disabled:!u.attachmentsEnabled,onClick:At},[O(A,{name:`paperclip`,size:20}),t[18]||=y(`span`,null,`添加附件`,-1)],8,ge),u.mentionOptions.length?(n(),l(`button`,{key:0,type:`button`,role:`menuitem`,onClick:jt},[O(d(L),{class:`composer-action-icon`,"aria-hidden":`true`}),t[19]||=y(`span`,null,`提及成员`,-1)])):g(``,!0),u.deliveryAvailable?(n(),l(p,{key:1},[t[21]||=y(`div`,{class:`composer-add-menu__divider`,role:`separator`},null,-1),y(`button`,{type:`button`,role:`menuitem`,disabled:u.deliveryDisabled||u.sending,onClick:t[4]||=e=>Mt(!u.deliveryMode)},[O(d(re),{class:`composer-action-icon`,"aria-hidden":`true`}),y(`span`,null,[t[20]||=y(`strong`,null,`交付目标`,-1),y(`small`,null,f(u.deliveryDisabledReason||(u.deliveryMode?`已开启;点击返回普通聊天`:`让团队持续完成一个结果`)),1)]),u.deliveryMode?(n(),_(A,{key:0,name:`check`,size:16})):g(``,!0)],8,_e)],64)):g(``,!0)])):g(``,!0)]),_:1})],544)):(n(),l(`button`,{key:1,class:`composer-tool composer-tool--icon`,type:`button`,disabled:u.disabled||!u.attachmentsEnabled,title:u.attachmentsEnabled?`添加附件`:`当前上游不支持附件`,"aria-label":`添加附件`,onClick:t[5]||=e=>N.value?.click()},[O(A,{name:`paperclip`,size:16})],8,ve)),u.deliveryAvailable&&u.deliveryMode?(n(),l(`button`,{key:2,class:`composer-delivery-chip`,type:`button`,disabled:u.disabled||u.deliveryDisabled||u.sending,"aria-label":`关闭交付目标,返回普通聊天`,title:`关闭交付目标,返回普通聊天`,onClick:t[6]||=e=>Mt(!1)},[O(d(re),{class:`composer-action-icon`,"aria-hidden":`true`}),t[22]||=y(`span`,null,`交付目标`,-1),O(A,{name:`close`,size:15})],8,ye)):g(``,!0),u.mode===`chat`?(n(),l(`div`,be,[y(`button`,{class:x([`composer-tool`,{active:U.value}]),type:`button`,disabled:u.disabled||!u.reasoningOptions.length,title:`推理强度:${J.value}`,"aria-label":`推理强度:${J.value}`,"aria-expanded":U.value,onClick:t[7]||=e=>{U.value=!U.value,W.value=!1}},[O(A,{name:`brain`,size:16}),y(`span`,null,f(J.value),1),O(A,{name:`chevron-down`,size:11})],10,xe),O(b,{name:`composer-menu`},{default:c(()=>[U.value?(n(),l(`div`,Se,[y(`div`,Ce,[t[23]||=y(`span`,null,`推理强度`,-1),y(`strong`,null,f(J.value),1)]),y(`input`,{class:`reasoning-slider`,type:`range`,min:0,max:Math.max(0,u.reasoningOptions.length-1),step:`1`,value:st.value,onInput:Bt},null,40,we),y(`div`,Te,[y(`span`,null,f(u.reasoningOptions[0]?.label||`默认`),1),y(`span`,null,f(u.reasoningOptions.at(-1)?.label||`最大`),1)])])):g(``,!0)]),_:1})])):g(``,!0),u.mode===`chat`?(n(),l(`div`,Ee,[y(`button`,{class:x([`composer-tool`,{active:W.value}]),type:`button`,disabled:u.disabled,title:`设置`,"aria-label":`设置`,"aria-expanded":W.value,onClick:t[8]||=e=>{W.value=!W.value,U.value=!1}},[O(A,{name:`settings`,size:16}),t[24]||=y(`span`,null,`设置`,-1),O(A,{name:`chevron-down`,size:11})],10,De),O(b,{name:`composer-menu`},{default:c(()=>[W.value?(n(),l(`div`,Oe,[y(`button`,{class:`composer-setting-row`,type:`button`,role:`switch`,"aria-checked":u.toolTraceVisible,onClick:t[9]||=e=>k(`settingsClick`)},[y(`span`,null,[O(A,{name:`brain`,size:15}),t[25]||=E(`显示思考`,-1)]),u.toolTraceVisible?(n(),_(A,{key:0,name:`check`,size:16})):g(``,!0)],8,ke),y(`button`,{class:`composer-setting-row`,type:`button`,title:`首版暂未启用语音输入`,onClick:t[10]||=e=>Z(`语音输入尚未启用`)},[...t[26]||=[y(`span`,null,`语音输入设置`,-1)]])])):g(``,!0)]),_:1})])):(n(),l(`button`,{key:5,class:x([`composer-tool`,{active:u.toolTraceVisible}]),type:`button`,disabled:u.disabled,title:`显示思考`,onClick:t[11]||=e=>k(`toolTraceToggle`)},[O(A,{name:`brain`,size:16}),t[27]||=y(`span`,null,`思考`,-1)],10,Ae)),u.mode===`chat`?(n(),l(`button`,{key:6,class:`composer-tool composer-tool--model`,type:`button`,disabled:u.disabled,title:u.modelLabel,onClick:t[12]||=e=>k(`modelClick`)},[O(A,{name:`model`,size:15}),y(`span`,null,f(rt.value),1),O(A,{name:`chevron-down`,size:11})],8,je)):g(``,!0),u.mode===`chat`?(n(),l(`button`,{key:7,class:x([`composer-tool composer-tool--icon composer-fast-mode`,{active:u.fastMode}]),type:`button`,disabled:u.disabled||u.fastModeDisabled,"aria-pressed":u.fastMode,"aria-label":`快速模式:${u.fastMode?`已开启`:`已关闭`}`,title:`快速模式:响应更快,消耗更多额度`,onClick:t[13]||=e=>k(`fastModeToggle`,!u.fastMode)},[O(A,{name:`bolt`,size:15})],10,Me)):u.mentionOptions.length?(n(),l(`button`,{key:8,type:`button`,class:`composer-tool composer-mention-hint`,disabled:u.disabled,"aria-label":`提及成员`,onClick:jt},[O(d(L),{class:`composer-action-icon`,"aria-hidden":`true`}),t[28]||=y(`span`,null,`提及成员`,-1)],8,Ne)):g(``,!0)]),y(`div`,Pe,[u.mode===`chat`&&u.streaming&&tt.value?(n(),l(`button`,{key:0,class:x([`queue-toggle`,{active:u.queueMode}]),type:`button`,title:u.queueMode?`消息将排队发送`:`消息将 Steer 当前会话`,onClick:t[14]||=e=>k(`queueToggle`)},f(u.queueMode?`排队`:`Steer`),11,Fe)):g(``,!0),u.sending?(n(),l(`span`,Ie,[...t[29]||=[y(`i`,null,null,-1),E(`正在发送`,-1)]])):g(``,!0),nt.value&&!q.value?(n(),l(`span`,Le,[y(`button`,{class:`composer-stop`,type:`button`,"aria-label":`停止生成`,title:`停止生成`,onClick:t[15]||=e=>k(`stop`)},[O(A,{name:`stop`,size:15})])])):g(``,!0),y(`span`,Re,[y(`button`,{class:x([`composer-send`,{"composer-send--stop":q.value}]),type:`button`,disabled:!q.value&&!tt.value,"aria-label":q.value?`停止生成`:`发送消息`,onClick:t[16]||=e=>q.value?k(`stop`):It()},[O(A,{name:q.value?`stop`:`arrow-up`,size:(q.value,17)},null,8,[`name`,`size`])],10,ze)])])]),O(b,{name:`composer-menu`},{default:c(()=>[V.value&&Y.value.length?(n(),l(`div`,Be,[y(`div`,Ve,f(V.value===`mention`?`提及机器人`:`命令`),1),(n(!0),l(p,null,a(Y.value,(e,t)=>(n(),l(`button`,{key:e.id,type:`button`,role:`option`,"aria-selected":t===B.value,disabled:e.disabled,class:x({active:t===B.value}),onMousedown:T(t=>Nt(e),[`prevent`]),onMouseenter:e=>B.value=t},[y(`span`,Ue,f(V.value===`mention`?e.label.slice(0,1).toUpperCase():`/`),1),y(`span`,null,[y(`strong`,null,f(V.value===`mention`?`@${e.label}`:`/${e.label}`),1),e.detail?(n(),l(`small`,We,f(e.detail),1)):g(``,!0)]),e.disabled?(n(),l(`em`,Ge,`不可用`)):g(``,!0)],42,He))),128))])):g(``,!0)]),_:1}),ne.value?(n(),l(`div`,Ke,[O(A,{name:`paperclip`,size:20}),t[30]||=E(`松开以添加附件`,-1)])):g(``,!0)],34),O(b,{name:`composer-menu`},{default:c(()=>[$e.value?(n(),l(`p`,qe,f($e.value),1)):g(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-272c78f5`]]),V=new Set([`apng`,`avif`,`bmp`,`gif`,`heic`,`heif`,`ico`,`jfif`,`jpeg`,`jpg`,`jxl`,`png`,`svg`,`tif`,`tiff`,`webp`]),Xe=new Set([`avi`,`m4v`,`mkv`,`mov`,`mp4`,`mpeg`,`mpg`,`webm`]);function H(e,t,n=`local:${t}`,r){let i=e.split(`.`).at(-1)?.toLocaleLowerCase()||``,a=V.has(i)?`image`:Xe.has(i)?`video`:[`mp3`,`wav`,`m4a`,`aac`,`ogg`].includes(i)?`audio`:i===`pdf`?`pdf`:[`md`,`markdown`,`txt`,`json`,`yaml`,`yml`,`csv`,`js`,`ts`,`py`,`sh`].includes(i)?`text`:`file`;return{id:n,name:e,kind:r||a,previewUrl:t,downloadUrl:t}}function U(e){try{let t=new URL(e,window.location.origin);return t.origin===window.location.origin&&t.pathname===`/api/files/download`&&(t.searchParams.delete(`_retry`),t.searchParams.sort()),t.origin===window.location.origin&&(t.pathname=t.pathname.replace(/(\/api\/app\/files\/[^/]+)\/(?:preview|download)$/,`$1`)),t.href}catch{return e}}function W(e){try{let t=new URL(e,window.location.origin);return(t.pathname===`/api/files/download`?t.searchParams.get(`path`)||t.pathname:decodeURIComponent(t.pathname)).split(`/`).at(-1)||`媒体`}catch{return`媒体`}}function G(e){let t=[],n=new Set,r=e=>{if(!e.previewUrl||![`image`,`video`].includes(e.kind))return;let r=U(e.previewUrl);n.has(r)||(n.add(r),t.push(e))},i=new N({html:!1}),a=i.validateLink;i.validateLink=e=>!!k(e)||a(e);for(let t of e){if(![`user`,`assistant`].includes(t.role)&&!t.communication)continue;let e=e=>{let n=t.attachments?.find(t=>t.id===e);n?.url&&[`image`,`video`].includes(n.kind||`file`)&&r(H(n.name,n.url,`${t.id}:${n.id}`,n.kind))},n=e=>{if(t.role===`user`)return;let n=P(e,t.status===`streaming`);for(let e of i.parse(n,{}))for(let n of e.children??[]){let e=n.type===`image`?n.attrGet(`src`):n.type===`link_open`?n.attrGet(`href`):null;if(!e)continue;let i=k(e,t.profile)||e,a=t.attachments?.find(e=>e.url&&U(e.url)===U(i));r(H(a?.name||W(i),i,`${t.id}:${i}`,a?.kind))}};if(t.contentParts?.length)for(let r of t.contentParts)`text`in r?n(r.text):e(r.attachmentId);else n(t.content);for(let n of t.attachments??[])e(n.id)}return t}var K={class:`system-message-notice`},Ze=[`href`,`aria-label`],Qe={key:1},$e=[`aria-label`],et={role:`status`},tt={class:`system-message-notice__details`},nt={key:2,class:`system-message-notice__label`,role:`status`},q=w(D({__name:`SystemMessageNotice`,props:{title:{},icon:{},href:{},accessibleLabel:{}},setup(e){return(t,r)=>(n(),l(`div`,K,[e.href?(n(),l(`a`,{key:0,class:`system-message-notice__label`,href:e.href,"aria-label":e.accessibleLabel||e.title},[O(A,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),y(`span`,null,f(e.title),1)],8,Ze)):t.$slots.default?(n(),l(`details`,Qe,[y(`summary`,{class:`system-message-notice__label`,"aria-label":e.accessibleLabel||`${e.title},查看详情`},[O(A,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),y(`span`,et,f(e.title),1)],8,$e),y(`div`,tt,[s(t.$slots,`default`,{},void 0,!0)])])):(n(),l(`div`,nt,[O(A,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),y(`span`,null,f(e.title),1)]))]))}}),[[`__scopeId`,`data-v-fd32abae`]]),rt={key:0,class:`service-warnings`,"aria-label":`服务状态提示`},it=D({__name:`ServiceWarnings`,props:{warnings:{}},setup(e){return(t,r)=>e.warnings.length?(n(),l(`div`,rt,[(n(!0),l(p,null,a(e.warnings,(e,t)=>(n(),_(q,{key:`${e.service}:${e.code}:${t}`,title:`${e.service}:${e.message}`,icon:`info`},null,8,[`title`]))),128))])):g(``,!0)}}),at={key:0},ot=w(D({__name:`MessageFailureNotice`,props:{failure:{}},setup(e){return(t,r)=>(n(),_(q,{class:`failure-notice`,title:e.failure.title,icon:`info`},{default:c(()=>[y(`p`,null,f(e.failure.hint),1),e.failure.detail?(n(),l(`pre`,at,f(e.failure.detail),1)):g(``,!0)]),_:1},8,[`title`]))}}),[[`__scopeId`,`data-v-739155c5`]]),st=/^执行失败[::]\s*/;function J(e){if(e.communication||e.taskReference||e.role===`tool`||e.status!==`failed`&&!e.error?.trim())return;let t=e.content.trim(),n=e.role!==`user`&&e.status===`failed`&&st.test(t),r=e.error?.trim()||(n?t.replace(st,``):``);if(!r&&e.status!==`failed`)return;let i=e.role===`assistant`&&e.status===`failed`&&t.includes(`Provider said:`)&&/didn[’']t respond in time on any of \d+ attempts/.test(t),a=e.role!==`user`&&(n||i||!!r&&t===r||!t),o=[...new Set([a?t.replace(st,``):``,r].filter(Boolean))].filter((e,t,n)=>!n.some((n,r)=>r!==t&&n.includes(e))).join(`
|
|
3
3
|
|
|
4
4
|
`),s=/timeout|timed?\s*out|no SSE events|didn[’']t respond in time|超时/i.test(r||o);return{title:e.role===`user`?`消息未发送`:s?`响应超时`:`回复暂时中断`,hint:e.role===`user`?`请检查连接后重新发送。`:`请稍后重试,或切换模型。`,detail:o,key:r||o,replacesContent:a}}function Y(e){return e.filter((t,n)=>{let r=e[n-1];if(!r||r.role!==`assistant`||t.role!==`system`||!/^执行失败[::]/.test(t.content))return!0;let i=J(t),a=J(r);if(!i?.key||i.key!==a?.key||t.attachments?.length||t.tools?.length||t.reasoning)return!0;if(t.runId&&r.runId)return t.runId!==r.runId;let o=new Date(t.createdAt??``).getTime(),s=new Date(r.createdAt??``).getTime();return!Number.isFinite(o)||!Number.isFinite(s)||o<s||o-s>2e3})}var X=D({__name:`TaskResultNotice`,props:{content:{},taskReference:{}},setup(e){let t=e,r=S(()=>t.content.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!/^\[打开任务\]\(/.test(e))),i=S(()=>t.content.includes(`等待管理员复核`)),a=S(()=>i.value?`任务已有新结果`:t.content.includes(`已完成`)?`任务已完成`:`任务状态已更新`),o=S(()=>{let e=r.value[0]?.match(/^「([^」]+)」的任务「([^」]+)」/);return e?`${e[1]} · ${e[2]}`:r.value[0]||`团队交付任务`}),s=S(()=>i.value?`等待管理员复核后继续`:r.value.slice(1).join(` `)||`打开任务查看完整交付与验收状态`),c=S(()=>`/conversations/${encodeURIComponent(t.taskReference.conversationId)}?taskId=${encodeURIComponent(t.taskReference.taskId)}`);return(e,t)=>(n(),_(q,{class:`task-result-notice`,title:a.value,icon:i.value?`file`:`check`,href:c.value,"accessible-label":`${a.value},${o.value},${s.value},打开任务`},null,8,[`title`,`icon`,`href`,`accessible-label`]))}});function ct(e){if(e.communication||e.role===`user`)return;if(e.timelineKind===`delegation-complete`)return{title:`子任务已完成`,icon:`groups`};if(e.timelineKind===`background-process`){let t=e.timelineMetadata?.exit_code;return{title:e.timelineMetadata?.signal?`后台子任务已终止`:t==null?`后台子任务已结束`:Number(t)===0?`后台子任务已完成`:`后台子任务失败`,icon:`tools`}}if(e.role!==`system`&&e.timelineKind!==`system`)return;let t=e.content.trim();if(e.timelineMetadata?.eventKind===`compaction`||/^\[context compaction/i.test(t))return{title:`上下文已压缩`,icon:`archive`};if(/^(?:由管理员分派的子任务|(?:已)?分派(?:了)?(?:终审|子)?任务)/.test(t))return{title:`已分派子任务`,icon:`branch`};if(/^执行失败[::]/.test(t))return{title:/timeout|timed?\s*out|超时|no SSE events/i.test(t)?`响应超时`:`回复暂时中断`,icon:`info`};if(/^(?:回复重点|重点提示)[::]?/.test(t))return{title:`回复重点`,icon:`info`};if(/^(?:任务|子任务).*(?:已完成|完成通知)/.test(t.split(`
|
|
@@ -6,4 +6,4 @@ import{A as e,D as t,F as n,G as r,H as i,L as a,M as o,R as s,W as c,_ as l,a a
|
|
|
6
6
|
`),r].filter(Boolean).join(`
|
|
7
7
|
|
|
8
8
|
`)||r}var Kt=[`aria-label`,`onKeydown`],qt=[`placeholder`,`aria-label`],Jt=[`aria-label`,`aria-selected`,`tabindex`,`aria-controls`,`onClick`],Yt={key:0,class:`floating-resource-search__navigation`,"aria-label":`搜索范围`},Xt={key:0,class:`floating-resource-search__navigation-heading`},Zt=[`onClick`],Qt=[`id`,`role`,`aria-label`],$t={key:0,class:`floating-resource-search__context`},en=[`role`],tn={key:0,class:`floating-resource-search__section`},nn=[`role`],rn=[`role`,`aria-haspopup`,`onClick`],an={key:0,class:`floating-resource-search__icon floating-resource-search__icon--avatar`},on={key:1,class:`floating-resource-search__icon`},sn={class:`floating-resource-search__copy`},cn={key:0},ln={key:2},un={key:0},dn=`hermes-yaoyao:sidebar-search`,fn=`hermes-yaoyao:sidebar-search-close`,pn=w(D({__name:`FloatingResourceSearch`,props:{section:{},label:{},items:{},split:{type:Boolean,default:!1},tabbed:{type:Boolean,default:!1}},emits:[`open`,`select`],setup(c,{emit:u}){let d=c,b=u,C=m(!1),w=m(``),D=m(null),k=m(null),te=m(null),N=null,P=m(``),F=S(()=>d.items.find(e=>e.id===P.value)),I=S(()=>F.value?.children??d.items),ne=S(()=>w.value.trim().toLocaleLowerCase()),L=S(()=>{let e=ne.value;return e?I.value.filter(t=>`${t.title} ${t.subtitle||``} ${t.meta||``}`.toLocaleLowerCase().includes(e)).slice(0,50):I.value.slice(0,50)}),R=S(()=>L.value.map((e,t)=>({item:e,hasChildren:e.children!==void 0,showSection:!!(e.section&&e.section!==L.value[t-1]?.section)}))),re=S(()=>d.items.map((e,t)=>({item:e,showSection:!!(e.section&&e.section!==d.items[t-1]?.section)})));async function ie(e){e.detail?.section===d.section&&(w.value=``,N=document.activeElement instanceof HTMLElement?document.activeElement:null,P.value=(d.split||d.tabbed)&&d.items[0]?.id||``,C.value=!0,b(`open`),await t(),D.value?.focus())}function z(){C.value&&(C.value=!1,w.value=``,P.value=``,document.dispatchEvent(new CustomEvent(fn)),t(()=>{N?.isConnected&&N.focus()}))}async function ae(e){if(e.children!==void 0){P.value=e.id,d.tabbed||(w.value=``,await t(),D.value?.focus());return}b(`select`,e.id),z()}async function oe(){P.value=``,w.value=``,await t(),D.value?.focus()}function se(e){let n=d.items.findIndex(e=>e.id===P.value);P.value=d.items[(n+e+d.items.length)%d.items.length]?.id||``,t(()=>te.value?.querySelector(`[aria-selected="true"]`)?.focus())}function ce(e){let t=[...k.value?.querySelectorAll(`button:not(:disabled),input,[tabindex="0"]`)??[]].filter(e=>e.tabIndex>=0&&e.getClientRects().length>0);t.length&&(e.shiftKey&&document.activeElement===t[0]?(e.preventDefault(),t.at(-1)?.focus()):!e.shiftKey&&document.activeElement===t.at(-1)&&(e.preventDefault(),t[0]?.focus()))}return i(L,async()=>{await t(),C.value&&document.activeElement===document.body&&D.value?.focus()}),o(()=>{document.addEventListener(dn,ie),document.addEventListener(fn,z)}),e(()=>{document.removeEventListener(dn,ie),document.removeEventListener(fn,z)}),(e,t)=>(n(),_(h,{to:`body`},[C.value?(n(),l(`div`,{key:0,class:`floating-resource-search__backdrop`,onClick:T(z,[`self`])},[y(`section`,{ref_key:`panel`,ref:k,class:x([`floating-resource-search`,{"floating-resource-search--split":c.split}]),role:`dialog`,"aria-modal":`true`,"aria-label":c.label,onKeydown:[v(ce,[`tab`]),v(T(z,[`prevent`]),[`esc`])]},[y(`header`,null,[F.value&&!c.split&&!c.tabbed?(n(),l(`button`,{key:0,class:`floating-resource-search__back`,type:`button`,"aria-label":`返回搜索结果`,onClick:oe},[O(A,{name:`chevron-left`,size:17})])):g(``,!0),y(`label`,null,[O(A,{name:`search`,size:18}),r(y(`input`,{ref_key:`input`,ref:D,"onUpdate:modelValue":t[0]||=e=>w.value=e,type:`search`,placeholder:c.tabbed?`搜索聊天名称或内容`:F.value?`搜索${F.value.title}`:c.label,"aria-label":c.tabbed?c.label:F.value?`搜索${F.value.title}`:c.label,onKeydown:t[1]||=v(T(e=>c.split||c.tabbed?z():F.value?oe():z(),[`stop`,`prevent`]),[`esc`])},null,40,qt),[[ee,w.value]])]),y(`button`,{type:`button`,"aria-label":`关闭搜索`,title:`关闭搜索`,onClick:z},[O(A,{name:`close`,size:17})])]),c.tabbed?(n(),l(`nav`,{key:0,ref_key:`categories`,ref:te,class:`floating-resource-search__tabs`,role:`tablist`,"aria-label":`聊天分类`,onKeydown:[t[2]||=v(T(e=>se(-1),[`prevent`]),[`left`]),t[3]||=v(T(e=>se(1),[`prevent`]),[`right`])]},[(n(!0),l(p,null,a(c.items,e=>(n(),l(`button`,{key:e.id,type:`button`,role:`tab`,"aria-label":e.title,"aria-selected":e.id===P.value,tabindex:e.id===P.value?0:-1,"aria-controls":`${c.section}-search-results`,onClick:t=>ae(e)},[E(f(e.title),1),y(`small`,null,f(e.children?.length??0),1)],8,Jt))),128))],544)):g(``,!0),y(`div`,{class:x([`floating-resource-search__body`,{"floating-resource-search__body--split":c.split}])},[c.split?(n(),l(`nav`,Yt,[(n(!0),l(p,null,a(re.value,e=>(n(),l(p,{key:e.item.id},[e.showSection?(n(),l(`div`,Xt,f(e.item.section),1)):g(``,!0),y(`button`,{type:`button`,class:x({active:e.item.id===P.value}),onClick:t=>ae(e.item)},[e.item.icon?(n(),_(A,{key:0,name:e.item.icon,size:15},null,8,[`name`])):g(``,!0),y(`span`,null,f(e.item.title),1)],10,Zt)],64))),128))])):g(``,!0),y(`section`,{id:`${c.section}-search-results`,class:`floating-resource-search__result-pane`,role:c.tabbed?`tabpanel`:void 0,"aria-label":c.tabbed?F.value?.title:void 0},[F.value&&!c.tabbed?(n(),l(`div`,$t,[y(`strong`,null,f(F.value.title),1),y(`span`,null,f(F.value.subtitle),1)])):g(``,!0),y(`div`,{class:`floating-resource-search__results`,role:e.$slots[`item-actions`]?`list`:`listbox`,"aria-label":`搜索结果`},[(n(!0),l(p,null,a(R.value,t=>(n(),l(p,{key:t.item.id},[t.showSection?(n(),l(`div`,tn,f(t.item.section),1)):g(``,!0),y(`div`,{class:`floating-resource-search__row`,role:e.$slots[`item-actions`]?`listitem`:`presentation`},[y(`button`,{class:`floating-resource-search__select`,type:`button`,role:e.$slots[`item-actions`]?void 0:`option`,"aria-haspopup":t.hasChildren?`listbox`:void 0,onClick:e=>ae(t.item)},[t.item.avatar!==void 0||t.item.avatarMembers?.length?(n(),l(`span`,an,[t.item.avatarKind===`agent`?(n(),_(j,{key:0,name:t.item.title,avatar:t.item.avatar,state:t.item.avatarState,size:30},null,8,[`name`,`avatar`,`state`])):(n(),_(M,{key:1,name:t.item.title,avatar:t.item.avatar||``,members:t.item.avatarMembers||[],"fallback-key":t.item.avatarFallbackKey||t.item.id,size:30},null,8,[`name`,`avatar`,`members`,`fallback-key`]))])):t.item.icon?(n(),l(`span`,on,[O(A,{name:t.item.icon,size:16},null,8,[`name`])])):g(``,!0),y(`span`,sn,[y(`strong`,null,f(t.item.title),1),t.item.subtitle?(n(),l(`small`,cn,f(t.item.subtitle),1)):g(``,!0)]),t.item.meta?(n(),l(`small`,ln,f(t.item.meta),1)):g(``,!0)],8,rn),s(e.$slots,`item-actions`,{item:t.item},void 0,!0)],8,nn)],64))),128)),L.value.length?g(``,!0):(n(),l(`p`,un,f(F.value?.emptyText||(F.value?`暂无${F.value.title}内容`:`没有匹配结果`)),1))],8,en)],8,Qt)],2),s(e.$slots,`footer`,{},void 0,!0)],42,Kt)])):g(``,!0)]))}}),[[`__scopeId`,`data-v-171c037c`]]);export{B as _,Mt as a,ut as c,J as d,ot as f,H as g,U as h,It as i,ct as l,G as m,Gt as n,Ot as o,it as p,Vt as r,pt as s,pn as t,X as u};
|
|
9
|
-
//# sourceMappingURL=FloatingResourceSearch-
|
|
9
|
+
//# sourceMappingURL=FloatingResourceSearch-D5XwWF0V.js.map
|