@lsamien/yaoyao 0.4.75 → 0.4.76

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.
Files changed (56) hide show
  1. package/README.md +23 -7
  2. package/build-info.json +5 -3
  3. package/desktop/main.mjs +5 -1
  4. package/dist/assets/{AboutDialog-BvuJp8Pe.js → AboutDialog-fbm5CG09.js} +2 -2
  5. package/dist/assets/{AboutDialog-BvuJp8Pe.js.map → AboutDialog-fbm5CG09.js.map} +1 -1
  6. package/dist/assets/{BotAutomationsView-Ddgs5Hes.js → BotAutomationsView-DPAAYyuy.js} +2 -2
  7. package/dist/assets/{BotAutomationsView-Ddgs5Hes.js.map → BotAutomationsView-DPAAYyuy.js.map} +1 -1
  8. package/dist/assets/{BotPluginsDialog-xPqUSyHS.js → BotPluginsDialog-MwGpwjgu.js} +2 -2
  9. package/dist/assets/{BotPluginsDialog-xPqUSyHS.js.map → BotPluginsDialog-MwGpwjgu.js.map} +1 -1
  10. package/dist/assets/{BotSettingsDialog-wLz_KGzX.js → BotSettingsDialog-DXtsSzi8.js} +4 -4
  11. package/dist/assets/{BotSettingsDialog-wLz_KGzX.js.map → BotSettingsDialog-DXtsSzi8.js.map} +1 -1
  12. package/dist/assets/{ChatView-DRPu2nKr.js → ChatView-BNqHa6Ma.js} +2 -2
  13. package/dist/assets/{ChatView-DRPu2nKr.js.map → ChatView-BNqHa6Ma.js.map} +1 -1
  14. package/dist/assets/{ComputerPanel-Byr2_yKj.js → ComputerPanel-B0QyKQkF.js} +2 -2
  15. package/dist/assets/{ComputerPanel-Byr2_yKj.js.map → ComputerPanel-B0QyKQkF.js.map} +1 -1
  16. package/dist/assets/{ComputerViewerView-DJ6hB-5e.js → ComputerViewerView-CaOkTXpc.js} +2 -2
  17. package/dist/assets/{ComputerViewerView-DJ6hB-5e.js.map → ComputerViewerView-CaOkTXpc.js.map} +1 -1
  18. package/dist/assets/{ConversationsView-cu1Yrq68.js → ConversationsView-CYNc59hv.js} +2 -2
  19. package/dist/assets/{ConversationsView-cu1Yrq68.js.map → ConversationsView-CYNc59hv.js.map} +1 -1
  20. package/dist/assets/{FilesView-h9oJFmZt.js → FilesView-CluNyIk8.js} +2 -2
  21. package/dist/assets/{FilesView-h9oJFmZt.js.map → FilesView-CluNyIk8.js.map} +1 -1
  22. package/dist/assets/{FloatingResourceSearch-TofG1_DV.js → FloatingResourceSearch-Bg5rUZMy.js} +2 -2
  23. package/dist/assets/{FloatingResourceSearch-TofG1_DV.js.map → FloatingResourceSearch-Bg5rUZMy.js.map} +1 -1
  24. package/dist/assets/{HistoryView-Bh0SU969.js → HistoryView-DSbSDzsB.js} +2 -2
  25. package/dist/assets/{HistoryView-Bh0SU969.js.map → HistoryView-DSbSDzsB.js.map} +1 -1
  26. package/dist/assets/{KanbanView-CcqMOzB7.js → KanbanView-D5AdRwqi.js} +2 -2
  27. package/dist/assets/{KanbanView-CcqMOzB7.js.map → KanbanView-D5AdRwqi.js.map} +1 -1
  28. package/dist/assets/{LocalVmSettingsPanel-C8PIgMr3.js → LocalVmSettingsPanel-BILcGHmu.js} +2 -2
  29. package/dist/assets/{LocalVmSettingsPanel-C8PIgMr3.js.map → LocalVmSettingsPanel-BILcGHmu.js.map} +1 -1
  30. package/dist/assets/{RunnerSettingsPanel-CvNnWcdH.js → RunnerSettingsPanel-IHLAFIh8.js} +2 -2
  31. package/dist/assets/{RunnerSettingsPanel-CvNnWcdH.js.map → RunnerSettingsPanel-IHLAFIh8.js.map} +1 -1
  32. package/dist/assets/{StandaloneDialog-BbNWY6IJ.js → StandaloneDialog-DdcL_wV2.js} +2 -2
  33. package/dist/assets/{StandaloneDialog-BbNWY6IJ.js.map → StandaloneDialog-DdcL_wV2.js.map} +1 -1
  34. package/dist/assets/{UpdateCheckDialog-C357uDSE.js → UpdateCheckDialog-CJQezkXo.js} +2 -2
  35. package/dist/assets/{UpdateCheckDialog-C357uDSE.js.map → UpdateCheckDialog-CJQezkXo.js.map} +1 -1
  36. package/dist/assets/{WorkspaceKnowledgePanel-CE7qsu2i.js → WorkspaceKnowledgePanel-DS0kOQgg.js} +2 -2
  37. package/dist/assets/{WorkspaceKnowledgePanel-CE7qsu2i.js.map → WorkspaceKnowledgePanel-DS0kOQgg.js.map} +1 -1
  38. package/dist/assets/{WorkspaceRoutinesPanel-DybBh6PZ.js → WorkspaceRoutinesPanel-DpVAtnDX.js} +2 -2
  39. package/dist/assets/{WorkspaceRoutinesPanel-DybBh6PZ.js.map → WorkspaceRoutinesPanel-DpVAtnDX.js.map} +1 -1
  40. package/dist/assets/{WorkspaceShell-kp1ObJTk.js → WorkspaceShell-Bykfy3AR.js} +4 -4
  41. package/dist/assets/{WorkspaceShell-kp1ObJTk.js.map → WorkspaceShell-Bykfy3AR.js.map} +1 -1
  42. package/dist/assets/{WorkspaceView-CtNI0_AO.js → WorkspaceView-Cco3Umfn.js} +2 -2
  43. package/dist/assets/{WorkspaceView-CtNI0_AO.js.map → WorkspaceView-Cco3Umfn.js.map} +1 -1
  44. package/dist/assets/{docx-preview-YvkiVUyQ.js → docx-preview-C6qrP-g2.js} +2 -2
  45. package/dist/assets/{docx-preview-YvkiVUyQ.js.map → docx-preview-C6qrP-g2.js.map} +1 -1
  46. package/dist/assets/{index-GQxxBKs2.js → index-CEqMqiJr.js} +3 -3
  47. package/dist/assets/{index-GQxxBKs2.js.map → index-CEqMqiJr.js.map} +1 -1
  48. package/dist/assets/{pdf-pqGpzpl1.js → pdf-G3DUsfMb.js} +2 -2
  49. package/dist/assets/{pdf-pqGpzpl1.js.map → pdf-G3DUsfMb.js.map} +1 -1
  50. package/dist/assets/{sessionOwnership-bedp16q1.js → sessionOwnership-DMfBRINe.js} +2 -2
  51. package/dist/assets/{sessionOwnership-bedp16q1.js.map → sessionOwnership-DMfBRINe.js.map} +1 -1
  52. package/dist/assets/{viewModels-BYFb-v4u.js → viewModels-DfaKvI0x.js} +4 -4
  53. package/dist/assets/{viewModels-BYFb-v4u.js.map → viewModels-DfaKvI0x.js.map} +1 -1
  54. package/dist/index.html +1 -1
  55. package/package.json +1 -1
  56. package/release.json +3 -3
@@ -1,2 +1,2 @@
1
- import{i as e,l as t,r as n}from"./WorkspaceShell-kp1ObJTk.js";import{A as r,D as i,F as a,G as ee,H as te,M as ne,W as o,_ as s,at as c,ct as l,d as u,et as d,f as re,g as f,h as p,l as ie,m,n as ae,p as h,s as oe,st as se,t as ce,u as le,v as g,x as _,y as v}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as ue,Q as de,Y as y,c as fe,d as pe,l as me,o as he,p as ge,s as _e,u as ve}from"./index-GQxxBKs2.js";import{_ as ye,g as be,i as xe,n as Se,p as Ce,t as we,v as Te}from"./viewModels-BYFb-v4u.js";import{_ as Ee,g as b,h as De,m as Oe,t as ke}from"./FloatingResourceSearch-TofG1_DV.js";import{a as Ae,i as je,n as Me,r as Ne,t as x}from"./sessionOwnership-bedp16q1.js";import{t as Pe}from"./WorkspaceView-CtNI0_AO.js";var S=`hermes-yaoyao:pending-composer-item`;async function C(e){let t=e.downloadUrl||e.previewUrl;if(!t||!e.name)return null;try{let n=await fetch(t,{credentials:`same-origin`});if(!n.ok)throw Error(`下载文件失败(${n.status})`);let r=await n.blob();return new File([r],e.name,{type:e.mimeType||r.type||`application/octet-stream`})}catch{return null}}async function Fe(){let e=sessionStorage.getItem(S);if(!e)return null;sessionStorage.removeItem(S);try{let t=JSON.parse(e);return await C({name:t.name,downloadUrl:t.url,mimeType:t.mimeType})}catch{return null}}var Ie={class:`chat-workspace`},Le={key:0,class:`chat-error`,role:`alert`},Re=[`disabled`],w=ce(_({__name:`ChatView`,setup(ce){let _=ge(),S=he(),w=de(),T=ue(),E=d(null),D=d(null),O=d(null),k=d(null),A=d(!1),j=d(!1),M=d(!1),N=d(!1),P=d(!1),F=d(``),I=d(!1),L=d(``),R=d({x:8,y:8}),z=d(null),B=d(null),ze=d(null),V=d(``);function Be(t){let n=e(t);n&&n===_.activeProfile?.name&&S.loadModels(n).catch(()=>void 0)}let Ve=h(()=>[...S.sessions].filter(x)),He=h(()=>new Map(_.profiles.map(e=>[e.name,e.agentName||e.displayName||e.name]))),Ue=h(()=>Object.fromEntries(_.profiles.flatMap(e=>e.agentAvatar?[[e.name,e.agentAvatar]]:[]))),We=h(()=>Ve.value.map(e=>xe(e,S.unreadCounts[e.id]??0,He.value.get(e.profile||_.activeProfile?.name||``)))),H=h(()=>Se(S.messages,e=>e?He.value.get(e):void 0)),Ge=h(()=>S.contextUsage?.contextTokens||S.contextUsage?.totalTokens||(W.value?.inputTokens??0)+(W.value?.outputTokens??0)),Ke=h(()=>Me(S.messages)),U=h(()=>Ge.value||Ke.value),qe=h(()=>!Ge.value&&U.value>0),Je=h(()=>Oe(H.value)),Ye=h(()=>Je.value.map(e=>({url:e.previewUrl||e.downloadUrl||``,name:e.name,type:e.kind})).filter(e=>e.url)),W=h(()=>S.activeSession),G=h(()=>S.sessions.find(e=>e.id===F.value)),Xe=h(()=>[`connected`,`ready`].includes(S.connectionState)),K=h(()=>we(S.pendingApproval,S.pendingClarification)),Ze=h(()=>E.value?{id:E.value.id,content:E.value.content,author:E.value.author}:null),Qe=h(()=>{let e=W.value?.parentSessionId;return e?S.sessions.find(t=>t.id===e&&t.profile===W.value?.profile)?.title||e:``}),$e=h(()=>S.selectedModel?me(S.selectedModel):``),et=[{id:``,label:`默认`,description:`使用模型或 Profile 的默认强度`},{id:`none`,label:`关闭`,description:`不使用额外推理`},{id:`low`,label:`低`,description:`更快的轻量推理`},{id:`medium`,label:`中`,description:`速度与深度平衡`},{id:`high`,label:`高`,description:`更深入地分析复杂问题`},{id:`xhigh`,label:`极高`,description:`适用于最复杂的任务`}],tt=h(()=>et.map(e=>({id:e.id,label:e.label,detail:e.description}))),nt=h(()=>et.find(e=>e.id===(S.reasoningEffort||``))?.label||`默认`),rt=h(()=>({left:`${R.value.x}px`,top:`${R.value.y}px`}));function q(){let e=typeof w.query.profile==`string`?w.query.profile:``;return _.profiles.some(t=>t.name===e)?e:``}function J(e,t){return{path:`/chat/${encodeURIComponent(e)}`,query:{profile:t}}}async function it(e){for(let t of _.profiles)try{if((await pe(e,t.name)).id===e)return t.name}catch{}return _.activeProfile?.name||``}async function at(e){!e||_.activeProfile?.name===e||(S.switchProfile(e),V.value=e,_.selectProfile(e),await i())}async function ot(){let e=typeof w.params.sessionId==`string`?w.params.sessionId:``,t=q()||(e?await it(e):_.activeProfile?.name||``);if(t&&_.activeProfile?.name!==t&&(e&&await T.replace(J(e,t)),await at(t)),await S.loadSessions(t,`chat`),e){let n=await pe(e,t).catch(()=>void 0);if(n&&!x(n)){await T.replace({path:`/history/${encodeURIComponent(e)}`,query:{profile:t}});return}}e&&S.activeSessionId!==e&&await S.selectSession(e,t),e&&t&&q()!==t&&await T.replace(J(e,t)),S.loadUnread(t).catch(()=>void 0),!e&&S.activeSession&&!x(S.activeSession)&&S.clearSelection()}async function Y(e){A.value=!1,D.value=null;let t=S.sessions.find(t=>t.id===e)?.profile||_.activeProfile?.name||`default`;await T.push(J(e,t)),await at(t),S.activeProfileName!==t&&await S.loadSessions(t,`chat`),await S.selectSession(e,t),await S.markRead(e,t).catch(()=>void 0),E.value=null}async function st(){A.value=!1,D.value=null;let e=S.createSession(_.activeProfile?.name);await T.push(J(e,_.activeProfile?.name||`default`))}async function ct(e){try{await S.send(e.text,e.files,P.value?`queue`:S.isStreaming?`steer`:`submit`),z.value?.clearAfterSend()}catch{}}function lt(e){let t=b(e.name,e.url||``,e.id,e.kind);t.size=e.size,t.kind===`image`||t.kind===`video`?ut(t):(A.value=!1,D.value=null,O.value=t)}function ut(e){let t=De(e.previewUrl||e.downloadUrl||``),n=Ye.value.findIndex(e=>De(e.url)===t);k.value=n>=0?n:null}function dt({name:e,url:t}){let n=b(e,t);n.kind===`image`||n.kind===`video`?ut(n):(A.value=!1,O.value=n)}async function X(e){let t=await C(e);!t||!z.value||(z.value.attachFiles([t]),D.value=null,O.value=null,k.value=null,await i(),z.value?.focus())}async function ft(e){await X(b(e.name,e.url,`preview:${e.url}`,e.type))}async function pt(e){if(e===$e.value){j.value=!1;return}let t=ve(S.models,e);if(!(!t||M.value)){M.value=!0;try{await S.setModel(t),j.value=!1}finally{M.value=!1}}}function mt(e){S.reasoningEffort=e||void 0}async function ht(e){try{await S.setFastMode(e)}catch{}}function gt(e=_.activeProfile?.name||`default`){N.value=_e(_.user?.id??`local`,e)}function _t(){N.value=!N.value,fe(_.user?.id??`local`,_.activeProfile?.name||`default`,N.value)}function Z(e,t){F.value=e;let n=S.sessions.find(t=>t.id===e);L.value=n?.title||``,I.value=!1;let r=t?.currentTarget instanceof HTMLElement?t.currentTarget.getBoundingClientRect():null,i=t?.type===`contextmenu`?t.clientX:r?r.right-208:window.innerWidth-208-14,a=t?.type===`contextmenu`?t.clientY:r?r.bottom+5:46;R.value={x:Math.max(8,Math.min(i,window.innerWidth-208-8)),y:Math.max(8,Math.min(a,window.innerHeight-210-8))}}function Q(){F.value=``,I.value=!1}async function vt(){Q();try{await S.forceRefreshHistory()}catch{}}function yt(e){!F.value||e.target.closest(`.session-actions`)||Q()}function bt(e){e.key===`Escape`&&F.value&&Q()}async function xt(){let e=S.sessions.find(e=>e.id===F.value);!e||!L.value.trim()||(await S.renameSession(e.id,L.value.trim(),e.profile),Q())}async function St(){let e=G.value;e&&(await S.setSessionPinned(e.id,!e.pinned,e.profile),Q())}async function Ct(){let e=G.value;e&&(Q(),(e.id!==S.activeSessionId||e.profile!==S.activeProfileName)&&await Y(e.id),D.value=null,A.value=!0)}function $(){let e=A.value;D.value=null,A.value=!1,e&&i(()=>ze.value?.focus())}function wt(e){B.value?.scrollToAnchor(e.messageId,e.anchorId),window.matchMedia(`(max-width: 900px)`).matches&&$()}async function Tt(){let e=S.sessions.find(e=>e.id===F.value);e&&(await S.removeSession(e.id,e.profile),Q(),w.params.sessionId===e.id&&await T.replace(`/chat`))}async function Et(){let e=await S.branchSession();e&&await T.push(J(e,S.activeProfileName||_.activeProfile?.name||`default`))}async function Dt(){let e=typeof w.query.message==`string`?w.query.message:``;if(e){await i();for(let t=0;t<10;t+=1){if(B.value?.scrollToMessage(e)||!S.hasMoreBefore)return;await S.loadOlder(),await i()}}}return ne(async()=>{gt(),document.addEventListener(`pointerdown`,yt),document.addEventListener(`keydown`,bt),window.addEventListener(n,Be),await ot(),await Promise.allSettled([S.loadModels(_.activeProfile?.name),S.connect()]),S.refreshActiveSessionModel().catch(()=>void 0),await Dt();let e=await Fe();e&&z.value?.attachFiles([e])}),r(()=>{document.removeEventListener(`pointerdown`,yt),document.removeEventListener(`keydown`,bt),window.removeEventListener(n,Be)}),te(()=>_.activeProfile?.name,async(e,t)=>{if(!e||e===t)return;if(gt(e),A.value=!1,D.value=null,V.value===e){V.value=``;return}S.switchProfile(e);let n=typeof w.params.sessionId==`string`?w.params.sessionId:``;if(n&&q()===e){await Promise.allSettled([S.loadSessions(e,`chat`),S.loadModels(e),S.loadUnread(e),S.connect()]),await S.selectSession(n,e);return}await T.replace({path:`/chat`,query:{profile:e}}),await Promise.allSettled([S.loadSessions(e,`chat`),S.loadModels(e),S.loadUnread(e),S.connect()])}),te(()=>S.activeSessionId,async e=>{let t=S.activeProfileName||_.activeProfile?.name||``;e&&S.refreshActiveSessionModel().catch(()=>void 0),!(!e||w.params.sessionId===e&&q()===t)&&await T.replace(J(e,t))}),(e,n)=>(a(),s(u,null,[v(Pe,{"sidebar-title":`对话`,"sidebar-subtitle":`${Ve.value.length} 个会话`,"inspector-open":!!D.value||A.value,"inspector-close-label":A.value?`关闭会话大纲`:`关闭预览`,onCloseInspector:$},{"sidebar-action":o(()=>[m(`button`,{class:`sidebar-primary-action`,type:`button`,title:`新建聊天`,"aria-label":`新建聊天`,onClick:st},[v(t,{name:`add`}),n[17]||=m(`span`,null,`新建聊天`,-1)])]),sidebar:o(()=>[v(Ce,{items:We.value,"active-id":c(S).activeSessionId,loading:c(S).isLoading,"external-search":``,"single-line":``,"has-more":c(S).hasMoreSessions,"loading-more":c(S).isLoadingMoreSessions,"search-placeholder":`搜索会话`,"empty-title":`还没有会话`,"empty-description":`新建会话后,从输入框开始聊天。`,onLoadMore:n[0]||=e=>c(S).loadMoreSessions(c(_).activeProfile?.name),onSelect:Y,onMore:Z,onContextMenu:Z},null,8,[`items`,`active-id`,`loading`,`has-more`,`loading-more`])]),inspector:o(()=>[A.value?(a(),p(Ne,{key:0,messages:H.value,"has-older":c(S).hasMoreBefore,onNavigate:wt},null,8,[`messages`,`has-older`])):D.value?(a(),p(Te,{key:1,item:D.value,onClose:n[8]||=e=>D.value=null,onAddToComposer:X},null,8,[`item`])):f(``,!0)]),default:o(()=>[m(`div`,Ie,[v(je,{ref_key:`timeline`,ref:B,messages:H.value,title:W.value?.title||`新会话`,subtitle:W.value?`${W.value.profile||c(_).activeProfile?.name||``} · ${W.value.model||c(S).selectedModel?.name||`默认模型`}`:`选择会话或直接开始输入`,loading:c(S).activeRouteState?.isLoadingHistory,"loading-older":c(S).activeRouteState?.isLoadingHistory,"has-older":c(S).hasMoreBefore,connected:Xe.value,synced:c(S).historySynced,"show-tools":N.value,thinking:c(S).isSending||c(S).isStreaming,"show-assistant-identity":!1,"agent-avatars":Ue.value,interaction:K.value,"empty-logo":``,"transparent-header":``,"fork-source-title":Qe.value,onLoadOlder:c(S).loadOlder,onQuote:n[2]||=e=>E.value=e,onBranch:Et,onPreview:lt,onPreviewFile:dt,onApprove:n[3]||=e=>K.value&&c(S).respondToApproval(K.value.id,e),onClarify:n[4]||=e=>K.value&&c(S).respondToClarification(K.value.id,e)},{"header-actions":o(()=>[W.value?(a(),s(`button`,{key:0,ref_key:`headerSessionMenuButton`,ref:ze,class:`icon-button header-session-menu`,type:`button`,title:`会话操作`,"aria-label":`会话操作`,onClick:n[1]||=e=>Z(W.value.id,e)},[v(y,{name:`dots`,size:18})],512)):f(``,!0)]),_:1},8,[`messages`,`title`,`subtitle`,`loading`,`loading-older`,`has-older`,`connected`,`synced`,`show-tools`,`thinking`,`agent-avatars`,`interaction`,`fork-source-title`,`onLoadOlder`]),c(S).error?(a(),s(`p`,Le,[v(y,{name:`alert`,size:13}),g(l(c(S).error),1)])):f(``,!0),v(Ee,{ref_key:`composer`,ref:z,mode:`chat`,"draft-key":`${c(_).user?.id||`local`}:${c(_).activeProfile?.name||`default`}:${c(S).activeSessionId||`new`}`,disabled:c(S).connectionState===`failed`,streaming:c(S).isStreaming,sending:c(S).isSending,"model-label":c(S).selectedModel?.name||`选择模型`,"fast-mode":c(S).fastMode,"fast-mode-disabled":!c(S).activeSessionId,"reasoning-effort":nt.value,"reasoning-value":c(S).reasoningEffort||``,"reasoning-options":tt.value,"context-used":U.value,"context-limit":c(S).contextUsage?.contextLimit||262144,"context-estimated":qe.value,"queue-mode":P.value||c(S).isQueued,"tool-trace-visible":N.value,reference:Ze.value,"slash-commands":[{id:`fork`,label:`fork`,detail:`从当前会话创建分支`},{id:`compact`,label:`compact`,detail:`压缩当前会话上下文`},{id:`model`,label:`model`,detail:`切换模型`}],onSend:ct,onStop:c(S).interrupt,onModelClick:n[5]||=e=>j.value=!0,onFastModeToggle:ht,onReasoningChange:mt,onSettingsClick:_t,onQueueToggle:n[6]||=e=>P.value=!P.value,onClearReference:n[7]||=e=>E.value=null},null,8,[`draft-key`,`disabled`,`streaming`,`sending`,`model-label`,`fast-mode`,`fast-mode-disabled`,`reasoning-effort`,`reasoning-value`,`reasoning-options`,`context-used`,`context-limit`,`context-estimated`,`queue-mode`,`tool-trace-visible`,`reference`,`onStop`])])]),_:1},8,[`sidebar-subtitle`,`inspector-open`,`inspector-close-label`]),v(ke,{section:`chat`,label:`搜索会话`,items:We.value,onSelect:Y},null,8,[`items`]),O.value?(a(),p(ye,{key:0,item:O.value,items:Je.value,onClose:n[9]||=e=>O.value=null,onAddToComposer:X,onSource:n[10]||=e=>O.value=null},null,8,[`item`,`items`])):f(``,!0),v(be,{modelValue:k.value,"onUpdate:modelValue":n[11]||=e=>k.value=e,images:Ye.value,onAdd:ft},null,8,[`modelValue`,`images`]),v(Ae,{open:j.value,options:c(S).models,"selected-id":$e.value,busy:M.value,onClose:n[12]||=e=>j.value=!1,onSelect:pt},null,8,[`open`,`options`,`selected-id`,`busy`]),(a(),p(re,{to:`body`},[v(ae,{name:`session-menu`},{default:o(()=>[F.value?(a(),s(`section`,{key:0,class:`session-actions`,style:se(rt.value),role:`menu`,"aria-label":`会话操作`,onContextmenu:n[16]||=le(()=>{},[`prevent`])},[I.value?(a(),s(u,{key:0},[m(`label`,null,[n[18]||=g(`会话名称`,-1),ee(m(`input`,{"onUpdate:modelValue":n[13]||=e=>L.value=e,maxlength:`120`,autofocus:``,onKeydown:ie(xt,[`enter`])},null,544),[[oe,L.value]])]),m(`div`,null,[m(`button`,{class:`quiet-button`,type:`button`,onClick:n[14]||=e=>I.value=!1},`取消`),m(`button`,{class:`solid-button`,type:`button`,onClick:xt},`保存`)])],64)):(a(),s(u,{key:1},[m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:Ct},[v(y,{name:`menu`,size:14}),n[19]||=g(`会话大纲`,-1)]),F.value===c(S).activeSessionId?(a(),s(`button`,{key:0,class:`action-row`,role:`menuitem`,type:`button`,disabled:c(S).isStreaming||c(S).isQueued||c(S).isSending||c(S).activeRouteState?.isLoadingHistory,onClick:vt},[v(y,{name:`refresh`,size:14}),n[20]||=g(`强制刷新历史`,-1)],8,Re)):f(``,!0),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:St},[v(y,{name:G.value?.pinned?`pin-off`:`pin`,size:14},null,8,[`name`]),g(l(G.value?.pinned?`取消置顶`:`置顶会话`),1)]),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:n[15]||=e=>I.value=!0},[v(y,{name:`edit`,size:14}),n[21]||=g(`重命名`,-1)]),m(`button`,{class:`action-row danger`,role:`menuitem`,type:`button`,onClick:Tt},[v(y,{name:`trash`,size:14}),n[22]||=g(`删除会话`,-1)])],64))],36)):f(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-7a0e9150`]]);export{w as default};
2
- //# sourceMappingURL=ChatView-DRPu2nKr.js.map
1
+ import{i as e,l as t,r as n}from"./WorkspaceShell-Bykfy3AR.js";import{A as r,D as i,F as a,G as ee,H as te,M as ne,W as o,_ as s,at as c,ct as l,d as u,et as d,f as re,g as f,h as p,l as ie,m,n as ae,p as h,s as oe,st as se,t as ce,u as le,v as g,x as _,y as v}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as ue,Q as de,Y as y,c as fe,d as pe,l as me,o as he,p as ge,s as _e,u as ve}from"./index-CEqMqiJr.js";import{_ as ye,g as be,i as xe,n as Se,p as Ce,t as we,v as Te}from"./viewModels-DfaKvI0x.js";import{_ as Ee,g as b,h as De,m as Oe,t as ke}from"./FloatingResourceSearch-Bg5rUZMy.js";import{a as Ae,i as je,n as Me,r as Ne,t as x}from"./sessionOwnership-DMfBRINe.js";import{t as Pe}from"./WorkspaceView-Cco3Umfn.js";var S=`hermes-yaoyao:pending-composer-item`;async function C(e){let t=e.downloadUrl||e.previewUrl;if(!t||!e.name)return null;try{let n=await fetch(t,{credentials:`same-origin`});if(!n.ok)throw Error(`下载文件失败(${n.status})`);let r=await n.blob();return new File([r],e.name,{type:e.mimeType||r.type||`application/octet-stream`})}catch{return null}}async function Fe(){let e=sessionStorage.getItem(S);if(!e)return null;sessionStorage.removeItem(S);try{let t=JSON.parse(e);return await C({name:t.name,downloadUrl:t.url,mimeType:t.mimeType})}catch{return null}}var Ie={class:`chat-workspace`},Le={key:0,class:`chat-error`,role:`alert`},Re=[`disabled`],w=ce(_({__name:`ChatView`,setup(ce){let _=ge(),S=he(),w=de(),T=ue(),E=d(null),D=d(null),O=d(null),k=d(null),A=d(!1),j=d(!1),M=d(!1),N=d(!1),P=d(!1),F=d(``),I=d(!1),L=d(``),R=d({x:8,y:8}),z=d(null),B=d(null),ze=d(null),V=d(``);function Be(t){let n=e(t);n&&n===_.activeProfile?.name&&S.loadModels(n).catch(()=>void 0)}let Ve=h(()=>[...S.sessions].filter(x)),He=h(()=>new Map(_.profiles.map(e=>[e.name,e.agentName||e.displayName||e.name]))),Ue=h(()=>Object.fromEntries(_.profiles.flatMap(e=>e.agentAvatar?[[e.name,e.agentAvatar]]:[]))),We=h(()=>Ve.value.map(e=>xe(e,S.unreadCounts[e.id]??0,He.value.get(e.profile||_.activeProfile?.name||``)))),H=h(()=>Se(S.messages,e=>e?He.value.get(e):void 0)),Ge=h(()=>S.contextUsage?.contextTokens||S.contextUsage?.totalTokens||(W.value?.inputTokens??0)+(W.value?.outputTokens??0)),Ke=h(()=>Me(S.messages)),U=h(()=>Ge.value||Ke.value),qe=h(()=>!Ge.value&&U.value>0),Je=h(()=>Oe(H.value)),Ye=h(()=>Je.value.map(e=>({url:e.previewUrl||e.downloadUrl||``,name:e.name,type:e.kind})).filter(e=>e.url)),W=h(()=>S.activeSession),G=h(()=>S.sessions.find(e=>e.id===F.value)),Xe=h(()=>[`connected`,`ready`].includes(S.connectionState)),K=h(()=>we(S.pendingApproval,S.pendingClarification)),Ze=h(()=>E.value?{id:E.value.id,content:E.value.content,author:E.value.author}:null),Qe=h(()=>{let e=W.value?.parentSessionId;return e?S.sessions.find(t=>t.id===e&&t.profile===W.value?.profile)?.title||e:``}),$e=h(()=>S.selectedModel?me(S.selectedModel):``),et=[{id:``,label:`默认`,description:`使用模型或 Profile 的默认强度`},{id:`none`,label:`关闭`,description:`不使用额外推理`},{id:`low`,label:`低`,description:`更快的轻量推理`},{id:`medium`,label:`中`,description:`速度与深度平衡`},{id:`high`,label:`高`,description:`更深入地分析复杂问题`},{id:`xhigh`,label:`极高`,description:`适用于最复杂的任务`}],tt=h(()=>et.map(e=>({id:e.id,label:e.label,detail:e.description}))),nt=h(()=>et.find(e=>e.id===(S.reasoningEffort||``))?.label||`默认`),rt=h(()=>({left:`${R.value.x}px`,top:`${R.value.y}px`}));function q(){let e=typeof w.query.profile==`string`?w.query.profile:``;return _.profiles.some(t=>t.name===e)?e:``}function J(e,t){return{path:`/chat/${encodeURIComponent(e)}`,query:{profile:t}}}async function it(e){for(let t of _.profiles)try{if((await pe(e,t.name)).id===e)return t.name}catch{}return _.activeProfile?.name||``}async function at(e){!e||_.activeProfile?.name===e||(S.switchProfile(e),V.value=e,_.selectProfile(e),await i())}async function ot(){let e=typeof w.params.sessionId==`string`?w.params.sessionId:``,t=q()||(e?await it(e):_.activeProfile?.name||``);if(t&&_.activeProfile?.name!==t&&(e&&await T.replace(J(e,t)),await at(t)),await S.loadSessions(t,`chat`),e){let n=await pe(e,t).catch(()=>void 0);if(n&&!x(n)){await T.replace({path:`/history/${encodeURIComponent(e)}`,query:{profile:t}});return}}e&&S.activeSessionId!==e&&await S.selectSession(e,t),e&&t&&q()!==t&&await T.replace(J(e,t)),S.loadUnread(t).catch(()=>void 0),!e&&S.activeSession&&!x(S.activeSession)&&S.clearSelection()}async function Y(e){A.value=!1,D.value=null;let t=S.sessions.find(t=>t.id===e)?.profile||_.activeProfile?.name||`default`;await T.push(J(e,t)),await at(t),S.activeProfileName!==t&&await S.loadSessions(t,`chat`),await S.selectSession(e,t),await S.markRead(e,t).catch(()=>void 0),E.value=null}async function st(){A.value=!1,D.value=null;let e=S.createSession(_.activeProfile?.name);await T.push(J(e,_.activeProfile?.name||`default`))}async function ct(e){try{await S.send(e.text,e.files,P.value?`queue`:S.isStreaming?`steer`:`submit`),z.value?.clearAfterSend()}catch{}}function lt(e){let t=b(e.name,e.url||``,e.id,e.kind);t.size=e.size,t.kind===`image`||t.kind===`video`?ut(t):(A.value=!1,D.value=null,O.value=t)}function ut(e){let t=De(e.previewUrl||e.downloadUrl||``),n=Ye.value.findIndex(e=>De(e.url)===t);k.value=n>=0?n:null}function dt({name:e,url:t}){let n=b(e,t);n.kind===`image`||n.kind===`video`?ut(n):(A.value=!1,O.value=n)}async function X(e){let t=await C(e);!t||!z.value||(z.value.attachFiles([t]),D.value=null,O.value=null,k.value=null,await i(),z.value?.focus())}async function ft(e){await X(b(e.name,e.url,`preview:${e.url}`,e.type))}async function pt(e){if(e===$e.value){j.value=!1;return}let t=ve(S.models,e);if(!(!t||M.value)){M.value=!0;try{await S.setModel(t),j.value=!1}finally{M.value=!1}}}function mt(e){S.reasoningEffort=e||void 0}async function ht(e){try{await S.setFastMode(e)}catch{}}function gt(e=_.activeProfile?.name||`default`){N.value=_e(_.user?.id??`local`,e)}function _t(){N.value=!N.value,fe(_.user?.id??`local`,_.activeProfile?.name||`default`,N.value)}function Z(e,t){F.value=e;let n=S.sessions.find(t=>t.id===e);L.value=n?.title||``,I.value=!1;let r=t?.currentTarget instanceof HTMLElement?t.currentTarget.getBoundingClientRect():null,i=t?.type===`contextmenu`?t.clientX:r?r.right-208:window.innerWidth-208-14,a=t?.type===`contextmenu`?t.clientY:r?r.bottom+5:46;R.value={x:Math.max(8,Math.min(i,window.innerWidth-208-8)),y:Math.max(8,Math.min(a,window.innerHeight-210-8))}}function Q(){F.value=``,I.value=!1}async function vt(){Q();try{await S.forceRefreshHistory()}catch{}}function yt(e){!F.value||e.target.closest(`.session-actions`)||Q()}function bt(e){e.key===`Escape`&&F.value&&Q()}async function xt(){let e=S.sessions.find(e=>e.id===F.value);!e||!L.value.trim()||(await S.renameSession(e.id,L.value.trim(),e.profile),Q())}async function St(){let e=G.value;e&&(await S.setSessionPinned(e.id,!e.pinned,e.profile),Q())}async function Ct(){let e=G.value;e&&(Q(),(e.id!==S.activeSessionId||e.profile!==S.activeProfileName)&&await Y(e.id),D.value=null,A.value=!0)}function $(){let e=A.value;D.value=null,A.value=!1,e&&i(()=>ze.value?.focus())}function wt(e){B.value?.scrollToAnchor(e.messageId,e.anchorId),window.matchMedia(`(max-width: 900px)`).matches&&$()}async function Tt(){let e=S.sessions.find(e=>e.id===F.value);e&&(await S.removeSession(e.id,e.profile),Q(),w.params.sessionId===e.id&&await T.replace(`/chat`))}async function Et(){let e=await S.branchSession();e&&await T.push(J(e,S.activeProfileName||_.activeProfile?.name||`default`))}async function Dt(){let e=typeof w.query.message==`string`?w.query.message:``;if(e){await i();for(let t=0;t<10;t+=1){if(B.value?.scrollToMessage(e)||!S.hasMoreBefore)return;await S.loadOlder(),await i()}}}return ne(async()=>{gt(),document.addEventListener(`pointerdown`,yt),document.addEventListener(`keydown`,bt),window.addEventListener(n,Be),await ot(),await Promise.allSettled([S.loadModels(_.activeProfile?.name),S.connect()]),S.refreshActiveSessionModel().catch(()=>void 0),await Dt();let e=await Fe();e&&z.value?.attachFiles([e])}),r(()=>{document.removeEventListener(`pointerdown`,yt),document.removeEventListener(`keydown`,bt),window.removeEventListener(n,Be)}),te(()=>_.activeProfile?.name,async(e,t)=>{if(!e||e===t)return;if(gt(e),A.value=!1,D.value=null,V.value===e){V.value=``;return}S.switchProfile(e);let n=typeof w.params.sessionId==`string`?w.params.sessionId:``;if(n&&q()===e){await Promise.allSettled([S.loadSessions(e,`chat`),S.loadModels(e),S.loadUnread(e),S.connect()]),await S.selectSession(n,e);return}await T.replace({path:`/chat`,query:{profile:e}}),await Promise.allSettled([S.loadSessions(e,`chat`),S.loadModels(e),S.loadUnread(e),S.connect()])}),te(()=>S.activeSessionId,async e=>{let t=S.activeProfileName||_.activeProfile?.name||``;e&&S.refreshActiveSessionModel().catch(()=>void 0),!(!e||w.params.sessionId===e&&q()===t)&&await T.replace(J(e,t))}),(e,n)=>(a(),s(u,null,[v(Pe,{"sidebar-title":`对话`,"sidebar-subtitle":`${Ve.value.length} 个会话`,"inspector-open":!!D.value||A.value,"inspector-close-label":A.value?`关闭会话大纲`:`关闭预览`,onCloseInspector:$},{"sidebar-action":o(()=>[m(`button`,{class:`sidebar-primary-action`,type:`button`,title:`新建聊天`,"aria-label":`新建聊天`,onClick:st},[v(t,{name:`add`}),n[17]||=m(`span`,null,`新建聊天`,-1)])]),sidebar:o(()=>[v(Ce,{items:We.value,"active-id":c(S).activeSessionId,loading:c(S).isLoading,"external-search":``,"single-line":``,"has-more":c(S).hasMoreSessions,"loading-more":c(S).isLoadingMoreSessions,"search-placeholder":`搜索会话`,"empty-title":`还没有会话`,"empty-description":`新建会话后,从输入框开始聊天。`,onLoadMore:n[0]||=e=>c(S).loadMoreSessions(c(_).activeProfile?.name),onSelect:Y,onMore:Z,onContextMenu:Z},null,8,[`items`,`active-id`,`loading`,`has-more`,`loading-more`])]),inspector:o(()=>[A.value?(a(),p(Ne,{key:0,messages:H.value,"has-older":c(S).hasMoreBefore,onNavigate:wt},null,8,[`messages`,`has-older`])):D.value?(a(),p(Te,{key:1,item:D.value,onClose:n[8]||=e=>D.value=null,onAddToComposer:X},null,8,[`item`])):f(``,!0)]),default:o(()=>[m(`div`,Ie,[v(je,{ref_key:`timeline`,ref:B,messages:H.value,title:W.value?.title||`新会话`,subtitle:W.value?`${W.value.profile||c(_).activeProfile?.name||``} · ${W.value.model||c(S).selectedModel?.name||`默认模型`}`:`选择会话或直接开始输入`,loading:c(S).activeRouteState?.isLoadingHistory,"loading-older":c(S).activeRouteState?.isLoadingHistory,"has-older":c(S).hasMoreBefore,connected:Xe.value,synced:c(S).historySynced,"show-tools":N.value,thinking:c(S).isSending||c(S).isStreaming,"show-assistant-identity":!1,"agent-avatars":Ue.value,interaction:K.value,"empty-logo":``,"transparent-header":``,"fork-source-title":Qe.value,onLoadOlder:c(S).loadOlder,onQuote:n[2]||=e=>E.value=e,onBranch:Et,onPreview:lt,onPreviewFile:dt,onApprove:n[3]||=e=>K.value&&c(S).respondToApproval(K.value.id,e),onClarify:n[4]||=e=>K.value&&c(S).respondToClarification(K.value.id,e)},{"header-actions":o(()=>[W.value?(a(),s(`button`,{key:0,ref_key:`headerSessionMenuButton`,ref:ze,class:`icon-button header-session-menu`,type:`button`,title:`会话操作`,"aria-label":`会话操作`,onClick:n[1]||=e=>Z(W.value.id,e)},[v(y,{name:`dots`,size:18})],512)):f(``,!0)]),_:1},8,[`messages`,`title`,`subtitle`,`loading`,`loading-older`,`has-older`,`connected`,`synced`,`show-tools`,`thinking`,`agent-avatars`,`interaction`,`fork-source-title`,`onLoadOlder`]),c(S).error?(a(),s(`p`,Le,[v(y,{name:`alert`,size:13}),g(l(c(S).error),1)])):f(``,!0),v(Ee,{ref_key:`composer`,ref:z,mode:`chat`,"draft-key":`${c(_).user?.id||`local`}:${c(_).activeProfile?.name||`default`}:${c(S).activeSessionId||`new`}`,disabled:c(S).connectionState===`failed`,streaming:c(S).isStreaming,sending:c(S).isSending,"model-label":c(S).selectedModel?.name||`选择模型`,"fast-mode":c(S).fastMode,"fast-mode-disabled":!c(S).activeSessionId,"reasoning-effort":nt.value,"reasoning-value":c(S).reasoningEffort||``,"reasoning-options":tt.value,"context-used":U.value,"context-limit":c(S).contextUsage?.contextLimit||262144,"context-estimated":qe.value,"queue-mode":P.value||c(S).isQueued,"tool-trace-visible":N.value,reference:Ze.value,"slash-commands":[{id:`fork`,label:`fork`,detail:`从当前会话创建分支`},{id:`compact`,label:`compact`,detail:`压缩当前会话上下文`},{id:`model`,label:`model`,detail:`切换模型`}],onSend:ct,onStop:c(S).interrupt,onModelClick:n[5]||=e=>j.value=!0,onFastModeToggle:ht,onReasoningChange:mt,onSettingsClick:_t,onQueueToggle:n[6]||=e=>P.value=!P.value,onClearReference:n[7]||=e=>E.value=null},null,8,[`draft-key`,`disabled`,`streaming`,`sending`,`model-label`,`fast-mode`,`fast-mode-disabled`,`reasoning-effort`,`reasoning-value`,`reasoning-options`,`context-used`,`context-limit`,`context-estimated`,`queue-mode`,`tool-trace-visible`,`reference`,`onStop`])])]),_:1},8,[`sidebar-subtitle`,`inspector-open`,`inspector-close-label`]),v(ke,{section:`chat`,label:`搜索会话`,items:We.value,onSelect:Y},null,8,[`items`]),O.value?(a(),p(ye,{key:0,item:O.value,items:Je.value,onClose:n[9]||=e=>O.value=null,onAddToComposer:X,onSource:n[10]||=e=>O.value=null},null,8,[`item`,`items`])):f(``,!0),v(be,{modelValue:k.value,"onUpdate:modelValue":n[11]||=e=>k.value=e,images:Ye.value,onAdd:ft},null,8,[`modelValue`,`images`]),v(Ae,{open:j.value,options:c(S).models,"selected-id":$e.value,busy:M.value,onClose:n[12]||=e=>j.value=!1,onSelect:pt},null,8,[`open`,`options`,`selected-id`,`busy`]),(a(),p(re,{to:`body`},[v(ae,{name:`session-menu`},{default:o(()=>[F.value?(a(),s(`section`,{key:0,class:`session-actions`,style:se(rt.value),role:`menu`,"aria-label":`会话操作`,onContextmenu:n[16]||=le(()=>{},[`prevent`])},[I.value?(a(),s(u,{key:0},[m(`label`,null,[n[18]||=g(`会话名称`,-1),ee(m(`input`,{"onUpdate:modelValue":n[13]||=e=>L.value=e,maxlength:`120`,autofocus:``,onKeydown:ie(xt,[`enter`])},null,544),[[oe,L.value]])]),m(`div`,null,[m(`button`,{class:`quiet-button`,type:`button`,onClick:n[14]||=e=>I.value=!1},`取消`),m(`button`,{class:`solid-button`,type:`button`,onClick:xt},`保存`)])],64)):(a(),s(u,{key:1},[m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:Ct},[v(y,{name:`menu`,size:14}),n[19]||=g(`会话大纲`,-1)]),F.value===c(S).activeSessionId?(a(),s(`button`,{key:0,class:`action-row`,role:`menuitem`,type:`button`,disabled:c(S).isStreaming||c(S).isQueued||c(S).isSending||c(S).activeRouteState?.isLoadingHistory,onClick:vt},[v(y,{name:`refresh`,size:14}),n[20]||=g(`强制刷新历史`,-1)],8,Re)):f(``,!0),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:St},[v(y,{name:G.value?.pinned?`pin-off`:`pin`,size:14},null,8,[`name`]),g(l(G.value?.pinned?`取消置顶`:`置顶会话`),1)]),m(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:n[15]||=e=>I.value=!0},[v(y,{name:`edit`,size:14}),n[21]||=g(`重命名`,-1)]),m(`button`,{class:`action-row danger`,role:`menuitem`,type:`button`,onClick:Tt},[v(y,{name:`trash`,size:14}),n[22]||=g(`删除会话`,-1)])],64))],36)):f(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-7a0e9150`]]);export{w as default};
2
+ //# sourceMappingURL=ChatView-BNqHa6Ma.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatView-DRPu2nKr.js","names":[],"sources":["../../src/client/components/workspace/pendingComposer.ts","../../src/client/views/ChatView.vue","../../src/client/views/ChatView.vue"],"sourcesContent":["import type { UiLibraryItem } from '@/components/library/types'\n\nconst KEY = 'hermes-yaoyao:pending-composer-item'\n\ntype PendingItem = { name: string; url: string; mimeType?: string }\n\ntype ComposerFileSource = Pick<UiLibraryItem, 'name' | 'previewUrl' | 'downloadUrl' | 'mimeType'>\n\nexport function queueLibraryItemForComposer(item: UiLibraryItem): boolean {\n const url = item.downloadUrl || item.previewUrl\n if (!url) return false\n const pending: PendingItem = { name: item.name, url, mimeType: item.mimeType }\n sessionStorage.setItem(KEY, JSON.stringify(pending))\n return true\n}\n\nexport async function loadComposerFile(item: ComposerFileSource): Promise<File | null> {\n const url = item.downloadUrl || item.previewUrl\n if (!url || !item.name) return null\n try {\n const response = await fetch(url, { credentials: 'same-origin' })\n if (!response.ok) throw new Error(`下载文件失败(${response.status})`)\n const blob = await response.blob()\n return new File([blob], item.name, { type: item.mimeType || blob.type || 'application/octet-stream' })\n } catch {\n return null\n }\n}\n\nexport async function consumeLibraryItemForComposer(): Promise<File | null> {\n const raw = sessionStorage.getItem(KEY)\n if (!raw) return null\n sessionStorage.removeItem(KEY)\n try {\n const pending = JSON.parse(raw) as PendingItem\n return await loadComposerFile({ name: pending.name, downloadUrl: pending.url, mimeType: pending.mimeType })\n } catch {\n return null\n }\n}\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRoute, useRouter } from 'vue-router'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport YaoYaoSidebarIcon from '@/components/common/YaoYaoSidebarIcon.vue'\nimport type { ChoiceOption } from '@/components/common/types'\nimport ComposerShell from '@/components/composer/ComposerShell.vue'\nimport ModelChoiceDialog from '@/components/composer/ModelChoiceDialog.vue'\nimport type { ComposerOption, ComposerReference, ComposerSubmit } from '@/components/composer/types'\nimport PreviewInspector from '@/components/library/PreviewInspector.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 { UiLibraryItem } from '@/components/library/types'\nimport { mediaItemsFromMessages, mediaUrlIdentity, previewItemFromUrl } from '@/components/library/mediaSequence'\nimport MessageTimeline from '@/components/messages/MessageTimeline.vue'\nimport SessionOutline from '@/components/messages/SessionOutline.vue'\nimport type { UiMessage } from '@/components/messages/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport FloatingResourceSearch from '@/components/app/FloatingResourceSearch.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { chatInteraction, chatMessagesToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { consumeLibraryItemForComposer, loadComposerFile } from '@/components/workspace/pendingComposer'\nimport { readAgentShowThinking, writeAgentShowThinking } from '@/utils/sessionPreferences'\nimport { modelChoiceId, modelForChoiceId } from '@/utils/sessionModel'\nimport { MODEL_CATALOG_CHANGED_EVENT, modelCatalogChangedProfile } from '@/utils/modelCatalogEvents'\nimport { estimateConversationTokens } from '@/utils/contextUsage'\nimport { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst route = useRoute()\nconst router = useRouter()\nconst quoted = ref<UiMessage | null>(null)\nconst preview = ref<UiLibraryItem | null>(null)\nconst filePreview = ref<UiLibraryItem | null>(null)\nconst mediaPreviewIndex = ref<number | null>(null)\nconst outlineOpen = ref(false)\nconst modelDialog = ref(false)\nconst modelSwitching = ref(false)\nconst showThinking = ref(false)\nconst queueMode = ref(false)\nconst actionSessionId = ref('')\nconst renaming = ref(false)\nconst renameValue = ref('')\nconst actionMenuPosition = ref({ x: 8, y: 8 })\nconst composer = ref<InstanceType<typeof ComposerShell> | null>(null)\nconst timeline = ref<InstanceType<typeof MessageTimeline> | null>(null)\nconst headerSessionMenuButton = ref<HTMLButtonElement | null>(null)\nconst restoringRouteProfile = ref('')\n\nfunction handleModelCatalogChanged(event: Event) {\n const profile = modelCatalogChangedProfile(event)\n if (profile && profile === auth.activeProfile?.name) void chat.loadModels(profile).catch(() => undefined)\n}\n\nconst sessions = computed(() => [...chat.sessions]\n .filter(isOwnedChatSession))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [\n profile.name,\n profile.agentName || profile.displayName || profile.name,\n])))\nconst agentAvatars = computed(() => Object.fromEntries(auth.profiles.flatMap(profile =>\n profile.agentAvatar ? [[profile.name, profile.agentAvatar] as const] : []\n)))\nconst sidebarItems = computed(() => sessions.value.map(session => sessionSidebarItem(\n session,\n chat.unreadCounts[session.id] ?? 0,\n agentNames.value.get(session.profile || auth.activeProfile?.name || ''),\n)))\nconst messages = computed(() => chatMessagesToUi(chat.messages, profile => profile ? agentNames.value.get(profile) : undefined))\nconst reportedContextTokens = computed(() => chat.contextUsage?.contextTokens\n || chat.contextUsage?.totalTokens\n || (activeSession.value?.inputTokens ?? 0) + (activeSession.value?.outputTokens ?? 0))\nconst estimatedContextTokens = computed(() => estimateConversationTokens(chat.messages))\nconst contextUsed = computed(() => reportedContextTokens.value || estimatedContextTokens.value)\nconst contextIsEstimated = computed(() => !reportedContextTokens.value && contextUsed.value > 0)\nconst conversationMediaItems = computed(() => mediaItemsFromMessages(messages.value))\nconst lightboxMedia = computed(() => conversationMediaItems.value.map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst activeSession = computed(() => chat.activeSession)\nconst actionSession = computed(() => chat.sessions.find(session => session.id === actionSessionId.value))\nconst connected = computed(() => ['connected', 'ready'].includes(chat.connectionState))\nconst interaction = computed(() => chatInteraction(chat.pendingApproval, chat.pendingClarification))\nconst reference = computed<ComposerReference | null>(() => quoted.value ? { id: quoted.value.id, content: quoted.value.content, author: quoted.value.author } : null)\nconst forkSourceTitle = computed(() => {\n const parentId = activeSession.value?.parentSessionId\n if (!parentId) return ''\n return chat.sessions.find(session => session.id === parentId && session.profile === activeSession.value?.profile)?.title || parentId\n})\nconst selectedModelId = computed(() => chat.selectedModel ? modelChoiceId(chat.selectedModel) : '')\nconst reasoningOptions: ChoiceOption[] = [\n { id: '', label: '默认', description: '使用模型或 Profile 的默认强度' },\n { id: 'none', label: '关闭', description: '不使用额外推理' },\n { id: 'low', label: '低', description: '更快的轻量推理' },\n { id: 'medium', label: '中', description: '速度与深度平衡' },\n { id: 'high', label: '高', description: '更深入地分析复杂问题' },\n { id: 'xhigh', label: '极高', description: '适用于最复杂的任务' },\n]\nconst reasoningComposerOptions = computed<ComposerOption[]>(() => reasoningOptions.map(option => ({\n id: option.id,\n label: option.label,\n detail: option.description,\n})))\nconst reasoningLabel = computed(() => reasoningOptions.find(option => option.id === (chat.reasoningEffort || ''))?.label || '默认')\nconst actionMenuStyle = computed(() => ({ left: `${actionMenuPosition.value.x}px`, top: `${actionMenuPosition.value.y}px` }))\n\nfunction routeProfile(): string {\n const value = typeof route.query.profile === 'string' ? route.query.profile : ''\n return auth.profiles.some(profile => profile.name === value) ? value : ''\n}\n\nfunction sessionLocation(id: string, profile: string) {\n return { path: `/chat/${encodeURIComponent(id)}`, query: { profile } }\n}\n\nasync function findLegacySessionProfile(sessionId: string): Promise<string> {\n for (const profile of auth.profiles) {\n try {\n const session = await getSession(sessionId, profile.name)\n if (session.id === sessionId) return profile.name\n } catch { /* Try the next profile: 9119 returns 404 for a foreign session. */ }\n }\n return auth.activeProfile?.name || ''\n}\n\nasync function ensureRouteProfile(profile: string): Promise<void> {\n if (!profile || auth.activeProfile?.name === profile) return\n chat.switchProfile(profile)\n restoringRouteProfile.value = profile\n auth.selectProfile(profile)\n await nextTick()\n}\n\nasync function refreshSessions() {\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n const profile = routeProfile() || (requestedId ? await findLegacySessionProfile(requestedId) : auth.activeProfile?.name || '')\n if (profile && auth.activeProfile?.name !== profile) {\n if (requestedId) await router.replace(sessionLocation(requestedId, profile))\n await ensureRouteProfile(profile)\n }\n // The session route is the authoritative navigation target. A secondary\n // unread-count request must never prevent its history from being restored.\n await chat.loadSessions(profile, 'chat')\n if (requestedId) {\n const target = await getSession(requestedId, profile).catch(() => undefined)\n if (target && !isOwnedChatSession(target)) {\n await router.replace({ path: `/history/${encodeURIComponent(requestedId)}`, query: { profile } })\n return\n }\n }\n if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)\n if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))\n void chat.loadUnread(profile).catch(() => undefined)\n if (!requestedId && chat.activeSession && !isOwnedChatSession(chat.activeSession)) {\n chat.clearSelection()\n }\n}\n\nasync function chooseSession(id: string) {\n outlineOpen.value = false\n preview.value = null\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name || 'default'\n await router.push(sessionLocation(id, profile))\n await ensureRouteProfile(profile)\n if (chat.activeProfileName !== profile) await chat.loadSessions(profile, 'chat')\n await chat.selectSession(id, profile)\n await chat.markRead(id, profile).catch(() => undefined)\n quoted.value = null\n}\n\nasync function createSession() {\n outlineOpen.value = false\n preview.value = null\n const id = chat.createSession(auth.activeProfile?.name)\n await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))\n}\n\nasync function send(payload: ComposerSubmit) {\n try {\n await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')\n composer.value?.clearAfterSend()\n } catch { /* store exposes the error and the composer keeps its draft */ }\n}\n\nfunction openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {\n const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)\n item.size = attachment.size\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; preview.value = null; filePreview.value = item }\n}\n\nfunction openMedia(item: UiLibraryItem) {\n const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')\n const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)\n mediaPreviewIndex.value = index >= 0 ? index : null\n}\n\nfunction openLocalFile({ name, url }: { name: string; url: string }) {\n const item = previewItemFromUrl(name, url)\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; filePreview.value = item }\n}\n\nasync function addPreviewToComposer(item: UiLibraryItem) {\n const file = await loadComposerFile(item)\n if (!file || !composer.value) return\n composer.value.attachFiles([file])\n preview.value = null\n filePreview.value = null\n mediaPreviewIndex.value = null\n await nextTick()\n composer.value?.focus()\n}\n\nasync function addMediaToComposer(media: PreviewMedia) {\n await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))\n}\n\nasync function selectModel(id: string) {\n if (id === selectedModelId.value) {\n modelDialog.value = false\n return\n }\n const model = modelForChoiceId(chat.models, id)\n if (!model || modelSwitching.value) return\n modelSwitching.value = true\n try {\n await chat.setModel(model)\n modelDialog.value = false\n } finally {\n modelSwitching.value = false\n }\n}\n\nfunction selectReasoning(id: string) {\n chat.reasoningEffort = id || undefined\n}\n\nasync function toggleFastMode(enabled: boolean) {\n try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }\n}\n\nfunction restoreShowThinking(profile = auth.activeProfile?.name || 'default') {\n showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)\n}\n\nfunction toggleShowThinking() {\n showThinking.value = !showThinking.value\n writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)\n}\n\nfunction openSessionActions(id: string, event?: MouseEvent) {\n actionSessionId.value = id\n const session = chat.sessions.find(item => item.id === id)\n renameValue.value = session?.title || ''\n renaming.value = false\n const menuWidth = 208\n const menuHeight = 210\n const inset = 8\n const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null\n const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14\n const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46\n actionMenuPosition.value = {\n x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),\n y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),\n }\n}\n\nfunction closeSessionActions() {\n actionSessionId.value = ''\n renaming.value = false\n}\n\nasync function forceRefreshHistory() {\n closeSessionActions()\n try { await chat.forceRefreshHistory() }\n catch { /* The chat store displays the refresh error without clearing messages. */ }\n}\n\nfunction handleSessionActionPointer(event: PointerEvent) {\n if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return\n closeSessionActions()\n}\n\nfunction handleSessionActionKey(event: KeyboardEvent) {\n if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()\n}\n\nasync function saveRename() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session || !renameValue.value.trim()) return\n await chat.renameSession(session.id, renameValue.value.trim(), session.profile)\n closeSessionActions()\n}\n\nasync function toggleSessionPinned() {\n const session = actionSession.value\n if (!session) return\n await chat.setSessionPinned(session.id, !session.pinned, session.profile)\n closeSessionActions()\n}\n\nasync function openSessionOutline() {\n const session = actionSession.value\n if (!session) return\n closeSessionActions()\n if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)\n preview.value = null\n outlineOpen.value = true\n}\n\nfunction closeInspector() {\n const restoreMenuFocus = outlineOpen.value\n preview.value = null\n outlineOpen.value = false\n if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nfunction navigateOutline(target: { messageId: string; anchorId: string }) {\n timeline.value?.scrollToAnchor(target.messageId, target.anchorId)\n if (window.matchMedia('(max-width: 900px)').matches) closeInspector()\n}\n\nasync function deleteSession() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session) return\n await chat.removeSession(session.id, session.profile)\n closeSessionActions()\n if (route.params.sessionId === session.id) await router.replace('/chat')\n}\n\nasync function branch() {\n const id = await chat.branchSession()\n if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))\n}\n\nasync function revealSourceMessage() {\n const messageId = typeof route.query.message === 'string' ? route.query.message : ''\n if (!messageId) return\n await nextTick()\n for (let attempt = 0; attempt < 10; attempt += 1) {\n if (timeline.value?.scrollToMessage(messageId)) return\n if (!chat.hasMoreBefore) return\n await chat.loadOlder()\n await nextTick()\n }\n}\n\nonMounted(async () => {\n restoreShowThinking()\n document.addEventListener('pointerdown', handleSessionActionPointer)\n document.addEventListener('keydown', handleSessionActionKey)\n window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n await refreshSessions()\n await Promise.allSettled([chat.loadModels(auth.activeProfile?.name), chat.connect()])\n void chat.refreshActiveSessionModel().catch(() => undefined)\n await revealSourceMessage()\n const pendingFile = await consumeLibraryItemForComposer()\n if (pendingFile) composer.value?.attachFiles([pendingFile])\n})\n\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleSessionActionPointer)\n document.removeEventListener('keydown', handleSessionActionKey)\n window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n})\n\nwatch(() => auth.activeProfile?.name, async (profile, previous) => {\n if (!profile || profile === previous) return\n restoreShowThinking(profile)\n outlineOpen.value = false\n preview.value = null\n if (restoringRouteProfile.value === profile) {\n restoringRouteProfile.value = ''\n return\n }\n chat.switchProfile(profile)\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n if (requestedId && routeProfile() === profile) {\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n await chat.selectSession(requestedId, profile)\n return\n }\n await router.replace({ path: '/chat', query: { profile } })\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n})\n\nwatch(() => chat.activeSessionId, async id => {\n const profile = chat.activeProfileName || auth.activeProfile?.name || ''\n if (id) void chat.refreshActiveSessionModel().catch(() => undefined)\n if (!id || (route.params.sessionId === id && routeProfile() === profile)) return\n await router.replace(sessionLocation(id, profile))\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"对话\" :sidebar-subtitle=\"`${sessions.length} 个会话`\" :inspector-open=\"!!preview || outlineOpen\" :inspector-close-label=\"outlineOpen ? '关闭会话大纲' : '关闭预览'\" @close-inspector=\"closeInspector\">\n <template #sidebar-action>\n <button class=\"sidebar-primary-action\" type=\"button\" title=\"新建聊天\" aria-label=\"新建聊天\" @click=\"createSession\">\n <YaoYaoSidebarIcon name=\"add\" />\n <span>新建聊天</span>\n </button>\n </template>\n <template #sidebar>\n <ResourceSidebar\n :items=\"sidebarItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n external-search\n single-line\n :has-more=\"chat.hasMoreSessions\"\n :loading-more=\"chat.isLoadingMoreSessions\"\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"新建会话后,从输入框开始聊天。\"\n @load-more=\"chat.loadMoreSessions(auth.activeProfile?.name)\"\n @select=\"chooseSession\"\n @more=\"openSessionActions\"\n @context-menu=\"openSessionActions\"\n />\n </template>\n\n <div class=\"chat-workspace\">\n <MessageTimeline\n ref=\"timeline\"\n :messages=\"messages\"\n :title=\"activeSession?.title || '新会话'\"\n :subtitle=\"activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || chat.selectedModel?.name || '默认模型'}` : '选择会话或直接开始输入'\"\n :loading=\"chat.activeRouteState?.isLoadingHistory\"\n :loading-older=\"chat.activeRouteState?.isLoadingHistory\"\n :has-older=\"chat.hasMoreBefore\"\n :connected=\"connected\"\n :synced=\"chat.historySynced\"\n :show-tools=\"showThinking\"\n :thinking=\"chat.isSending || chat.isStreaming\"\n :show-assistant-identity=\"false\"\n :agent-avatars=\"agentAvatars\"\n :interaction=\"interaction\"\n empty-logo\n transparent-header\n :fork-source-title=\"forkSourceTitle\"\n @load-older=\"chat.loadOlder\"\n @quote=\"quoted = $event\"\n @branch=\"branch\"\n @preview=\"openAttachment\"\n @preview-file=\"openLocalFile\"\n @approve=\"interaction && chat.respondToApproval(interaction.id, $event)\"\n @clarify=\"interaction && chat.respondToClarification(interaction.id, $event)\"\n >\n <template #header-actions>\n <button v-if=\"activeSession\" ref=\"headerSessionMenuButton\" class=\"icon-button header-session-menu\" type=\"button\" title=\"会话操作\" aria-label=\"会话操作\" @click=\"openSessionActions(activeSession.id, $event)\"><AppIcon name=\"dots\" :size=\"18\" /></button>\n </template>\n </MessageTimeline>\n <p v-if=\"chat.error\" class=\"chat-error\" role=\"alert\"><AppIcon name=\"alert\" :size=\"13\" />{{ chat.error }}</p>\n <ComposerShell\n ref=\"composer\"\n mode=\"chat\"\n :draft-key=\"`${auth.user?.id || 'local'}:${auth.activeProfile?.name || 'default'}:${chat.activeSessionId || 'new'}`\"\n :disabled=\"chat.connectionState === 'failed'\"\n :streaming=\"chat.isStreaming\"\n :sending=\"chat.isSending\"\n :model-label=\"chat.selectedModel?.name || '选择模型'\"\n :fast-mode=\"chat.fastMode\"\n :fast-mode-disabled=\"!chat.activeSessionId\"\n :reasoning-effort=\"reasoningLabel\"\n :reasoning-value=\"chat.reasoningEffort || ''\"\n :reasoning-options=\"reasoningComposerOptions\"\n :context-used=\"contextUsed\"\n :context-limit=\"chat.contextUsage?.contextLimit || 262144\"\n :context-estimated=\"contextIsEstimated\"\n :queue-mode=\"queueMode || chat.isQueued\"\n :tool-trace-visible=\"showThinking\"\n :reference=\"reference\"\n :slash-commands=\"[\n { id: 'fork', label: 'fork', detail: '从当前会话创建分支' },\n { id: 'compact', label: 'compact', detail: '压缩当前会话上下文' },\n { id: 'model', label: 'model', detail: '切换模型' },\n ]\"\n @send=\"send\"\n @stop=\"chat.interrupt\"\n @model-click=\"modelDialog = true\"\n @fast-mode-toggle=\"toggleFastMode\"\n @reasoning-change=\"selectReasoning\"\n @settings-click=\"toggleShowThinking\"\n @queue-toggle=\"queueMode = !queueMode\"\n @clear-reference=\"quoted = null\"\n />\n </div>\n\n <template #inspector>\n <SessionOutline v-if=\"outlineOpen\" :messages=\"messages\" :has-older=\"chat.hasMoreBefore\" @navigate=\"navigateOutline\" />\n <PreviewInspector v-else-if=\"preview\" :item=\"preview\" @close=\"preview = null\" @add-to-composer=\"addPreviewToComposer\" />\n </template>\n </WorkspaceView>\n\n <FloatingResourceSearch section=\"chat\" label=\"搜索会话\" :items=\"sidebarItems\" @select=\"chooseSession\" />\n <PreviewModal v-if=\"filePreview\" :item=\"filePreview\" :items=\"conversationMediaItems\" @close=\"filePreview = null\" @add-to-composer=\"addPreviewToComposer\" @source=\"filePreview = null\" />\n <ImagePreviewLightbox v-model=\"mediaPreviewIndex\" :images=\"lightboxMedia\" @add=\"addMediaToComposer\" />\n\n <ModelChoiceDialog :open=\"modelDialog\" :options=\"chat.models\" :selected-id=\"selectedModelId\" :busy=\"modelSwitching\" @close=\"modelDialog = false\" @select=\"selectModel\" />\n\n <Teleport to=\"body\">\n <Transition name=\"session-menu\">\n <section v-if=\"actionSessionId\" class=\"session-actions\" :style=\"actionMenuStyle\" role=\"menu\" aria-label=\"会话操作\" @contextmenu.prevent>\n <template v-if=\"renaming\">\n <label>会话名称<input v-model=\"renameValue\" maxlength=\"120\" autofocus @keydown.enter=\"saveRename\" /></label>\n <div><button class=\"quiet-button\" type=\"button\" @click=\"renaming = false\">取消</button><button class=\"solid-button\" type=\"button\" @click=\"saveRename\">保存</button></div>\n </template>\n <template v-else>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"openSessionOutline\"><AppIcon name=\"menu\" :size=\"14\" />会话大纲</button>\n <button v-if=\"actionSessionId === chat.activeSessionId\" class=\"action-row\" role=\"menuitem\" type=\"button\" :disabled=\"chat.isStreaming || chat.isQueued || chat.isSending || chat.activeRouteState?.isLoadingHistory\" @click=\"forceRefreshHistory\"><AppIcon name=\"refresh\" :size=\"14\" />强制刷新历史</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"toggleSessionPinned\"><AppIcon :name=\"actionSession?.pinned ? 'pin-off' : 'pin'\" :size=\"14\" />{{ actionSession?.pinned ? '取消置顶' : '置顶会话' }}</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"renaming = true\"><AppIcon name=\"edit\" :size=\"14\" />重命名</button>\n <button class=\"action-row danger\" role=\"menuitem\" type=\"button\" @click=\"deleteSession\"><AppIcon name=\"trash\" :size=\"14\" />删除会话</button>\n </template>\n </section>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.sidebar-primary-action { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; font-size: 12px; font-weight: 610; text-align: left; transition: background-color 120ms ease; }\n.sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }\n.sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }\n.header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }\n.chat-error { display: flex; width: min(760px, calc(100% - 32px)); margin: 0 auto 4px; align-items: center; gap: 6px; color: var(--danger); font-size: 9px; }\n.session-actions { position: fixed; z-index: 205; width: 208px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 12px 34px rgba(0,0,0,.16); }.action-row { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; text-align: left; }.action-row:hover, .action-row:focus-visible { outline: 0; background: var(--surface-soft); color: var(--text-primary); }.action-row.danger { color: var(--danger); }.session-actions label { display: flex; flex-direction: column; gap: 6px; padding: 4px; color: var(--text-muted); font-size: 9px; }.session-actions input { width: 100%; height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-soft); color: var(--text-primary); font-size: 11px; }.session-actions input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--focus-ring); }.session-actions > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; padding: 0 4px 3px; }.session-actions :deep(.quiet-button), .session-actions :deep(.solid-button) { min-height: 29px; padding-inline: 10px; font-size: 10px; }\n.session-menu-enter-active, .session-menu-leave-active { transition: opacity 100ms ease, transform 120ms var(--ease-out); transform-origin: top right; }.session-menu-enter-from, .session-menu-leave-to { opacity: 0; transform: translateY(-3px) scale(.98); }\n@media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRoute, useRouter } from 'vue-router'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport YaoYaoSidebarIcon from '@/components/common/YaoYaoSidebarIcon.vue'\nimport type { ChoiceOption } from '@/components/common/types'\nimport ComposerShell from '@/components/composer/ComposerShell.vue'\nimport ModelChoiceDialog from '@/components/composer/ModelChoiceDialog.vue'\nimport type { ComposerOption, ComposerReference, ComposerSubmit } from '@/components/composer/types'\nimport PreviewInspector from '@/components/library/PreviewInspector.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 { UiLibraryItem } from '@/components/library/types'\nimport { mediaItemsFromMessages, mediaUrlIdentity, previewItemFromUrl } from '@/components/library/mediaSequence'\nimport MessageTimeline from '@/components/messages/MessageTimeline.vue'\nimport SessionOutline from '@/components/messages/SessionOutline.vue'\nimport type { UiMessage } from '@/components/messages/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport FloatingResourceSearch from '@/components/app/FloatingResourceSearch.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { chatInteraction, chatMessagesToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { consumeLibraryItemForComposer, loadComposerFile } from '@/components/workspace/pendingComposer'\nimport { readAgentShowThinking, writeAgentShowThinking } from '@/utils/sessionPreferences'\nimport { modelChoiceId, modelForChoiceId } from '@/utils/sessionModel'\nimport { MODEL_CATALOG_CHANGED_EVENT, modelCatalogChangedProfile } from '@/utils/modelCatalogEvents'\nimport { estimateConversationTokens } from '@/utils/contextUsage'\nimport { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst route = useRoute()\nconst router = useRouter()\nconst quoted = ref<UiMessage | null>(null)\nconst preview = ref<UiLibraryItem | null>(null)\nconst filePreview = ref<UiLibraryItem | null>(null)\nconst mediaPreviewIndex = ref<number | null>(null)\nconst outlineOpen = ref(false)\nconst modelDialog = ref(false)\nconst modelSwitching = ref(false)\nconst showThinking = ref(false)\nconst queueMode = ref(false)\nconst actionSessionId = ref('')\nconst renaming = ref(false)\nconst renameValue = ref('')\nconst actionMenuPosition = ref({ x: 8, y: 8 })\nconst composer = ref<InstanceType<typeof ComposerShell> | null>(null)\nconst timeline = ref<InstanceType<typeof MessageTimeline> | null>(null)\nconst headerSessionMenuButton = ref<HTMLButtonElement | null>(null)\nconst restoringRouteProfile = ref('')\n\nfunction handleModelCatalogChanged(event: Event) {\n const profile = modelCatalogChangedProfile(event)\n if (profile && profile === auth.activeProfile?.name) void chat.loadModels(profile).catch(() => undefined)\n}\n\nconst sessions = computed(() => [...chat.sessions]\n .filter(isOwnedChatSession))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [\n profile.name,\n profile.agentName || profile.displayName || profile.name,\n])))\nconst agentAvatars = computed(() => Object.fromEntries(auth.profiles.flatMap(profile =>\n profile.agentAvatar ? [[profile.name, profile.agentAvatar] as const] : []\n)))\nconst sidebarItems = computed(() => sessions.value.map(session => sessionSidebarItem(\n session,\n chat.unreadCounts[session.id] ?? 0,\n agentNames.value.get(session.profile || auth.activeProfile?.name || ''),\n)))\nconst messages = computed(() => chatMessagesToUi(chat.messages, profile => profile ? agentNames.value.get(profile) : undefined))\nconst reportedContextTokens = computed(() => chat.contextUsage?.contextTokens\n || chat.contextUsage?.totalTokens\n || (activeSession.value?.inputTokens ?? 0) + (activeSession.value?.outputTokens ?? 0))\nconst estimatedContextTokens = computed(() => estimateConversationTokens(chat.messages))\nconst contextUsed = computed(() => reportedContextTokens.value || estimatedContextTokens.value)\nconst contextIsEstimated = computed(() => !reportedContextTokens.value && contextUsed.value > 0)\nconst conversationMediaItems = computed(() => mediaItemsFromMessages(messages.value))\nconst lightboxMedia = computed(() => conversationMediaItems.value.map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst activeSession = computed(() => chat.activeSession)\nconst actionSession = computed(() => chat.sessions.find(session => session.id === actionSessionId.value))\nconst connected = computed(() => ['connected', 'ready'].includes(chat.connectionState))\nconst interaction = computed(() => chatInteraction(chat.pendingApproval, chat.pendingClarification))\nconst reference = computed<ComposerReference | null>(() => quoted.value ? { id: quoted.value.id, content: quoted.value.content, author: quoted.value.author } : null)\nconst forkSourceTitle = computed(() => {\n const parentId = activeSession.value?.parentSessionId\n if (!parentId) return ''\n return chat.sessions.find(session => session.id === parentId && session.profile === activeSession.value?.profile)?.title || parentId\n})\nconst selectedModelId = computed(() => chat.selectedModel ? modelChoiceId(chat.selectedModel) : '')\nconst reasoningOptions: ChoiceOption[] = [\n { id: '', label: '默认', description: '使用模型或 Profile 的默认强度' },\n { id: 'none', label: '关闭', description: '不使用额外推理' },\n { id: 'low', label: '低', description: '更快的轻量推理' },\n { id: 'medium', label: '中', description: '速度与深度平衡' },\n { id: 'high', label: '高', description: '更深入地分析复杂问题' },\n { id: 'xhigh', label: '极高', description: '适用于最复杂的任务' },\n]\nconst reasoningComposerOptions = computed<ComposerOption[]>(() => reasoningOptions.map(option => ({\n id: option.id,\n label: option.label,\n detail: option.description,\n})))\nconst reasoningLabel = computed(() => reasoningOptions.find(option => option.id === (chat.reasoningEffort || ''))?.label || '默认')\nconst actionMenuStyle = computed(() => ({ left: `${actionMenuPosition.value.x}px`, top: `${actionMenuPosition.value.y}px` }))\n\nfunction routeProfile(): string {\n const value = typeof route.query.profile === 'string' ? route.query.profile : ''\n return auth.profiles.some(profile => profile.name === value) ? value : ''\n}\n\nfunction sessionLocation(id: string, profile: string) {\n return { path: `/chat/${encodeURIComponent(id)}`, query: { profile } }\n}\n\nasync function findLegacySessionProfile(sessionId: string): Promise<string> {\n for (const profile of auth.profiles) {\n try {\n const session = await getSession(sessionId, profile.name)\n if (session.id === sessionId) return profile.name\n } catch { /* Try the next profile: 9119 returns 404 for a foreign session. */ }\n }\n return auth.activeProfile?.name || ''\n}\n\nasync function ensureRouteProfile(profile: string): Promise<void> {\n if (!profile || auth.activeProfile?.name === profile) return\n chat.switchProfile(profile)\n restoringRouteProfile.value = profile\n auth.selectProfile(profile)\n await nextTick()\n}\n\nasync function refreshSessions() {\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n const profile = routeProfile() || (requestedId ? await findLegacySessionProfile(requestedId) : auth.activeProfile?.name || '')\n if (profile && auth.activeProfile?.name !== profile) {\n if (requestedId) await router.replace(sessionLocation(requestedId, profile))\n await ensureRouteProfile(profile)\n }\n // The session route is the authoritative navigation target. A secondary\n // unread-count request must never prevent its history from being restored.\n await chat.loadSessions(profile, 'chat')\n if (requestedId) {\n const target = await getSession(requestedId, profile).catch(() => undefined)\n if (target && !isOwnedChatSession(target)) {\n await router.replace({ path: `/history/${encodeURIComponent(requestedId)}`, query: { profile } })\n return\n }\n }\n if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)\n if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))\n void chat.loadUnread(profile).catch(() => undefined)\n if (!requestedId && chat.activeSession && !isOwnedChatSession(chat.activeSession)) {\n chat.clearSelection()\n }\n}\n\nasync function chooseSession(id: string) {\n outlineOpen.value = false\n preview.value = null\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name || 'default'\n await router.push(sessionLocation(id, profile))\n await ensureRouteProfile(profile)\n if (chat.activeProfileName !== profile) await chat.loadSessions(profile, 'chat')\n await chat.selectSession(id, profile)\n await chat.markRead(id, profile).catch(() => undefined)\n quoted.value = null\n}\n\nasync function createSession() {\n outlineOpen.value = false\n preview.value = null\n const id = chat.createSession(auth.activeProfile?.name)\n await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))\n}\n\nasync function send(payload: ComposerSubmit) {\n try {\n await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')\n composer.value?.clearAfterSend()\n } catch { /* store exposes the error and the composer keeps its draft */ }\n}\n\nfunction openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {\n const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)\n item.size = attachment.size\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; preview.value = null; filePreview.value = item }\n}\n\nfunction openMedia(item: UiLibraryItem) {\n const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')\n const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)\n mediaPreviewIndex.value = index >= 0 ? index : null\n}\n\nfunction openLocalFile({ name, url }: { name: string; url: string }) {\n const item = previewItemFromUrl(name, url)\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; filePreview.value = item }\n}\n\nasync function addPreviewToComposer(item: UiLibraryItem) {\n const file = await loadComposerFile(item)\n if (!file || !composer.value) return\n composer.value.attachFiles([file])\n preview.value = null\n filePreview.value = null\n mediaPreviewIndex.value = null\n await nextTick()\n composer.value?.focus()\n}\n\nasync function addMediaToComposer(media: PreviewMedia) {\n await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))\n}\n\nasync function selectModel(id: string) {\n if (id === selectedModelId.value) {\n modelDialog.value = false\n return\n }\n const model = modelForChoiceId(chat.models, id)\n if (!model || modelSwitching.value) return\n modelSwitching.value = true\n try {\n await chat.setModel(model)\n modelDialog.value = false\n } finally {\n modelSwitching.value = false\n }\n}\n\nfunction selectReasoning(id: string) {\n chat.reasoningEffort = id || undefined\n}\n\nasync function toggleFastMode(enabled: boolean) {\n try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }\n}\n\nfunction restoreShowThinking(profile = auth.activeProfile?.name || 'default') {\n showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)\n}\n\nfunction toggleShowThinking() {\n showThinking.value = !showThinking.value\n writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)\n}\n\nfunction openSessionActions(id: string, event?: MouseEvent) {\n actionSessionId.value = id\n const session = chat.sessions.find(item => item.id === id)\n renameValue.value = session?.title || ''\n renaming.value = false\n const menuWidth = 208\n const menuHeight = 210\n const inset = 8\n const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null\n const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14\n const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46\n actionMenuPosition.value = {\n x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),\n y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),\n }\n}\n\nfunction closeSessionActions() {\n actionSessionId.value = ''\n renaming.value = false\n}\n\nasync function forceRefreshHistory() {\n closeSessionActions()\n try { await chat.forceRefreshHistory() }\n catch { /* The chat store displays the refresh error without clearing messages. */ }\n}\n\nfunction handleSessionActionPointer(event: PointerEvent) {\n if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return\n closeSessionActions()\n}\n\nfunction handleSessionActionKey(event: KeyboardEvent) {\n if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()\n}\n\nasync function saveRename() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session || !renameValue.value.trim()) return\n await chat.renameSession(session.id, renameValue.value.trim(), session.profile)\n closeSessionActions()\n}\n\nasync function toggleSessionPinned() {\n const session = actionSession.value\n if (!session) return\n await chat.setSessionPinned(session.id, !session.pinned, session.profile)\n closeSessionActions()\n}\n\nasync function openSessionOutline() {\n const session = actionSession.value\n if (!session) return\n closeSessionActions()\n if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)\n preview.value = null\n outlineOpen.value = true\n}\n\nfunction closeInspector() {\n const restoreMenuFocus = outlineOpen.value\n preview.value = null\n outlineOpen.value = false\n if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nfunction navigateOutline(target: { messageId: string; anchorId: string }) {\n timeline.value?.scrollToAnchor(target.messageId, target.anchorId)\n if (window.matchMedia('(max-width: 900px)').matches) closeInspector()\n}\n\nasync function deleteSession() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session) return\n await chat.removeSession(session.id, session.profile)\n closeSessionActions()\n if (route.params.sessionId === session.id) await router.replace('/chat')\n}\n\nasync function branch() {\n const id = await chat.branchSession()\n if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))\n}\n\nasync function revealSourceMessage() {\n const messageId = typeof route.query.message === 'string' ? route.query.message : ''\n if (!messageId) return\n await nextTick()\n for (let attempt = 0; attempt < 10; attempt += 1) {\n if (timeline.value?.scrollToMessage(messageId)) return\n if (!chat.hasMoreBefore) return\n await chat.loadOlder()\n await nextTick()\n }\n}\n\nonMounted(async () => {\n restoreShowThinking()\n document.addEventListener('pointerdown', handleSessionActionPointer)\n document.addEventListener('keydown', handleSessionActionKey)\n window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n await refreshSessions()\n await Promise.allSettled([chat.loadModels(auth.activeProfile?.name), chat.connect()])\n void chat.refreshActiveSessionModel().catch(() => undefined)\n await revealSourceMessage()\n const pendingFile = await consumeLibraryItemForComposer()\n if (pendingFile) composer.value?.attachFiles([pendingFile])\n})\n\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleSessionActionPointer)\n document.removeEventListener('keydown', handleSessionActionKey)\n window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n})\n\nwatch(() => auth.activeProfile?.name, async (profile, previous) => {\n if (!profile || profile === previous) return\n restoreShowThinking(profile)\n outlineOpen.value = false\n preview.value = null\n if (restoringRouteProfile.value === profile) {\n restoringRouteProfile.value = ''\n return\n }\n chat.switchProfile(profile)\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n if (requestedId && routeProfile() === profile) {\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n await chat.selectSession(requestedId, profile)\n return\n }\n await router.replace({ path: '/chat', query: { profile } })\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n})\n\nwatch(() => chat.activeSessionId, async id => {\n const profile = chat.activeProfileName || auth.activeProfile?.name || ''\n if (id) void chat.refreshActiveSessionModel().catch(() => undefined)\n if (!id || (route.params.sessionId === id && routeProfile() === profile)) return\n await router.replace(sessionLocation(id, profile))\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"对话\" :sidebar-subtitle=\"`${sessions.length} 个会话`\" :inspector-open=\"!!preview || outlineOpen\" :inspector-close-label=\"outlineOpen ? '关闭会话大纲' : '关闭预览'\" @close-inspector=\"closeInspector\">\n <template #sidebar-action>\n <button class=\"sidebar-primary-action\" type=\"button\" title=\"新建聊天\" aria-label=\"新建聊天\" @click=\"createSession\">\n <YaoYaoSidebarIcon name=\"add\" />\n <span>新建聊天</span>\n </button>\n </template>\n <template #sidebar>\n <ResourceSidebar\n :items=\"sidebarItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n external-search\n single-line\n :has-more=\"chat.hasMoreSessions\"\n :loading-more=\"chat.isLoadingMoreSessions\"\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"新建会话后,从输入框开始聊天。\"\n @load-more=\"chat.loadMoreSessions(auth.activeProfile?.name)\"\n @select=\"chooseSession\"\n @more=\"openSessionActions\"\n @context-menu=\"openSessionActions\"\n />\n </template>\n\n <div class=\"chat-workspace\">\n <MessageTimeline\n ref=\"timeline\"\n :messages=\"messages\"\n :title=\"activeSession?.title || '新会话'\"\n :subtitle=\"activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || chat.selectedModel?.name || '默认模型'}` : '选择会话或直接开始输入'\"\n :loading=\"chat.activeRouteState?.isLoadingHistory\"\n :loading-older=\"chat.activeRouteState?.isLoadingHistory\"\n :has-older=\"chat.hasMoreBefore\"\n :connected=\"connected\"\n :synced=\"chat.historySynced\"\n :show-tools=\"showThinking\"\n :thinking=\"chat.isSending || chat.isStreaming\"\n :show-assistant-identity=\"false\"\n :agent-avatars=\"agentAvatars\"\n :interaction=\"interaction\"\n empty-logo\n transparent-header\n :fork-source-title=\"forkSourceTitle\"\n @load-older=\"chat.loadOlder\"\n @quote=\"quoted = $event\"\n @branch=\"branch\"\n @preview=\"openAttachment\"\n @preview-file=\"openLocalFile\"\n @approve=\"interaction && chat.respondToApproval(interaction.id, $event)\"\n @clarify=\"interaction && chat.respondToClarification(interaction.id, $event)\"\n >\n <template #header-actions>\n <button v-if=\"activeSession\" ref=\"headerSessionMenuButton\" class=\"icon-button header-session-menu\" type=\"button\" title=\"会话操作\" aria-label=\"会话操作\" @click=\"openSessionActions(activeSession.id, $event)\"><AppIcon name=\"dots\" :size=\"18\" /></button>\n </template>\n </MessageTimeline>\n <p v-if=\"chat.error\" class=\"chat-error\" role=\"alert\"><AppIcon name=\"alert\" :size=\"13\" />{{ chat.error }}</p>\n <ComposerShell\n ref=\"composer\"\n mode=\"chat\"\n :draft-key=\"`${auth.user?.id || 'local'}:${auth.activeProfile?.name || 'default'}:${chat.activeSessionId || 'new'}`\"\n :disabled=\"chat.connectionState === 'failed'\"\n :streaming=\"chat.isStreaming\"\n :sending=\"chat.isSending\"\n :model-label=\"chat.selectedModel?.name || '选择模型'\"\n :fast-mode=\"chat.fastMode\"\n :fast-mode-disabled=\"!chat.activeSessionId\"\n :reasoning-effort=\"reasoningLabel\"\n :reasoning-value=\"chat.reasoningEffort || ''\"\n :reasoning-options=\"reasoningComposerOptions\"\n :context-used=\"contextUsed\"\n :context-limit=\"chat.contextUsage?.contextLimit || 262144\"\n :context-estimated=\"contextIsEstimated\"\n :queue-mode=\"queueMode || chat.isQueued\"\n :tool-trace-visible=\"showThinking\"\n :reference=\"reference\"\n :slash-commands=\"[\n { id: 'fork', label: 'fork', detail: '从当前会话创建分支' },\n { id: 'compact', label: 'compact', detail: '压缩当前会话上下文' },\n { id: 'model', label: 'model', detail: '切换模型' },\n ]\"\n @send=\"send\"\n @stop=\"chat.interrupt\"\n @model-click=\"modelDialog = true\"\n @fast-mode-toggle=\"toggleFastMode\"\n @reasoning-change=\"selectReasoning\"\n @settings-click=\"toggleShowThinking\"\n @queue-toggle=\"queueMode = !queueMode\"\n @clear-reference=\"quoted = null\"\n />\n </div>\n\n <template #inspector>\n <SessionOutline v-if=\"outlineOpen\" :messages=\"messages\" :has-older=\"chat.hasMoreBefore\" @navigate=\"navigateOutline\" />\n <PreviewInspector v-else-if=\"preview\" :item=\"preview\" @close=\"preview = null\" @add-to-composer=\"addPreviewToComposer\" />\n </template>\n </WorkspaceView>\n\n <FloatingResourceSearch section=\"chat\" label=\"搜索会话\" :items=\"sidebarItems\" @select=\"chooseSession\" />\n <PreviewModal v-if=\"filePreview\" :item=\"filePreview\" :items=\"conversationMediaItems\" @close=\"filePreview = null\" @add-to-composer=\"addPreviewToComposer\" @source=\"filePreview = null\" />\n <ImagePreviewLightbox v-model=\"mediaPreviewIndex\" :images=\"lightboxMedia\" @add=\"addMediaToComposer\" />\n\n <ModelChoiceDialog :open=\"modelDialog\" :options=\"chat.models\" :selected-id=\"selectedModelId\" :busy=\"modelSwitching\" @close=\"modelDialog = false\" @select=\"selectModel\" />\n\n <Teleport to=\"body\">\n <Transition name=\"session-menu\">\n <section v-if=\"actionSessionId\" class=\"session-actions\" :style=\"actionMenuStyle\" role=\"menu\" aria-label=\"会话操作\" @contextmenu.prevent>\n <template v-if=\"renaming\">\n <label>会话名称<input v-model=\"renameValue\" maxlength=\"120\" autofocus @keydown.enter=\"saveRename\" /></label>\n <div><button class=\"quiet-button\" type=\"button\" @click=\"renaming = false\">取消</button><button class=\"solid-button\" type=\"button\" @click=\"saveRename\">保存</button></div>\n </template>\n <template v-else>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"openSessionOutline\"><AppIcon name=\"menu\" :size=\"14\" />会话大纲</button>\n <button v-if=\"actionSessionId === chat.activeSessionId\" class=\"action-row\" role=\"menuitem\" type=\"button\" :disabled=\"chat.isStreaming || chat.isQueued || chat.isSending || chat.activeRouteState?.isLoadingHistory\" @click=\"forceRefreshHistory\"><AppIcon name=\"refresh\" :size=\"14\" />强制刷新历史</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"toggleSessionPinned\"><AppIcon :name=\"actionSession?.pinned ? 'pin-off' : 'pin'\" :size=\"14\" />{{ actionSession?.pinned ? '取消置顶' : '置顶会话' }}</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"renaming = true\"><AppIcon name=\"edit\" :size=\"14\" />重命名</button>\n <button class=\"action-row danger\" role=\"menuitem\" type=\"button\" @click=\"deleteSession\"><AppIcon name=\"trash\" :size=\"14\" />删除会话</button>\n </template>\n </section>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.sidebar-primary-action { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; font-size: 12px; font-weight: 610; text-align: left; transition: background-color 120ms ease; }\n.sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }\n.sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }\n.header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }\n.chat-error { display: flex; width: min(760px, calc(100% - 32px)); margin: 0 auto 4px; align-items: center; gap: 6px; color: var(--danger); font-size: 9px; }\n.session-actions { position: fixed; z-index: 205; width: 208px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 12px 34px rgba(0,0,0,.16); }.action-row { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; text-align: left; }.action-row:hover, .action-row:focus-visible { outline: 0; background: var(--surface-soft); color: var(--text-primary); }.action-row.danger { color: var(--danger); }.session-actions label { display: flex; flex-direction: column; gap: 6px; padding: 4px; color: var(--text-muted); font-size: 9px; }.session-actions input { width: 100%; height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-soft); color: var(--text-primary); font-size: 11px; }.session-actions input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--focus-ring); }.session-actions > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; padding: 0 4px 3px; }.session-actions :deep(.quiet-button), .session-actions :deep(.solid-button) { min-height: 29px; padding-inline: 10px; font-size: 10px; }\n.session-menu-enter-active, .session-menu-leave-active { transition: opacity 100ms ease, transform 120ms var(--ease-out); transform-origin: top right; }.session-menu-enter-from, .session-menu-leave-to { opacity: 0; transform: translateY(-3px) scale(.98); }\n@media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }\n</style>\n"],"mappings":"8tBAEA,IAAM,EAAM,sCAcZ,eAAsB,EAAiB,EAAgD,CACrF,IAAM,EAAM,EAAK,aAAe,EAAK,WACrC,GAAI,CAAC,GAAO,CAAC,EAAK,KAAM,OAAO,KAC/B,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,EAAK,CAAE,YAAa,aAAc,CAAC,EAChE,GAAI,CAAC,EAAS,GAAI,MAAU,MAAM,UAAU,EAAS,OAAO,EAAE,EAC9D,IAAM,EAAO,MAAM,EAAS,KAAK,EACjC,OAAO,IAAI,KAAK,CAAC,CAAI,EAAG,EAAK,KAAM,CAAE,KAAM,EAAK,UAAY,EAAK,MAAQ,0BAA2B,CAAC,CACvG,MAAQ,CACN,OAAO,IACT,CACF,CAEA,eAAsB,IAAsD,CAC1E,IAAM,EAAM,eAAe,QAAQ,CAAG,EACtC,GAAI,CAAC,EAAK,OAAO,KACjB,eAAe,WAAW,CAAG,EAC7B,GAAI,CACF,IAAM,EAAU,KAAK,MAAM,CAAG,EAC9B,OAAO,MAAM,EAAiB,CAAE,KAAM,EAAQ,KAAM,YAAa,EAAQ,IAAK,SAAU,EAAQ,QAAS,CAAC,CAC5G,MAAQ,CACN,OAAO,IACT,CACF,gICPA,IAAM,EAAO,GAAa,EACpB,EAAO,GAAa,EACpB,EAAQ,GAAS,EACjB,EAAS,GAAU,EACnB,EAAS,EAAs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,OAAI,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"ChatView-BNqHa6Ma.js","names":[],"sources":["../../src/client/components/workspace/pendingComposer.ts","../../src/client/views/ChatView.vue","../../src/client/views/ChatView.vue"],"sourcesContent":["import type { UiLibraryItem } from '@/components/library/types'\n\nconst KEY = 'hermes-yaoyao:pending-composer-item'\n\ntype PendingItem = { name: string; url: string; mimeType?: string }\n\ntype ComposerFileSource = Pick<UiLibraryItem, 'name' | 'previewUrl' | 'downloadUrl' | 'mimeType'>\n\nexport function queueLibraryItemForComposer(item: UiLibraryItem): boolean {\n const url = item.downloadUrl || item.previewUrl\n if (!url) return false\n const pending: PendingItem = { name: item.name, url, mimeType: item.mimeType }\n sessionStorage.setItem(KEY, JSON.stringify(pending))\n return true\n}\n\nexport async function loadComposerFile(item: ComposerFileSource): Promise<File | null> {\n const url = item.downloadUrl || item.previewUrl\n if (!url || !item.name) return null\n try {\n const response = await fetch(url, { credentials: 'same-origin' })\n if (!response.ok) throw new Error(`下载文件失败(${response.status})`)\n const blob = await response.blob()\n return new File([blob], item.name, { type: item.mimeType || blob.type || 'application/octet-stream' })\n } catch {\n return null\n }\n}\n\nexport async function consumeLibraryItemForComposer(): Promise<File | null> {\n const raw = sessionStorage.getItem(KEY)\n if (!raw) return null\n sessionStorage.removeItem(KEY)\n try {\n const pending = JSON.parse(raw) as PendingItem\n return await loadComposerFile({ name: pending.name, downloadUrl: pending.url, mimeType: pending.mimeType })\n } catch {\n return null\n }\n}\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRoute, useRouter } from 'vue-router'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport YaoYaoSidebarIcon from '@/components/common/YaoYaoSidebarIcon.vue'\nimport type { ChoiceOption } from '@/components/common/types'\nimport ComposerShell from '@/components/composer/ComposerShell.vue'\nimport ModelChoiceDialog from '@/components/composer/ModelChoiceDialog.vue'\nimport type { ComposerOption, ComposerReference, ComposerSubmit } from '@/components/composer/types'\nimport PreviewInspector from '@/components/library/PreviewInspector.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 { UiLibraryItem } from '@/components/library/types'\nimport { mediaItemsFromMessages, mediaUrlIdentity, previewItemFromUrl } from '@/components/library/mediaSequence'\nimport MessageTimeline from '@/components/messages/MessageTimeline.vue'\nimport SessionOutline from '@/components/messages/SessionOutline.vue'\nimport type { UiMessage } from '@/components/messages/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport FloatingResourceSearch from '@/components/app/FloatingResourceSearch.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { chatInteraction, chatMessagesToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { consumeLibraryItemForComposer, loadComposerFile } from '@/components/workspace/pendingComposer'\nimport { readAgentShowThinking, writeAgentShowThinking } from '@/utils/sessionPreferences'\nimport { modelChoiceId, modelForChoiceId } from '@/utils/sessionModel'\nimport { MODEL_CATALOG_CHANGED_EVENT, modelCatalogChangedProfile } from '@/utils/modelCatalogEvents'\nimport { estimateConversationTokens } from '@/utils/contextUsage'\nimport { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst route = useRoute()\nconst router = useRouter()\nconst quoted = ref<UiMessage | null>(null)\nconst preview = ref<UiLibraryItem | null>(null)\nconst filePreview = ref<UiLibraryItem | null>(null)\nconst mediaPreviewIndex = ref<number | null>(null)\nconst outlineOpen = ref(false)\nconst modelDialog = ref(false)\nconst modelSwitching = ref(false)\nconst showThinking = ref(false)\nconst queueMode = ref(false)\nconst actionSessionId = ref('')\nconst renaming = ref(false)\nconst renameValue = ref('')\nconst actionMenuPosition = ref({ x: 8, y: 8 })\nconst composer = ref<InstanceType<typeof ComposerShell> | null>(null)\nconst timeline = ref<InstanceType<typeof MessageTimeline> | null>(null)\nconst headerSessionMenuButton = ref<HTMLButtonElement | null>(null)\nconst restoringRouteProfile = ref('')\n\nfunction handleModelCatalogChanged(event: Event) {\n const profile = modelCatalogChangedProfile(event)\n if (profile && profile === auth.activeProfile?.name) void chat.loadModels(profile).catch(() => undefined)\n}\n\nconst sessions = computed(() => [...chat.sessions]\n .filter(isOwnedChatSession))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [\n profile.name,\n profile.agentName || profile.displayName || profile.name,\n])))\nconst agentAvatars = computed(() => Object.fromEntries(auth.profiles.flatMap(profile =>\n profile.agentAvatar ? [[profile.name, profile.agentAvatar] as const] : []\n)))\nconst sidebarItems = computed(() => sessions.value.map(session => sessionSidebarItem(\n session,\n chat.unreadCounts[session.id] ?? 0,\n agentNames.value.get(session.profile || auth.activeProfile?.name || ''),\n)))\nconst messages = computed(() => chatMessagesToUi(chat.messages, profile => profile ? agentNames.value.get(profile) : undefined))\nconst reportedContextTokens = computed(() => chat.contextUsage?.contextTokens\n || chat.contextUsage?.totalTokens\n || (activeSession.value?.inputTokens ?? 0) + (activeSession.value?.outputTokens ?? 0))\nconst estimatedContextTokens = computed(() => estimateConversationTokens(chat.messages))\nconst contextUsed = computed(() => reportedContextTokens.value || estimatedContextTokens.value)\nconst contextIsEstimated = computed(() => !reportedContextTokens.value && contextUsed.value > 0)\nconst conversationMediaItems = computed(() => mediaItemsFromMessages(messages.value))\nconst lightboxMedia = computed(() => conversationMediaItems.value.map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst activeSession = computed(() => chat.activeSession)\nconst actionSession = computed(() => chat.sessions.find(session => session.id === actionSessionId.value))\nconst connected = computed(() => ['connected', 'ready'].includes(chat.connectionState))\nconst interaction = computed(() => chatInteraction(chat.pendingApproval, chat.pendingClarification))\nconst reference = computed<ComposerReference | null>(() => quoted.value ? { id: quoted.value.id, content: quoted.value.content, author: quoted.value.author } : null)\nconst forkSourceTitle = computed(() => {\n const parentId = activeSession.value?.parentSessionId\n if (!parentId) return ''\n return chat.sessions.find(session => session.id === parentId && session.profile === activeSession.value?.profile)?.title || parentId\n})\nconst selectedModelId = computed(() => chat.selectedModel ? modelChoiceId(chat.selectedModel) : '')\nconst reasoningOptions: ChoiceOption[] = [\n { id: '', label: '默认', description: '使用模型或 Profile 的默认强度' },\n { id: 'none', label: '关闭', description: '不使用额外推理' },\n { id: 'low', label: '低', description: '更快的轻量推理' },\n { id: 'medium', label: '中', description: '速度与深度平衡' },\n { id: 'high', label: '高', description: '更深入地分析复杂问题' },\n { id: 'xhigh', label: '极高', description: '适用于最复杂的任务' },\n]\nconst reasoningComposerOptions = computed<ComposerOption[]>(() => reasoningOptions.map(option => ({\n id: option.id,\n label: option.label,\n detail: option.description,\n})))\nconst reasoningLabel = computed(() => reasoningOptions.find(option => option.id === (chat.reasoningEffort || ''))?.label || '默认')\nconst actionMenuStyle = computed(() => ({ left: `${actionMenuPosition.value.x}px`, top: `${actionMenuPosition.value.y}px` }))\n\nfunction routeProfile(): string {\n const value = typeof route.query.profile === 'string' ? route.query.profile : ''\n return auth.profiles.some(profile => profile.name === value) ? value : ''\n}\n\nfunction sessionLocation(id: string, profile: string) {\n return { path: `/chat/${encodeURIComponent(id)}`, query: { profile } }\n}\n\nasync function findLegacySessionProfile(sessionId: string): Promise<string> {\n for (const profile of auth.profiles) {\n try {\n const session = await getSession(sessionId, profile.name)\n if (session.id === sessionId) return profile.name\n } catch { /* Try the next profile: 9119 returns 404 for a foreign session. */ }\n }\n return auth.activeProfile?.name || ''\n}\n\nasync function ensureRouteProfile(profile: string): Promise<void> {\n if (!profile || auth.activeProfile?.name === profile) return\n chat.switchProfile(profile)\n restoringRouteProfile.value = profile\n auth.selectProfile(profile)\n await nextTick()\n}\n\nasync function refreshSessions() {\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n const profile = routeProfile() || (requestedId ? await findLegacySessionProfile(requestedId) : auth.activeProfile?.name || '')\n if (profile && auth.activeProfile?.name !== profile) {\n if (requestedId) await router.replace(sessionLocation(requestedId, profile))\n await ensureRouteProfile(profile)\n }\n // The session route is the authoritative navigation target. A secondary\n // unread-count request must never prevent its history from being restored.\n await chat.loadSessions(profile, 'chat')\n if (requestedId) {\n const target = await getSession(requestedId, profile).catch(() => undefined)\n if (target && !isOwnedChatSession(target)) {\n await router.replace({ path: `/history/${encodeURIComponent(requestedId)}`, query: { profile } })\n return\n }\n }\n if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)\n if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))\n void chat.loadUnread(profile).catch(() => undefined)\n if (!requestedId && chat.activeSession && !isOwnedChatSession(chat.activeSession)) {\n chat.clearSelection()\n }\n}\n\nasync function chooseSession(id: string) {\n outlineOpen.value = false\n preview.value = null\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name || 'default'\n await router.push(sessionLocation(id, profile))\n await ensureRouteProfile(profile)\n if (chat.activeProfileName !== profile) await chat.loadSessions(profile, 'chat')\n await chat.selectSession(id, profile)\n await chat.markRead(id, profile).catch(() => undefined)\n quoted.value = null\n}\n\nasync function createSession() {\n outlineOpen.value = false\n preview.value = null\n const id = chat.createSession(auth.activeProfile?.name)\n await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))\n}\n\nasync function send(payload: ComposerSubmit) {\n try {\n await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')\n composer.value?.clearAfterSend()\n } catch { /* store exposes the error and the composer keeps its draft */ }\n}\n\nfunction openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {\n const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)\n item.size = attachment.size\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; preview.value = null; filePreview.value = item }\n}\n\nfunction openMedia(item: UiLibraryItem) {\n const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')\n const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)\n mediaPreviewIndex.value = index >= 0 ? index : null\n}\n\nfunction openLocalFile({ name, url }: { name: string; url: string }) {\n const item = previewItemFromUrl(name, url)\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; filePreview.value = item }\n}\n\nasync function addPreviewToComposer(item: UiLibraryItem) {\n const file = await loadComposerFile(item)\n if (!file || !composer.value) return\n composer.value.attachFiles([file])\n preview.value = null\n filePreview.value = null\n mediaPreviewIndex.value = null\n await nextTick()\n composer.value?.focus()\n}\n\nasync function addMediaToComposer(media: PreviewMedia) {\n await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))\n}\n\nasync function selectModel(id: string) {\n if (id === selectedModelId.value) {\n modelDialog.value = false\n return\n }\n const model = modelForChoiceId(chat.models, id)\n if (!model || modelSwitching.value) return\n modelSwitching.value = true\n try {\n await chat.setModel(model)\n modelDialog.value = false\n } finally {\n modelSwitching.value = false\n }\n}\n\nfunction selectReasoning(id: string) {\n chat.reasoningEffort = id || undefined\n}\n\nasync function toggleFastMode(enabled: boolean) {\n try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }\n}\n\nfunction restoreShowThinking(profile = auth.activeProfile?.name || 'default') {\n showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)\n}\n\nfunction toggleShowThinking() {\n showThinking.value = !showThinking.value\n writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)\n}\n\nfunction openSessionActions(id: string, event?: MouseEvent) {\n actionSessionId.value = id\n const session = chat.sessions.find(item => item.id === id)\n renameValue.value = session?.title || ''\n renaming.value = false\n const menuWidth = 208\n const menuHeight = 210\n const inset = 8\n const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null\n const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14\n const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46\n actionMenuPosition.value = {\n x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),\n y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),\n }\n}\n\nfunction closeSessionActions() {\n actionSessionId.value = ''\n renaming.value = false\n}\n\nasync function forceRefreshHistory() {\n closeSessionActions()\n try { await chat.forceRefreshHistory() }\n catch { /* The chat store displays the refresh error without clearing messages. */ }\n}\n\nfunction handleSessionActionPointer(event: PointerEvent) {\n if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return\n closeSessionActions()\n}\n\nfunction handleSessionActionKey(event: KeyboardEvent) {\n if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()\n}\n\nasync function saveRename() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session || !renameValue.value.trim()) return\n await chat.renameSession(session.id, renameValue.value.trim(), session.profile)\n closeSessionActions()\n}\n\nasync function toggleSessionPinned() {\n const session = actionSession.value\n if (!session) return\n await chat.setSessionPinned(session.id, !session.pinned, session.profile)\n closeSessionActions()\n}\n\nasync function openSessionOutline() {\n const session = actionSession.value\n if (!session) return\n closeSessionActions()\n if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)\n preview.value = null\n outlineOpen.value = true\n}\n\nfunction closeInspector() {\n const restoreMenuFocus = outlineOpen.value\n preview.value = null\n outlineOpen.value = false\n if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nfunction navigateOutline(target: { messageId: string; anchorId: string }) {\n timeline.value?.scrollToAnchor(target.messageId, target.anchorId)\n if (window.matchMedia('(max-width: 900px)').matches) closeInspector()\n}\n\nasync function deleteSession() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session) return\n await chat.removeSession(session.id, session.profile)\n closeSessionActions()\n if (route.params.sessionId === session.id) await router.replace('/chat')\n}\n\nasync function branch() {\n const id = await chat.branchSession()\n if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))\n}\n\nasync function revealSourceMessage() {\n const messageId = typeof route.query.message === 'string' ? route.query.message : ''\n if (!messageId) return\n await nextTick()\n for (let attempt = 0; attempt < 10; attempt += 1) {\n if (timeline.value?.scrollToMessage(messageId)) return\n if (!chat.hasMoreBefore) return\n await chat.loadOlder()\n await nextTick()\n }\n}\n\nonMounted(async () => {\n restoreShowThinking()\n document.addEventListener('pointerdown', handleSessionActionPointer)\n document.addEventListener('keydown', handleSessionActionKey)\n window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n await refreshSessions()\n await Promise.allSettled([chat.loadModels(auth.activeProfile?.name), chat.connect()])\n void chat.refreshActiveSessionModel().catch(() => undefined)\n await revealSourceMessage()\n const pendingFile = await consumeLibraryItemForComposer()\n if (pendingFile) composer.value?.attachFiles([pendingFile])\n})\n\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleSessionActionPointer)\n document.removeEventListener('keydown', handleSessionActionKey)\n window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n})\n\nwatch(() => auth.activeProfile?.name, async (profile, previous) => {\n if (!profile || profile === previous) return\n restoreShowThinking(profile)\n outlineOpen.value = false\n preview.value = null\n if (restoringRouteProfile.value === profile) {\n restoringRouteProfile.value = ''\n return\n }\n chat.switchProfile(profile)\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n if (requestedId && routeProfile() === profile) {\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n await chat.selectSession(requestedId, profile)\n return\n }\n await router.replace({ path: '/chat', query: { profile } })\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n})\n\nwatch(() => chat.activeSessionId, async id => {\n const profile = chat.activeProfileName || auth.activeProfile?.name || ''\n if (id) void chat.refreshActiveSessionModel().catch(() => undefined)\n if (!id || (route.params.sessionId === id && routeProfile() === profile)) return\n await router.replace(sessionLocation(id, profile))\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"对话\" :sidebar-subtitle=\"`${sessions.length} 个会话`\" :inspector-open=\"!!preview || outlineOpen\" :inspector-close-label=\"outlineOpen ? '关闭会话大纲' : '关闭预览'\" @close-inspector=\"closeInspector\">\n <template #sidebar-action>\n <button class=\"sidebar-primary-action\" type=\"button\" title=\"新建聊天\" aria-label=\"新建聊天\" @click=\"createSession\">\n <YaoYaoSidebarIcon name=\"add\" />\n <span>新建聊天</span>\n </button>\n </template>\n <template #sidebar>\n <ResourceSidebar\n :items=\"sidebarItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n external-search\n single-line\n :has-more=\"chat.hasMoreSessions\"\n :loading-more=\"chat.isLoadingMoreSessions\"\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"新建会话后,从输入框开始聊天。\"\n @load-more=\"chat.loadMoreSessions(auth.activeProfile?.name)\"\n @select=\"chooseSession\"\n @more=\"openSessionActions\"\n @context-menu=\"openSessionActions\"\n />\n </template>\n\n <div class=\"chat-workspace\">\n <MessageTimeline\n ref=\"timeline\"\n :messages=\"messages\"\n :title=\"activeSession?.title || '新会话'\"\n :subtitle=\"activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || chat.selectedModel?.name || '默认模型'}` : '选择会话或直接开始输入'\"\n :loading=\"chat.activeRouteState?.isLoadingHistory\"\n :loading-older=\"chat.activeRouteState?.isLoadingHistory\"\n :has-older=\"chat.hasMoreBefore\"\n :connected=\"connected\"\n :synced=\"chat.historySynced\"\n :show-tools=\"showThinking\"\n :thinking=\"chat.isSending || chat.isStreaming\"\n :show-assistant-identity=\"false\"\n :agent-avatars=\"agentAvatars\"\n :interaction=\"interaction\"\n empty-logo\n transparent-header\n :fork-source-title=\"forkSourceTitle\"\n @load-older=\"chat.loadOlder\"\n @quote=\"quoted = $event\"\n @branch=\"branch\"\n @preview=\"openAttachment\"\n @preview-file=\"openLocalFile\"\n @approve=\"interaction && chat.respondToApproval(interaction.id, $event)\"\n @clarify=\"interaction && chat.respondToClarification(interaction.id, $event)\"\n >\n <template #header-actions>\n <button v-if=\"activeSession\" ref=\"headerSessionMenuButton\" class=\"icon-button header-session-menu\" type=\"button\" title=\"会话操作\" aria-label=\"会话操作\" @click=\"openSessionActions(activeSession.id, $event)\"><AppIcon name=\"dots\" :size=\"18\" /></button>\n </template>\n </MessageTimeline>\n <p v-if=\"chat.error\" class=\"chat-error\" role=\"alert\"><AppIcon name=\"alert\" :size=\"13\" />{{ chat.error }}</p>\n <ComposerShell\n ref=\"composer\"\n mode=\"chat\"\n :draft-key=\"`${auth.user?.id || 'local'}:${auth.activeProfile?.name || 'default'}:${chat.activeSessionId || 'new'}`\"\n :disabled=\"chat.connectionState === 'failed'\"\n :streaming=\"chat.isStreaming\"\n :sending=\"chat.isSending\"\n :model-label=\"chat.selectedModel?.name || '选择模型'\"\n :fast-mode=\"chat.fastMode\"\n :fast-mode-disabled=\"!chat.activeSessionId\"\n :reasoning-effort=\"reasoningLabel\"\n :reasoning-value=\"chat.reasoningEffort || ''\"\n :reasoning-options=\"reasoningComposerOptions\"\n :context-used=\"contextUsed\"\n :context-limit=\"chat.contextUsage?.contextLimit || 262144\"\n :context-estimated=\"contextIsEstimated\"\n :queue-mode=\"queueMode || chat.isQueued\"\n :tool-trace-visible=\"showThinking\"\n :reference=\"reference\"\n :slash-commands=\"[\n { id: 'fork', label: 'fork', detail: '从当前会话创建分支' },\n { id: 'compact', label: 'compact', detail: '压缩当前会话上下文' },\n { id: 'model', label: 'model', detail: '切换模型' },\n ]\"\n @send=\"send\"\n @stop=\"chat.interrupt\"\n @model-click=\"modelDialog = true\"\n @fast-mode-toggle=\"toggleFastMode\"\n @reasoning-change=\"selectReasoning\"\n @settings-click=\"toggleShowThinking\"\n @queue-toggle=\"queueMode = !queueMode\"\n @clear-reference=\"quoted = null\"\n />\n </div>\n\n <template #inspector>\n <SessionOutline v-if=\"outlineOpen\" :messages=\"messages\" :has-older=\"chat.hasMoreBefore\" @navigate=\"navigateOutline\" />\n <PreviewInspector v-else-if=\"preview\" :item=\"preview\" @close=\"preview = null\" @add-to-composer=\"addPreviewToComposer\" />\n </template>\n </WorkspaceView>\n\n <FloatingResourceSearch section=\"chat\" label=\"搜索会话\" :items=\"sidebarItems\" @select=\"chooseSession\" />\n <PreviewModal v-if=\"filePreview\" :item=\"filePreview\" :items=\"conversationMediaItems\" @close=\"filePreview = null\" @add-to-composer=\"addPreviewToComposer\" @source=\"filePreview = null\" />\n <ImagePreviewLightbox v-model=\"mediaPreviewIndex\" :images=\"lightboxMedia\" @add=\"addMediaToComposer\" />\n\n <ModelChoiceDialog :open=\"modelDialog\" :options=\"chat.models\" :selected-id=\"selectedModelId\" :busy=\"modelSwitching\" @close=\"modelDialog = false\" @select=\"selectModel\" />\n\n <Teleport to=\"body\">\n <Transition name=\"session-menu\">\n <section v-if=\"actionSessionId\" class=\"session-actions\" :style=\"actionMenuStyle\" role=\"menu\" aria-label=\"会话操作\" @contextmenu.prevent>\n <template v-if=\"renaming\">\n <label>会话名称<input v-model=\"renameValue\" maxlength=\"120\" autofocus @keydown.enter=\"saveRename\" /></label>\n <div><button class=\"quiet-button\" type=\"button\" @click=\"renaming = false\">取消</button><button class=\"solid-button\" type=\"button\" @click=\"saveRename\">保存</button></div>\n </template>\n <template v-else>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"openSessionOutline\"><AppIcon name=\"menu\" :size=\"14\" />会话大纲</button>\n <button v-if=\"actionSessionId === chat.activeSessionId\" class=\"action-row\" role=\"menuitem\" type=\"button\" :disabled=\"chat.isStreaming || chat.isQueued || chat.isSending || chat.activeRouteState?.isLoadingHistory\" @click=\"forceRefreshHistory\"><AppIcon name=\"refresh\" :size=\"14\" />强制刷新历史</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"toggleSessionPinned\"><AppIcon :name=\"actionSession?.pinned ? 'pin-off' : 'pin'\" :size=\"14\" />{{ actionSession?.pinned ? '取消置顶' : '置顶会话' }}</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"renaming = true\"><AppIcon name=\"edit\" :size=\"14\" />重命名</button>\n <button class=\"action-row danger\" role=\"menuitem\" type=\"button\" @click=\"deleteSession\"><AppIcon name=\"trash\" :size=\"14\" />删除会话</button>\n </template>\n </section>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.sidebar-primary-action { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; font-size: 12px; font-weight: 610; text-align: left; transition: background-color 120ms ease; }\n.sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }\n.sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }\n.header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }\n.chat-error { display: flex; width: min(760px, calc(100% - 32px)); margin: 0 auto 4px; align-items: center; gap: 6px; color: var(--danger); font-size: 9px; }\n.session-actions { position: fixed; z-index: 205; width: 208px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 12px 34px rgba(0,0,0,.16); }.action-row { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; text-align: left; }.action-row:hover, .action-row:focus-visible { outline: 0; background: var(--surface-soft); color: var(--text-primary); }.action-row.danger { color: var(--danger); }.session-actions label { display: flex; flex-direction: column; gap: 6px; padding: 4px; color: var(--text-muted); font-size: 9px; }.session-actions input { width: 100%; height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-soft); color: var(--text-primary); font-size: 11px; }.session-actions input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--focus-ring); }.session-actions > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; padding: 0 4px 3px; }.session-actions :deep(.quiet-button), .session-actions :deep(.solid-button) { min-height: 29px; padding-inline: 10px; font-size: 10px; }\n.session-menu-enter-active, .session-menu-leave-active { transition: opacity 100ms ease, transform 120ms var(--ease-out); transform-origin: top right; }.session-menu-enter-from, .session-menu-leave-to { opacity: 0; transform: translateY(-3px) scale(.98); }\n@media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRoute, useRouter } from 'vue-router'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport YaoYaoSidebarIcon from '@/components/common/YaoYaoSidebarIcon.vue'\nimport type { ChoiceOption } from '@/components/common/types'\nimport ComposerShell from '@/components/composer/ComposerShell.vue'\nimport ModelChoiceDialog from '@/components/composer/ModelChoiceDialog.vue'\nimport type { ComposerOption, ComposerReference, ComposerSubmit } from '@/components/composer/types'\nimport PreviewInspector from '@/components/library/PreviewInspector.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 { UiLibraryItem } from '@/components/library/types'\nimport { mediaItemsFromMessages, mediaUrlIdentity, previewItemFromUrl } from '@/components/library/mediaSequence'\nimport MessageTimeline from '@/components/messages/MessageTimeline.vue'\nimport SessionOutline from '@/components/messages/SessionOutline.vue'\nimport type { UiMessage } from '@/components/messages/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport FloatingResourceSearch from '@/components/app/FloatingResourceSearch.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { chatInteraction, chatMessagesToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { consumeLibraryItemForComposer, loadComposerFile } from '@/components/workspace/pendingComposer'\nimport { readAgentShowThinking, writeAgentShowThinking } from '@/utils/sessionPreferences'\nimport { modelChoiceId, modelForChoiceId } from '@/utils/sessionModel'\nimport { MODEL_CATALOG_CHANGED_EVENT, modelCatalogChangedProfile } from '@/utils/modelCatalogEvents'\nimport { estimateConversationTokens } from '@/utils/contextUsage'\nimport { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst route = useRoute()\nconst router = useRouter()\nconst quoted = ref<UiMessage | null>(null)\nconst preview = ref<UiLibraryItem | null>(null)\nconst filePreview = ref<UiLibraryItem | null>(null)\nconst mediaPreviewIndex = ref<number | null>(null)\nconst outlineOpen = ref(false)\nconst modelDialog = ref(false)\nconst modelSwitching = ref(false)\nconst showThinking = ref(false)\nconst queueMode = ref(false)\nconst actionSessionId = ref('')\nconst renaming = ref(false)\nconst renameValue = ref('')\nconst actionMenuPosition = ref({ x: 8, y: 8 })\nconst composer = ref<InstanceType<typeof ComposerShell> | null>(null)\nconst timeline = ref<InstanceType<typeof MessageTimeline> | null>(null)\nconst headerSessionMenuButton = ref<HTMLButtonElement | null>(null)\nconst restoringRouteProfile = ref('')\n\nfunction handleModelCatalogChanged(event: Event) {\n const profile = modelCatalogChangedProfile(event)\n if (profile && profile === auth.activeProfile?.name) void chat.loadModels(profile).catch(() => undefined)\n}\n\nconst sessions = computed(() => [...chat.sessions]\n .filter(isOwnedChatSession))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [\n profile.name,\n profile.agentName || profile.displayName || profile.name,\n])))\nconst agentAvatars = computed(() => Object.fromEntries(auth.profiles.flatMap(profile =>\n profile.agentAvatar ? [[profile.name, profile.agentAvatar] as const] : []\n)))\nconst sidebarItems = computed(() => sessions.value.map(session => sessionSidebarItem(\n session,\n chat.unreadCounts[session.id] ?? 0,\n agentNames.value.get(session.profile || auth.activeProfile?.name || ''),\n)))\nconst messages = computed(() => chatMessagesToUi(chat.messages, profile => profile ? agentNames.value.get(profile) : undefined))\nconst reportedContextTokens = computed(() => chat.contextUsage?.contextTokens\n || chat.contextUsage?.totalTokens\n || (activeSession.value?.inputTokens ?? 0) + (activeSession.value?.outputTokens ?? 0))\nconst estimatedContextTokens = computed(() => estimateConversationTokens(chat.messages))\nconst contextUsed = computed(() => reportedContextTokens.value || estimatedContextTokens.value)\nconst contextIsEstimated = computed(() => !reportedContextTokens.value && contextUsed.value > 0)\nconst conversationMediaItems = computed(() => mediaItemsFromMessages(messages.value))\nconst lightboxMedia = computed(() => conversationMediaItems.value.map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst activeSession = computed(() => chat.activeSession)\nconst actionSession = computed(() => chat.sessions.find(session => session.id === actionSessionId.value))\nconst connected = computed(() => ['connected', 'ready'].includes(chat.connectionState))\nconst interaction = computed(() => chatInteraction(chat.pendingApproval, chat.pendingClarification))\nconst reference = computed<ComposerReference | null>(() => quoted.value ? { id: quoted.value.id, content: quoted.value.content, author: quoted.value.author } : null)\nconst forkSourceTitle = computed(() => {\n const parentId = activeSession.value?.parentSessionId\n if (!parentId) return ''\n return chat.sessions.find(session => session.id === parentId && session.profile === activeSession.value?.profile)?.title || parentId\n})\nconst selectedModelId = computed(() => chat.selectedModel ? modelChoiceId(chat.selectedModel) : '')\nconst reasoningOptions: ChoiceOption[] = [\n { id: '', label: '默认', description: '使用模型或 Profile 的默认强度' },\n { id: 'none', label: '关闭', description: '不使用额外推理' },\n { id: 'low', label: '低', description: '更快的轻量推理' },\n { id: 'medium', label: '中', description: '速度与深度平衡' },\n { id: 'high', label: '高', description: '更深入地分析复杂问题' },\n { id: 'xhigh', label: '极高', description: '适用于最复杂的任务' },\n]\nconst reasoningComposerOptions = computed<ComposerOption[]>(() => reasoningOptions.map(option => ({\n id: option.id,\n label: option.label,\n detail: option.description,\n})))\nconst reasoningLabel = computed(() => reasoningOptions.find(option => option.id === (chat.reasoningEffort || ''))?.label || '默认')\nconst actionMenuStyle = computed(() => ({ left: `${actionMenuPosition.value.x}px`, top: `${actionMenuPosition.value.y}px` }))\n\nfunction routeProfile(): string {\n const value = typeof route.query.profile === 'string' ? route.query.profile : ''\n return auth.profiles.some(profile => profile.name === value) ? value : ''\n}\n\nfunction sessionLocation(id: string, profile: string) {\n return { path: `/chat/${encodeURIComponent(id)}`, query: { profile } }\n}\n\nasync function findLegacySessionProfile(sessionId: string): Promise<string> {\n for (const profile of auth.profiles) {\n try {\n const session = await getSession(sessionId, profile.name)\n if (session.id === sessionId) return profile.name\n } catch { /* Try the next profile: 9119 returns 404 for a foreign session. */ }\n }\n return auth.activeProfile?.name || ''\n}\n\nasync function ensureRouteProfile(profile: string): Promise<void> {\n if (!profile || auth.activeProfile?.name === profile) return\n chat.switchProfile(profile)\n restoringRouteProfile.value = profile\n auth.selectProfile(profile)\n await nextTick()\n}\n\nasync function refreshSessions() {\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n const profile = routeProfile() || (requestedId ? await findLegacySessionProfile(requestedId) : auth.activeProfile?.name || '')\n if (profile && auth.activeProfile?.name !== profile) {\n if (requestedId) await router.replace(sessionLocation(requestedId, profile))\n await ensureRouteProfile(profile)\n }\n // The session route is the authoritative navigation target. A secondary\n // unread-count request must never prevent its history from being restored.\n await chat.loadSessions(profile, 'chat')\n if (requestedId) {\n const target = await getSession(requestedId, profile).catch(() => undefined)\n if (target && !isOwnedChatSession(target)) {\n await router.replace({ path: `/history/${encodeURIComponent(requestedId)}`, query: { profile } })\n return\n }\n }\n if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)\n if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))\n void chat.loadUnread(profile).catch(() => undefined)\n if (!requestedId && chat.activeSession && !isOwnedChatSession(chat.activeSession)) {\n chat.clearSelection()\n }\n}\n\nasync function chooseSession(id: string) {\n outlineOpen.value = false\n preview.value = null\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name || 'default'\n await router.push(sessionLocation(id, profile))\n await ensureRouteProfile(profile)\n if (chat.activeProfileName !== profile) await chat.loadSessions(profile, 'chat')\n await chat.selectSession(id, profile)\n await chat.markRead(id, profile).catch(() => undefined)\n quoted.value = null\n}\n\nasync function createSession() {\n outlineOpen.value = false\n preview.value = null\n const id = chat.createSession(auth.activeProfile?.name)\n await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))\n}\n\nasync function send(payload: ComposerSubmit) {\n try {\n await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')\n composer.value?.clearAfterSend()\n } catch { /* store exposes the error and the composer keeps its draft */ }\n}\n\nfunction openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {\n const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)\n item.size = attachment.size\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; preview.value = null; filePreview.value = item }\n}\n\nfunction openMedia(item: UiLibraryItem) {\n const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')\n const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)\n mediaPreviewIndex.value = index >= 0 ? index : null\n}\n\nfunction openLocalFile({ name, url }: { name: string; url: string }) {\n const item = previewItemFromUrl(name, url)\n if (item.kind === 'image' || item.kind === 'video') openMedia(item)\n else { outlineOpen.value = false; filePreview.value = item }\n}\n\nasync function addPreviewToComposer(item: UiLibraryItem) {\n const file = await loadComposerFile(item)\n if (!file || !composer.value) return\n composer.value.attachFiles([file])\n preview.value = null\n filePreview.value = null\n mediaPreviewIndex.value = null\n await nextTick()\n composer.value?.focus()\n}\n\nasync function addMediaToComposer(media: PreviewMedia) {\n await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))\n}\n\nasync function selectModel(id: string) {\n if (id === selectedModelId.value) {\n modelDialog.value = false\n return\n }\n const model = modelForChoiceId(chat.models, id)\n if (!model || modelSwitching.value) return\n modelSwitching.value = true\n try {\n await chat.setModel(model)\n modelDialog.value = false\n } finally {\n modelSwitching.value = false\n }\n}\n\nfunction selectReasoning(id: string) {\n chat.reasoningEffort = id || undefined\n}\n\nasync function toggleFastMode(enabled: boolean) {\n try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }\n}\n\nfunction restoreShowThinking(profile = auth.activeProfile?.name || 'default') {\n showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)\n}\n\nfunction toggleShowThinking() {\n showThinking.value = !showThinking.value\n writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)\n}\n\nfunction openSessionActions(id: string, event?: MouseEvent) {\n actionSessionId.value = id\n const session = chat.sessions.find(item => item.id === id)\n renameValue.value = session?.title || ''\n renaming.value = false\n const menuWidth = 208\n const menuHeight = 210\n const inset = 8\n const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null\n const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14\n const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46\n actionMenuPosition.value = {\n x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),\n y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),\n }\n}\n\nfunction closeSessionActions() {\n actionSessionId.value = ''\n renaming.value = false\n}\n\nasync function forceRefreshHistory() {\n closeSessionActions()\n try { await chat.forceRefreshHistory() }\n catch { /* The chat store displays the refresh error without clearing messages. */ }\n}\n\nfunction handleSessionActionPointer(event: PointerEvent) {\n if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return\n closeSessionActions()\n}\n\nfunction handleSessionActionKey(event: KeyboardEvent) {\n if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()\n}\n\nasync function saveRename() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session || !renameValue.value.trim()) return\n await chat.renameSession(session.id, renameValue.value.trim(), session.profile)\n closeSessionActions()\n}\n\nasync function toggleSessionPinned() {\n const session = actionSession.value\n if (!session) return\n await chat.setSessionPinned(session.id, !session.pinned, session.profile)\n closeSessionActions()\n}\n\nasync function openSessionOutline() {\n const session = actionSession.value\n if (!session) return\n closeSessionActions()\n if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)\n preview.value = null\n outlineOpen.value = true\n}\n\nfunction closeInspector() {\n const restoreMenuFocus = outlineOpen.value\n preview.value = null\n outlineOpen.value = false\n if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nfunction navigateOutline(target: { messageId: string; anchorId: string }) {\n timeline.value?.scrollToAnchor(target.messageId, target.anchorId)\n if (window.matchMedia('(max-width: 900px)').matches) closeInspector()\n}\n\nasync function deleteSession() {\n const session = chat.sessions.find(item => item.id === actionSessionId.value)\n if (!session) return\n await chat.removeSession(session.id, session.profile)\n closeSessionActions()\n if (route.params.sessionId === session.id) await router.replace('/chat')\n}\n\nasync function branch() {\n const id = await chat.branchSession()\n if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))\n}\n\nasync function revealSourceMessage() {\n const messageId = typeof route.query.message === 'string' ? route.query.message : ''\n if (!messageId) return\n await nextTick()\n for (let attempt = 0; attempt < 10; attempt += 1) {\n if (timeline.value?.scrollToMessage(messageId)) return\n if (!chat.hasMoreBefore) return\n await chat.loadOlder()\n await nextTick()\n }\n}\n\nonMounted(async () => {\n restoreShowThinking()\n document.addEventListener('pointerdown', handleSessionActionPointer)\n document.addEventListener('keydown', handleSessionActionKey)\n window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n await refreshSessions()\n await Promise.allSettled([chat.loadModels(auth.activeProfile?.name), chat.connect()])\n void chat.refreshActiveSessionModel().catch(() => undefined)\n await revealSourceMessage()\n const pendingFile = await consumeLibraryItemForComposer()\n if (pendingFile) composer.value?.attachFiles([pendingFile])\n})\n\nonBeforeUnmount(() => {\n document.removeEventListener('pointerdown', handleSessionActionPointer)\n document.removeEventListener('keydown', handleSessionActionKey)\n window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)\n})\n\nwatch(() => auth.activeProfile?.name, async (profile, previous) => {\n if (!profile || profile === previous) return\n restoreShowThinking(profile)\n outlineOpen.value = false\n preview.value = null\n if (restoringRouteProfile.value === profile) {\n restoringRouteProfile.value = ''\n return\n }\n chat.switchProfile(profile)\n const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''\n if (requestedId && routeProfile() === profile) {\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n await chat.selectSession(requestedId, profile)\n return\n }\n await router.replace({ path: '/chat', query: { profile } })\n await Promise.allSettled([chat.loadSessions(profile, 'chat'), chat.loadModels(profile), chat.loadUnread(profile), chat.connect()])\n})\n\nwatch(() => chat.activeSessionId, async id => {\n const profile = chat.activeProfileName || auth.activeProfile?.name || ''\n if (id) void chat.refreshActiveSessionModel().catch(() => undefined)\n if (!id || (route.params.sessionId === id && routeProfile() === profile)) return\n await router.replace(sessionLocation(id, profile))\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"对话\" :sidebar-subtitle=\"`${sessions.length} 个会话`\" :inspector-open=\"!!preview || outlineOpen\" :inspector-close-label=\"outlineOpen ? '关闭会话大纲' : '关闭预览'\" @close-inspector=\"closeInspector\">\n <template #sidebar-action>\n <button class=\"sidebar-primary-action\" type=\"button\" title=\"新建聊天\" aria-label=\"新建聊天\" @click=\"createSession\">\n <YaoYaoSidebarIcon name=\"add\" />\n <span>新建聊天</span>\n </button>\n </template>\n <template #sidebar>\n <ResourceSidebar\n :items=\"sidebarItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n external-search\n single-line\n :has-more=\"chat.hasMoreSessions\"\n :loading-more=\"chat.isLoadingMoreSessions\"\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"新建会话后,从输入框开始聊天。\"\n @load-more=\"chat.loadMoreSessions(auth.activeProfile?.name)\"\n @select=\"chooseSession\"\n @more=\"openSessionActions\"\n @context-menu=\"openSessionActions\"\n />\n </template>\n\n <div class=\"chat-workspace\">\n <MessageTimeline\n ref=\"timeline\"\n :messages=\"messages\"\n :title=\"activeSession?.title || '新会话'\"\n :subtitle=\"activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || chat.selectedModel?.name || '默认模型'}` : '选择会话或直接开始输入'\"\n :loading=\"chat.activeRouteState?.isLoadingHistory\"\n :loading-older=\"chat.activeRouteState?.isLoadingHistory\"\n :has-older=\"chat.hasMoreBefore\"\n :connected=\"connected\"\n :synced=\"chat.historySynced\"\n :show-tools=\"showThinking\"\n :thinking=\"chat.isSending || chat.isStreaming\"\n :show-assistant-identity=\"false\"\n :agent-avatars=\"agentAvatars\"\n :interaction=\"interaction\"\n empty-logo\n transparent-header\n :fork-source-title=\"forkSourceTitle\"\n @load-older=\"chat.loadOlder\"\n @quote=\"quoted = $event\"\n @branch=\"branch\"\n @preview=\"openAttachment\"\n @preview-file=\"openLocalFile\"\n @approve=\"interaction && chat.respondToApproval(interaction.id, $event)\"\n @clarify=\"interaction && chat.respondToClarification(interaction.id, $event)\"\n >\n <template #header-actions>\n <button v-if=\"activeSession\" ref=\"headerSessionMenuButton\" class=\"icon-button header-session-menu\" type=\"button\" title=\"会话操作\" aria-label=\"会话操作\" @click=\"openSessionActions(activeSession.id, $event)\"><AppIcon name=\"dots\" :size=\"18\" /></button>\n </template>\n </MessageTimeline>\n <p v-if=\"chat.error\" class=\"chat-error\" role=\"alert\"><AppIcon name=\"alert\" :size=\"13\" />{{ chat.error }}</p>\n <ComposerShell\n ref=\"composer\"\n mode=\"chat\"\n :draft-key=\"`${auth.user?.id || 'local'}:${auth.activeProfile?.name || 'default'}:${chat.activeSessionId || 'new'}`\"\n :disabled=\"chat.connectionState === 'failed'\"\n :streaming=\"chat.isStreaming\"\n :sending=\"chat.isSending\"\n :model-label=\"chat.selectedModel?.name || '选择模型'\"\n :fast-mode=\"chat.fastMode\"\n :fast-mode-disabled=\"!chat.activeSessionId\"\n :reasoning-effort=\"reasoningLabel\"\n :reasoning-value=\"chat.reasoningEffort || ''\"\n :reasoning-options=\"reasoningComposerOptions\"\n :context-used=\"contextUsed\"\n :context-limit=\"chat.contextUsage?.contextLimit || 262144\"\n :context-estimated=\"contextIsEstimated\"\n :queue-mode=\"queueMode || chat.isQueued\"\n :tool-trace-visible=\"showThinking\"\n :reference=\"reference\"\n :slash-commands=\"[\n { id: 'fork', label: 'fork', detail: '从当前会话创建分支' },\n { id: 'compact', label: 'compact', detail: '压缩当前会话上下文' },\n { id: 'model', label: 'model', detail: '切换模型' },\n ]\"\n @send=\"send\"\n @stop=\"chat.interrupt\"\n @model-click=\"modelDialog = true\"\n @fast-mode-toggle=\"toggleFastMode\"\n @reasoning-change=\"selectReasoning\"\n @settings-click=\"toggleShowThinking\"\n @queue-toggle=\"queueMode = !queueMode\"\n @clear-reference=\"quoted = null\"\n />\n </div>\n\n <template #inspector>\n <SessionOutline v-if=\"outlineOpen\" :messages=\"messages\" :has-older=\"chat.hasMoreBefore\" @navigate=\"navigateOutline\" />\n <PreviewInspector v-else-if=\"preview\" :item=\"preview\" @close=\"preview = null\" @add-to-composer=\"addPreviewToComposer\" />\n </template>\n </WorkspaceView>\n\n <FloatingResourceSearch section=\"chat\" label=\"搜索会话\" :items=\"sidebarItems\" @select=\"chooseSession\" />\n <PreviewModal v-if=\"filePreview\" :item=\"filePreview\" :items=\"conversationMediaItems\" @close=\"filePreview = null\" @add-to-composer=\"addPreviewToComposer\" @source=\"filePreview = null\" />\n <ImagePreviewLightbox v-model=\"mediaPreviewIndex\" :images=\"lightboxMedia\" @add=\"addMediaToComposer\" />\n\n <ModelChoiceDialog :open=\"modelDialog\" :options=\"chat.models\" :selected-id=\"selectedModelId\" :busy=\"modelSwitching\" @close=\"modelDialog = false\" @select=\"selectModel\" />\n\n <Teleport to=\"body\">\n <Transition name=\"session-menu\">\n <section v-if=\"actionSessionId\" class=\"session-actions\" :style=\"actionMenuStyle\" role=\"menu\" aria-label=\"会话操作\" @contextmenu.prevent>\n <template v-if=\"renaming\">\n <label>会话名称<input v-model=\"renameValue\" maxlength=\"120\" autofocus @keydown.enter=\"saveRename\" /></label>\n <div><button class=\"quiet-button\" type=\"button\" @click=\"renaming = false\">取消</button><button class=\"solid-button\" type=\"button\" @click=\"saveRename\">保存</button></div>\n </template>\n <template v-else>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"openSessionOutline\"><AppIcon name=\"menu\" :size=\"14\" />会话大纲</button>\n <button v-if=\"actionSessionId === chat.activeSessionId\" class=\"action-row\" role=\"menuitem\" type=\"button\" :disabled=\"chat.isStreaming || chat.isQueued || chat.isSending || chat.activeRouteState?.isLoadingHistory\" @click=\"forceRefreshHistory\"><AppIcon name=\"refresh\" :size=\"14\" />强制刷新历史</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"toggleSessionPinned\"><AppIcon :name=\"actionSession?.pinned ? 'pin-off' : 'pin'\" :size=\"14\" />{{ actionSession?.pinned ? '取消置顶' : '置顶会话' }}</button>\n <button class=\"action-row\" role=\"menuitem\" type=\"button\" @click=\"renaming = true\"><AppIcon name=\"edit\" :size=\"14\" />重命名</button>\n <button class=\"action-row danger\" role=\"menuitem\" type=\"button\" @click=\"deleteSession\"><AppIcon name=\"trash\" :size=\"14\" />删除会话</button>\n </template>\n </section>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.sidebar-primary-action { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; font-size: 12px; font-weight: 610; text-align: left; transition: background-color 120ms ease; }\n.sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }\n.sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }\n.header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }\n.chat-error { display: flex; width: min(760px, calc(100% - 32px)); margin: 0 auto 4px; align-items: center; gap: 6px; color: var(--danger); font-size: 9px; }\n.session-actions { position: fixed; z-index: 205; width: 208px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 12px 34px rgba(0,0,0,.16); }.action-row { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; text-align: left; }.action-row:hover, .action-row:focus-visible { outline: 0; background: var(--surface-soft); color: var(--text-primary); }.action-row.danger { color: var(--danger); }.session-actions label { display: flex; flex-direction: column; gap: 6px; padding: 4px; color: var(--text-muted); font-size: 9px; }.session-actions input { width: 100%; height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-soft); color: var(--text-primary); font-size: 11px; }.session-actions input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--focus-ring); }.session-actions > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; padding: 0 4px 3px; }.session-actions :deep(.quiet-button), .session-actions :deep(.solid-button) { min-height: 29px; padding-inline: 10px; font-size: 10px; }\n.session-menu-enter-active, .session-menu-leave-active { transition: opacity 100ms ease, transform 120ms var(--ease-out); transform-origin: top right; }.session-menu-enter-from, .session-menu-leave-to { opacity: 0; transform: translateY(-3px) scale(.98); }\n@media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }\n</style>\n"],"mappings":"8tBAEA,IAAM,EAAM,sCAcZ,eAAsB,EAAiB,EAAgD,CACrF,IAAM,EAAM,EAAK,aAAe,EAAK,WACrC,GAAI,CAAC,GAAO,CAAC,EAAK,KAAM,OAAO,KAC/B,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,EAAK,CAAE,YAAa,aAAc,CAAC,EAChE,GAAI,CAAC,EAAS,GAAI,MAAU,MAAM,UAAU,EAAS,OAAO,EAAE,EAC9D,IAAM,EAAO,MAAM,EAAS,KAAK,EACjC,OAAO,IAAI,KAAK,CAAC,CAAI,EAAG,EAAK,KAAM,CAAE,KAAM,EAAK,UAAY,EAAK,MAAQ,0BAA2B,CAAC,CACvG,MAAQ,CACN,OAAO,IACT,CACF,CAEA,eAAsB,IAAsD,CAC1E,IAAM,EAAM,eAAe,QAAQ,CAAG,EACtC,GAAI,CAAC,EAAK,OAAO,KACjB,eAAe,WAAW,CAAG,EAC7B,GAAI,CACF,IAAM,EAAU,KAAK,MAAM,CAAG,EAC9B,OAAO,MAAM,EAAiB,CAAE,KAAM,EAAQ,KAAM,YAAa,EAAQ,IAAK,SAAU,EAAQ,QAAS,CAAC,CAC5G,MAAQ,CACN,OAAO,IACT,CACF,gICPA,IAAM,EAAO,GAAa,EACpB,EAAO,GAAa,EACpB,EAAQ,GAAS,EACjB,EAAS,GAAU,EACnB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