@lsamien/yaoyao 0.4.80 → 0.4.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/bin/hermes-yaoyao-updater.mjs +97 -1
- package/bin/lib/npm-release.d.mts +10 -0
- package/bin/lib/npm-release.mjs +93 -0
- package/build-info.json +17 -3
- package/desktop/main.mjs +28 -26
- package/dist/assets/{AboutDialog-on4AME1V.js → AboutDialog-g6pYSCjs.js} +2 -2
- package/dist/assets/{AboutDialog-on4AME1V.js.map → AboutDialog-g6pYSCjs.js.map} +1 -1
- package/dist/assets/{BotAutomationsView-Bmb14qI5.js → BotAutomationsView-D1qf-5yf.js} +2 -2
- package/dist/assets/{BotAutomationsView-Bmb14qI5.js.map → BotAutomationsView-D1qf-5yf.js.map} +1 -1
- package/dist/assets/{BotPluginsDialog-6WPFFQnG.js → BotPluginsDialog-BOSzPlLZ.js} +2 -2
- package/dist/assets/{BotPluginsDialog-6WPFFQnG.js.map → BotPluginsDialog-BOSzPlLZ.js.map} +1 -1
- package/dist/assets/{BotSettingsDialog-wWHnGtBg.js → BotSettingsDialog-Ba-380qV.js} +4 -4
- package/dist/assets/{BotSettingsDialog-wWHnGtBg.js.map → BotSettingsDialog-Ba-380qV.js.map} +1 -1
- package/dist/assets/{ChatView-BKNyjhWf.js → ChatView-DHyj3yzu.js} +2 -2
- package/dist/assets/{ChatView-BKNyjhWf.js.map → ChatView-DHyj3yzu.js.map} +1 -1
- package/dist/assets/{ComputerPanel-DP9Sge1E.js → ComputerPanel-D1hglwwV.js} +2 -2
- package/dist/assets/{ComputerPanel-DP9Sge1E.js.map → ComputerPanel-D1hglwwV.js.map} +1 -1
- package/dist/assets/{ComputerViewerView-WjPHo035.js → ComputerViewerView-BDL1eNKT.js} +2 -2
- package/dist/assets/{ComputerViewerView-WjPHo035.js.map → ComputerViewerView-BDL1eNKT.js.map} +1 -1
- package/dist/assets/{ConversationsView-BRNIpK57.js → ConversationsView-BaWBEaBU.js} +5 -5
- package/dist/assets/{ConversationsView-BRNIpK57.js.map → ConversationsView-BaWBEaBU.js.map} +1 -1
- package/dist/assets/{ConversationsView-CbArO1v2.css → ConversationsView-CdPjaDik.css} +1 -1
- package/dist/assets/{FilesView-ETwEkBC-.js → FilesView-AjaCIyCs.js} +2 -2
- package/dist/assets/{FilesView-ETwEkBC-.js.map → FilesView-AjaCIyCs.js.map} +1 -1
- package/dist/assets/FloatingResourceSearch-CeLuyNWO.js +9 -0
- package/dist/assets/{FloatingResourceSearch-CxF6Ko17.js.map → FloatingResourceSearch-CeLuyNWO.js.map} +1 -1
- package/dist/assets/{FloatingResourceSearch-3GOuDkuO.css → FloatingResourceSearch-CqauCQAf.css} +1 -1
- package/dist/assets/{HistoryView-uwkxvrTT.js → HistoryView-C96yRoyB.js} +2 -2
- package/dist/assets/{HistoryView-uwkxvrTT.js.map → HistoryView-C96yRoyB.js.map} +1 -1
- package/dist/assets/{KanbanView-BjiWhQiB.js → KanbanView-CVbjfqiX.js} +2 -2
- package/dist/assets/{KanbanView-BjiWhQiB.js.map → KanbanView-CVbjfqiX.js.map} +1 -1
- package/dist/assets/{LocalVmSettingsPanel-BAVywgEJ.js → LocalVmSettingsPanel-DcDIRVsO.js} +2 -2
- package/dist/assets/{LocalVmSettingsPanel-BAVywgEJ.js.map → LocalVmSettingsPanel-DcDIRVsO.js.map} +1 -1
- package/dist/assets/{RunnerSettingsPanel-spsPiohB.js → RunnerSettingsPanel-XYeXVx5y.js} +2 -2
- package/dist/assets/{RunnerSettingsPanel-spsPiohB.js.map → RunnerSettingsPanel-XYeXVx5y.js.map} +1 -1
- package/dist/assets/{StandaloneDialog-Ctcd4omg.js → StandaloneDialog-C6HIM_jc.js} +2 -2
- package/dist/assets/{StandaloneDialog-Ctcd4omg.js.map → StandaloneDialog-C6HIM_jc.js.map} +1 -1
- package/dist/assets/{UpdateCheckDialog-C43LDN1t.js → UpdateCheckDialog-Dv1d1s42.js} +2 -2
- package/dist/assets/{UpdateCheckDialog-C43LDN1t.js.map → UpdateCheckDialog-Dv1d1s42.js.map} +1 -1
- package/dist/assets/{WorkspaceKnowledgePanel-CDbdIzXZ.js → WorkspaceKnowledgePanel-Dnauu0Hw.js} +2 -2
- package/dist/assets/{WorkspaceKnowledgePanel-CDbdIzXZ.js.map → WorkspaceKnowledgePanel-Dnauu0Hw.js.map} +1 -1
- package/dist/assets/{WorkspaceRoutinesPanel-h7wcBTnK.js → WorkspaceRoutinesPanel-WNI3qP4D.js} +2 -2
- package/dist/assets/{WorkspaceRoutinesPanel-h7wcBTnK.js.map → WorkspaceRoutinesPanel-WNI3qP4D.js.map} +1 -1
- package/dist/assets/WorkspaceShell-BT92dIOL.css +1 -0
- package/dist/assets/WorkspaceShell-Bl2QMnvN.js +44 -0
- package/dist/assets/WorkspaceShell-Bl2QMnvN.js.map +1 -0
- package/dist/assets/{WorkspaceView-zDyCd5Ys.js → WorkspaceView-Dhdw4Kml.js} +2 -2
- package/dist/assets/{WorkspaceView-zDyCd5Ys.js.map → WorkspaceView-Dhdw4Kml.js.map} +1 -1
- package/dist/assets/{docx-preview-DOVGRYbk.js → docx-preview-BNRkFvPc.js} +2 -2
- package/dist/assets/{docx-preview-DOVGRYbk.js.map → docx-preview-BNRkFvPc.js.map} +1 -1
- package/dist/assets/{index-CRBIQ5t6.js → index-DU4OTLup.js} +3 -3
- package/dist/assets/{index-CRBIQ5t6.js.map → index-DU4OTLup.js.map} +1 -1
- package/dist/assets/{pdf-CyfBRmEm.js → pdf-C6_9GF5Z.js} +2 -2
- package/dist/assets/{pdf-CyfBRmEm.js.map → pdf-C6_9GF5Z.js.map} +1 -1
- package/dist/assets/{sessionOwnership-BhbWRxbS.js → sessionOwnership-D9vGe33s.js} +2 -2
- package/dist/assets/{sessionOwnership-BhbWRxbS.js.map → sessionOwnership-D9vGe33s.js.map} +1 -1
- package/dist/assets/{viewModels-DNhmBuoz.js → viewModels-BLN4GfVX.js} +5 -5
- package/dist/assets/viewModels-BLN4GfVX.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist-server/server/app.js +2 -0
- package/dist-server/server/chatCache.js +3 -2
- package/dist-server/server/chatPresentation.js +32 -0
- package/dist-server/server/chatTranscriptApi.js +2 -1
- package/dist-server/server/config.js +2 -0
- package/dist-server/server/credentialVault/adapterExecutor.js +23 -0
- package/dist-server/server/credentialVault/botAccess.js +161 -0
- package/dist-server/server/credentialVault/broker.js +61 -6
- package/dist-server/server/credentialVault/coordinator.js +108 -15
- package/dist-server/server/credentialVault/localClient.js +129 -8
- package/dist-server/server/credentialVault/localExecutor.js +15 -0
- package/dist-server/server/credentialVault/protectedExecutor.js +3 -19
- package/dist-server/server/credentialVault/schema.js +11 -4
- package/dist-server/server/credentialVault/sshExecutor.js +111 -15
- package/dist-server/server/credentialVault/store.js +11 -5
- package/dist-server/server/credentialVault/transport.js +4 -1
- package/dist-server/server/jsonCompression.js +29 -0
- package/dist-server/server/routes.js +14 -1
- package/dist-server/server/runnerHub.js +12 -1
- package/dist-server/server/updateManager.js +42 -10
- package/dist-server/server/workspaceRoutes.js +30 -4
- package/dist-server/server/workspaceSync.js +22 -4
- package/dist-server/shared/desktopUpdate.js +1 -0
- package/package.json +1 -1
- package/release.json +3 -3
- package/dist/assets/FloatingResourceSearch-CxF6Ko17.js +0 -9
- package/dist/assets/WorkspaceShell-Bx8se0l7.js +0 -44
- package/dist/assets/WorkspaceShell-Bx8se0l7.js.map +0 -1
- package/dist/assets/WorkspaceShell-DXti6BpF.css +0 -1
- package/dist/assets/viewModels-DNhmBuoz.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e,l as t,r as n}from"./WorkspaceShell-Bx8se0l7.js";import{A as r,D as i,F as a,G as ee,H as o,M as te,W as s,_ as c,at as l,ct as u,d,et as f,f as ne,g as p,h as m,l as re,m as h,n as ie,p as g,s as ae,st as oe,t as se,u as ce,v as _,x as v,y}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as le,X as b,c as ue,d as de,et as fe,f as pe,l as me,m as he,o as ge,s as _e,u as ve}from"./index-CRBIQ5t6.js";import{t as ye}from"./StandaloneDialog-Ctcd4omg.js";import{_ as be,f as xe,g as Se,h as Ce,i as we,n as Te,t as Ee}from"./viewModels-DNhmBuoz.js";import{_ as x,g as De,h as Oe,t as ke,v as Ae}from"./FloatingResourceSearch-CxF6Ko17.js";import{i as je,n as Me,r as Ne,t as S}from"./sessionOwnership-BhbWRxbS.js";import{t as Pe}from"./WorkspaceView-zDyCd5Ys.js";var C=`hermes-yaoyao:pending-composer-item`;async function Fe(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 Ie(){let e=sessionStorage.getItem(C);if(!e)return null;sessionStorage.removeItem(C);try{let t=JSON.parse(e);return await Fe({name:t.name,downloadUrl:t.url,mimeType:t.mimeType})}catch{return null}}var Le={class:`chat-workspace`},Re={key:0,class:`chat-error`,role:`alert`},ze=[`aria-busy`],Be={key:0,class:`session-delete-error`,role:`alert`},Ve={class:`session-delete-actions`},He=[`disabled`],Ue=[`disabled`],We=[`disabled`],w=se(v({__name:`ChatView`,setup(se){let v=pe(),C=he(),w=ge(),T=le(),E=fe(),D=f(null),O=f(null),k=f(null),A=f(null),j=f(!1),M=f(!1),N=f(!1),P=f(!1),F=f(!1),I=f(``),L=f(!1),R=f(null),z=f(!1),B=f(``),V=f(``),H=f({x:8,y:8}),U=f(null),W=f(null),G=f(null),K=f(``);function Ge(t){let n=e(t);n&&n===C.activeProfile?.name&&w.loadModels(n).catch(()=>void 0)}let Ke=g(()=>[...w.sessions].filter(S)),qe=g(()=>new Map(C.profiles.map(e=>[e.name,e.agentName||e.displayName||e.name]))),Je=g(()=>Object.fromEntries(C.profiles.flatMap(e=>e.agentAvatar?[[e.name,e.agentAvatar]]:[]))),Ye=g(()=>Ke.value.map(e=>we(e,v.snapshot.conversations.find(t=>t.mode===`chat`&&t.id===e.id&&t.profile===e.profile)?.count??0,qe.value.get(e.profile||C.activeProfile?.name||``)))),Xe=g(()=>Te(w.messages,e=>e?qe.value.get(e):void 0)),Ze=g(()=>Oe(Xe.value)),Qe=g(()=>Ze.value.map(e=>({url:e.previewUrl||e.downloadUrl||``,name:e.name,type:e.kind})).filter(e=>e.url)),q=g(()=>w.activeSession),J=g(()=>w.sessions.find(e=>e.id===I.value)),$e=g(()=>[`connected`,`ready`].includes(w.connectionState)),Y=g(()=>Ee(w.pendingApproval,w.pendingClarification)),et=g(()=>D.value?{id:D.value.id,content:D.value.content,author:D.value.author}:null),tt=g(()=>{let e=q.value?.parentSessionId;return e?w.sessions.find(t=>t.id===e&&t.profile===q.value?.profile)?.title||e:``}),nt=g(()=>w.selectedModel?me(w.selectedModel):``),rt=[{id:``,label:`默认`,description:`使用模型或 Profile 的默认强度`},{id:`none`,label:`关闭`,description:`不使用额外推理`},{id:`low`,label:`低`,description:`更快的轻量推理`},{id:`medium`,label:`中`,description:`速度与深度平衡`},{id:`high`,label:`高`,description:`更深入地分析复杂问题`},{id:`xhigh`,label:`极高`,description:`适用于最复杂的任务`}],it=g(()=>rt.map(e=>({id:e.id,label:e.label,detail:e.description}))),at=g(()=>rt.find(e=>e.id===(w.reasoningEffort||``))?.label||`默认`),ot=g(()=>({left:`${H.value.x}px`,top:`${H.value.y}px`}));function X(){let e=typeof T.query.profile==`string`?T.query.profile:``;return C.profiles.some(t=>t.name===e)?e:``}function Z(e,t){return{path:`/chat/${encodeURIComponent(e)}`,query:{profile:t}}}async function st(e){for(let t of C.profiles)try{if((await de(e,t.name)).id===e)return t.name}catch{}return C.activeProfile?.name||``}async function ct(e){!e||C.activeProfile?.name===e||(w.switchProfile(e),K.value=e,C.selectProfile(e),await i())}async function lt(){let e=typeof T.params.sessionId==`string`?T.params.sessionId:``,t=X()||(e?await st(e):C.activeProfile?.name||``);if(t&&C.activeProfile?.name!==t&&(e&&await E.replace(Z(e,t)),await ct(t)),await w.loadSessions(t,`chat`),e){let n=await de(e,t).catch(()=>void 0);if(n&&!S(n)){await E.replace({path:`/history/${encodeURIComponent(e)}`,query:{profile:t}});return}}e&&w.activeSessionId!==e&&await w.selectSession(e,t),e&&t&&X()!==t&&await E.replace(Z(e,t)),w.loadUnread(t).catch(()=>void 0),!e&&w.activeSession&&!S(w.activeSession)&&w.clearSelection()}let ut=new Set;async function dt(e){if(O.value||k.value||j.value||M.value||!w.activeSessionId||typeof T.query.unread==`string`)return;let t=w.activeSessionId,n=w.activeProfileName,r=`${n}:${t}:${e.join(`,`)}`;if(!ut.has(r)){ut.add(r);try{await v.visible(`chat`,t,n,e)}catch{}finally{ut.delete(r)}}}let ft=0;o(()=>[T.params.id,T.query.unread,w.messages.length],async()=>{let e=T.query.unread;if(typeof e!=`string`||!w.activeSessionId)return;let t=++ft;for(let n=0;n<100&&t===ft;n++){if(await i(),W.value?.scrollToMessage(e)){let e={...T.query};delete e.unread,await E.replace({query:e});return}if(!w.hasMoreBefore)return;let t=w.messages.length;if(await w.loadOlder(),w.messages.length===t)return}},{flush:`post`});async function pt(e){j.value=!1,O.value=null;let t=w.sessions.find(t=>t.id===e)?.profile||C.activeProfile?.name||`default`;await E.push(Z(e,t)),await ct(t),w.activeProfileName!==t&&await w.loadSessions(t,`chat`),await w.selectSession(e,t),D.value=null}async function mt(){j.value=!1,O.value=null;let e=w.createSession(C.activeProfile?.name);await E.push(Z(e,C.activeProfile?.name||`default`))}async function ht(e){try{await w.send(e.text,e.files,F.value?`queue`:w.isStreaming?`steer`:`submit`),U.value?.clearAfterSend()}catch{}}function gt(e){let t=x(e.name,e.url||``,e.id,e.kind);t.size=e.size,t.kind===`image`||t.kind===`video`?_t(t):(j.value=!1,O.value=null,k.value=t)}function _t(e){let t=De(e.previewUrl||e.downloadUrl||``),n=Qe.value.findIndex(e=>De(e.url)===t);A.value=n>=0?n:null}function vt({name:e,url:t}){let n=x(e,t);n.kind===`image`||n.kind===`video`?_t(n):(j.value=!1,k.value=n)}async function yt(e){let t=await Fe(e);!t||!U.value||(U.value.attachFiles([t]),O.value=null,k.value=null,A.value=null,await i(),U.value?.focus())}async function bt(e){await yt(x(e.name,e.url,`preview:${e.url}`,e.type))}async function xt(e){if(e===nt.value){M.value=!1;return}let t=ve(w.models,e);if(!(!t||N.value)){N.value=!0;try{await w.setModel(t),M.value=!1}finally{N.value=!1}}}function St(e){w.reasoningEffort=e||void 0}async function Ct(e){try{await w.setFastMode(e)}catch{}}function wt(e=C.activeProfile?.name||`default`){P.value=_e(C.user?.id??`local`,e)}function Tt(){P.value=!P.value,ue(C.user?.id??`local`,C.activeProfile?.name||`default`,P.value)}function Q(e,t){I.value=e;let n=w.sessions.find(t=>t.id===e);V.value=n?.title||``,L.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;H.value={x:Math.max(8,Math.min(i,window.innerWidth-208-8)),y:Math.max(8,Math.min(a,window.innerHeight-210-8))}}function $(){I.value=``,L.value=!1}async function Et(){$();try{await w.forceRefreshHistory()}catch{}}function Dt(e){!I.value||e.target.closest(`.session-actions`)||$()}function Ot(e){e.key===`Escape`&&I.value&&$()}async function kt(){let e=w.sessions.find(e=>e.id===I.value);!e||!V.value.trim()||(await w.renameSession(e.id,V.value.trim(),e.profile),$())}async function At(){let e=J.value;e&&(await w.setSessionPinned(e.id,!e.pinned,e.profile),$())}async function jt(){let e=J.value;e&&($(),(e.id!==w.activeSessionId||e.profile!==w.activeProfileName)&&await pt(e.id),O.value=null,j.value=!0)}function Mt(){let e=j.value;O.value=null,j.value=!1,e&&i(()=>G.value?.focus())}function Nt(e){W.value?.scrollToAnchor(e.messageId,e.anchorId),window.matchMedia(`(max-width: 900px)`).matches&&Mt()}function Pt(){let e=J.value;e&&(R.value={id:e.id,profile:e.profile,title:e.title},B.value=``,$())}function Ft(){z.value||(R.value=null,B.value=``,i(()=>G.value?.focus()))}async function It(){let e=R.value;if(!(!e||z.value)){z.value=!0,B.value=``;try{await w.removeSession(e.id,e.profile),T.params.sessionId===e.id&&await E.replace({path:`/chat`,query:{profile:e.profile}}),R.value=null}catch(e){B.value=e instanceof Error?e.message:`删除失败,请重试`}finally{z.value=!1}}}async function Lt(){let e=await w.branchSession();e&&await E.push(Z(e,w.activeProfileName||C.activeProfile?.name||`default`))}async function Rt(){let e=typeof T.query.message==`string`?T.query.message:``;if(e){await i();for(let t=0;t<10;t+=1){if(W.value?.scrollToMessage(e)||!w.hasMoreBefore)return;await w.loadOlder(),await i()}}}return te(async()=>{wt(),document.addEventListener(`pointerdown`,Dt),document.addEventListener(`keydown`,Ot),window.addEventListener(n,Ge),await lt(),await Promise.allSettled([w.loadModels(C.activeProfile?.name),w.connect()]),w.refreshActiveSessionModel().catch(()=>void 0),await Rt();let e=await Ie();e&&U.value?.attachFiles([e])}),r(()=>{document.removeEventListener(`pointerdown`,Dt),document.removeEventListener(`keydown`,Ot),window.removeEventListener(n,Ge)}),o(()=>C.activeProfile?.name,async(e,t)=>{if(!e||e===t)return;if(wt(e),j.value=!1,O.value=null,K.value===e){K.value=``;return}w.switchProfile(e);let n=typeof T.params.sessionId==`string`?T.params.sessionId:``;if(n&&X()===e){await Promise.allSettled([w.loadSessions(e,`chat`),w.loadModels(e),w.loadUnread(e),w.connect()]),await w.selectSession(n,e);return}await E.replace({path:`/chat`,query:{profile:e}}),await Promise.allSettled([w.loadSessions(e,`chat`),w.loadModels(e),w.loadUnread(e),w.connect()])}),o(()=>w.activeSessionId,async e=>{let t=w.activeProfileName||C.activeProfile?.name||``;e&&w.refreshActiveSessionModel().catch(()=>void 0),!(!e||T.params.sessionId===e&&X()===t)&&await E.replace(Z(e,t))}),(e,n)=>(a(),c(d,null,[y(Pe,{"sidebar-title":`对话`,"sidebar-subtitle":`${Ke.value.length} 个会话`,"inspector-open":!!O.value||j.value,"inspector-close-label":j.value?`关闭会话大纲`:`关闭预览`,onCloseInspector:Mt},{"sidebar-action":s(()=>[h(`button`,{class:`sidebar-primary-action`,type:`button`,title:`新建聊天`,"aria-label":`新建聊天`,onClick:mt},[y(t,{name:`add`}),n[17]||=h(`span`,null,`新建聊天`,-1)])]),sidebar:s(()=>[y(xe,{items:Ye.value,"active-id":l(w).activeSessionId,loading:l(w).isLoading,"external-search":``,"single-line":``,"has-more":l(w).hasMoreSessions,"loading-more":l(w).isLoadingMoreSessions,"search-placeholder":`搜索会话`,"empty-title":`还没有会话`,"empty-description":`新建会话后,从输入框开始聊天。`,onLoadMore:n[0]||=e=>l(w).loadMoreSessions(l(C).activeProfile?.name),onSelect:pt,onMore:Q,onContextMenu:Q},null,8,[`items`,`active-id`,`loading`,`has-more`,`loading-more`])]),inspector:s(()=>[j.value?(a(),m(Me,{key:0,messages:Xe.value,"has-older":l(w).hasMoreBefore,onNavigate:Nt},null,8,[`messages`,`has-older`])):O.value?(a(),m(be,{key:1,item:O.value,onClose:n[8]||=e=>O.value=null,onAddToComposer:yt},null,8,[`item`])):p(``,!0)]),default:s(()=>[h(`div`,Le,[y(Ne,{onVisibleMessages:dt,ref_key:`timeline`,ref:W,messages:Xe.value,title:q.value?.title||`新会话`,subtitle:q.value?`${q.value.profile||l(C).activeProfile?.name||``} · ${q.value.model||l(w).selectedModel?.name||`默认模型`}`:`选择会话或直接开始输入`,loading:l(w).activeRouteState?.isLoadingHistory,"loading-older":l(w).activeRouteState?.isLoadingHistory,"has-older":l(w).hasMoreBefore,connected:$e.value,synced:l(w).historySynced,"show-tools":P.value,thinking:l(w).isSending||l(w).isStreaming,"show-assistant-identity":!1,"agent-avatars":Je.value,interaction:Y.value,"empty-logo":``,"transparent-header":``,"fork-source-title":tt.value,onLoadOlder:l(w).loadOlder,onQuote:n[2]||=e=>D.value=e,onBranch:Lt,onPreview:gt,onPreviewFile:vt,onApprove:n[3]||=e=>Y.value&&l(w).respondToApproval(Y.value.id,e),onClarify:n[4]||=e=>Y.value&&l(w).respondToClarification(Y.value.id,e)},{"header-actions":s(()=>[q.value?(a(),c(`button`,{key:0,ref_key:`headerSessionMenuButton`,ref:G,class:`icon-button header-session-menu`,type:`button`,title:`会话操作`,"aria-label":`会话操作`,onClick:n[1]||=e=>Q(q.value.id,e)},[y(b,{name:`dots`,size:18})],512)):p(``,!0)]),_:1},8,[`messages`,`title`,`subtitle`,`loading`,`loading-older`,`has-older`,`connected`,`synced`,`show-tools`,`thinking`,`agent-avatars`,`interaction`,`fork-source-title`,`onLoadOlder`]),l(w).error?(a(),c(`p`,Re,[y(b,{name:`alert`,size:13}),_(u(l(w).error),1)])):p(``,!0),y(Ae,{ref_key:`composer`,ref:U,mode:`chat`,"draft-key":`${l(C).user?.id||`local`}:${l(C).activeProfile?.name||`default`}:${l(w).activeSessionId||`new`}`,disabled:l(w).connectionState===`failed`,streaming:l(w).isStreaming,sending:l(w).isSending,"model-label":l(w).selectedModel?.name||`选择模型`,"fast-mode":l(w).fastMode,"fast-mode-disabled":!l(w).activeSessionId,"reasoning-effort":at.value,"reasoning-value":l(w).reasoningEffort||``,"reasoning-options":it.value,"show-context":``,"context-used":l(w).contextUsage?.contextTokens,"context-limit":l(w).contextUsage?.contextLimit,"context-percent":l(w).contextUsage?.percentUsed,"queue-mode":F.value||l(w).isQueued,"tool-trace-visible":P.value,reference:et.value,"slash-commands":[{id:`fork`,label:`fork`,detail:`从当前会话创建分支`},{id:`compact`,label:`compact`,detail:`压缩当前会话上下文`},{id:`model`,label:`model`,detail:`切换模型`}],onSend:ht,onStop:l(w).interrupt,onModelClick:n[5]||=e=>M.value=!0,onFastModeToggle:Ct,onReasoningChange:St,onSettingsClick:Tt,onQueueToggle:n[6]||=e=>F.value=!F.value,onClearReference:n[7]||=e=>D.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-percent`,`queue-mode`,`tool-trace-visible`,`reference`,`onStop`])])]),_:1},8,[`sidebar-subtitle`,`inspector-open`,`inspector-close-label`]),y(ke,{section:`chat`,label:`搜索会话`,items:Ye.value,onSelect:pt},null,8,[`items`]),k.value?(a(),m(Se,{key:0,item:k.value,items:Ze.value,onClose:n[9]||=e=>k.value=null,onAddToComposer:yt,onSource:n[10]||=e=>k.value=null},null,8,[`item`,`items`])):p(``,!0),y(Ce,{modelValue:A.value,"onUpdate:modelValue":n[11]||=e=>A.value=e,images:Qe.value,onAdd:bt},null,8,[`modelValue`,`images`]),y(je,{open:M.value,options:l(w).models,"selected-id":nt.value,busy:N.value,onClose:n[12]||=e=>M.value=!1,onSelect:xt},null,8,[`open`,`options`,`selected-id`,`busy`]),R.value?(a(),m(ye,{key:1,title:`删除会话`,compact:``,"before-close":()=>!z.value,onClose:Ft},{default:s(()=>[h(`div`,{class:`session-delete`,"aria-busy":z.value},[h(`p`,null,`确定删除「`+u(R.value.title||`新会话`)+`」吗?删除后无法恢复。`,1),B.value?(a(),c(`p`,Be,u(B.value),1)):p(``,!0),h(`div`,Ve,[h(`button`,{class:`quiet-button`,type:`button`,disabled:z.value,onClick:Ft},`取消`,8,He),h(`button`,{class:`solid-button session-delete-confirm`,type:`button`,disabled:z.value,onClick:It},u(z.value?`删除中…`:`删除`),9,Ue)])],8,ze)]),_:1},8,[`before-close`])):p(``,!0),(a(),m(ne,{to:`body`},[y(ie,{name:`session-menu`},{default:s(()=>[I.value?(a(),c(`section`,{key:0,class:`session-actions`,style:oe(ot.value),role:`menu`,"aria-label":`会话操作`,onContextmenu:n[16]||=ce(()=>{},[`prevent`])},[L.value?(a(),c(d,{key:0},[h(`label`,null,[n[18]||=_(`会话名称`,-1),ee(h(`input`,{"onUpdate:modelValue":n[13]||=e=>V.value=e,maxlength:`120`,autofocus:``,onKeydown:re(kt,[`enter`])},null,544),[[ae,V.value]])]),h(`div`,null,[h(`button`,{class:`quiet-button`,type:`button`,onClick:n[14]||=e=>L.value=!1},`取消`),h(`button`,{class:`solid-button`,type:`button`,onClick:kt},`保存`)])],64)):(a(),c(d,{key:1},[h(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:jt},[y(b,{name:`menu`,size:14}),n[19]||=_(`会话大纲`,-1)]),I.value===l(w).activeSessionId?(a(),c(`button`,{key:0,class:`action-row`,role:`menuitem`,type:`button`,disabled:l(w).isStreaming||l(w).isQueued||l(w).isSending||l(w).activeRouteState?.isLoadingHistory,onClick:Et},[y(b,{name:`refresh`,size:14}),n[20]||=_(`强制刷新历史`,-1)],8,We)):p(``,!0),h(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:At},[y(b,{name:J.value?.pinned?`pin-off`:`pin`,size:14},null,8,[`name`]),_(u(J.value?.pinned?`取消置顶`:`置顶会话`),1)]),h(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:n[15]||=e=>L.value=!0},[y(b,{name:`edit`,size:14}),n[21]||=_(`重命名`,-1)]),h(`button`,{class:`action-row danger`,role:`menuitem`,type:`button`,onClick:Pt},[y(b,{name:`trash`,size:14}),n[22]||=_(`删除会话`,-1)])],64))],36)):p(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-058ae687`]]);export{w as default};
|
|
2
|
-
//# sourceMappingURL=ChatView-
|
|
1
|
+
import{i as e,l as t,r as n}from"./WorkspaceShell-Bl2QMnvN.js";import{A as r,D as i,F as a,G as ee,H as o,M as te,W as s,_ as c,at as l,ct as u,d,et as f,f as ne,g as p,h as m,l as re,m as h,n as ie,p as g,s as ae,st as oe,t as se,u as ce,v as _,x as v,y}from"./_plugin-vue_export-helper-CscYwSBt.js";import{$ as le,X as b,c as ue,d as de,et as fe,f as pe,l as me,m as he,o as ge,s as _e,u as ve}from"./index-DU4OTLup.js";import{t as ye}from"./StandaloneDialog-C6HIM_jc.js";import{_ as be,f as xe,g as Se,h as Ce,i as we,n as Te,t as Ee}from"./viewModels-BLN4GfVX.js";import{_ as x,g as De,h as Oe,t as ke,v as Ae}from"./FloatingResourceSearch-CeLuyNWO.js";import{i as je,n as Me,r as Ne,t as S}from"./sessionOwnership-D9vGe33s.js";import{t as Pe}from"./WorkspaceView-Dhdw4Kml.js";var C=`hermes-yaoyao:pending-composer-item`;async function Fe(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 Ie(){let e=sessionStorage.getItem(C);if(!e)return null;sessionStorage.removeItem(C);try{let t=JSON.parse(e);return await Fe({name:t.name,downloadUrl:t.url,mimeType:t.mimeType})}catch{return null}}var Le={class:`chat-workspace`},Re={key:0,class:`chat-error`,role:`alert`},ze=[`aria-busy`],Be={key:0,class:`session-delete-error`,role:`alert`},Ve={class:`session-delete-actions`},He=[`disabled`],Ue=[`disabled`],We=[`disabled`],w=se(v({__name:`ChatView`,setup(se){let v=pe(),C=he(),w=ge(),T=le(),E=fe(),D=f(null),O=f(null),k=f(null),A=f(null),j=f(!1),M=f(!1),N=f(!1),P=f(!1),F=f(!1),I=f(``),L=f(!1),R=f(null),z=f(!1),B=f(``),V=f(``),H=f({x:8,y:8}),U=f(null),W=f(null),G=f(null),K=f(``);function Ge(t){let n=e(t);n&&n===C.activeProfile?.name&&w.loadModels(n).catch(()=>void 0)}let Ke=g(()=>[...w.sessions].filter(S)),qe=g(()=>new Map(C.profiles.map(e=>[e.name,e.agentName||e.displayName||e.name]))),Je=g(()=>Object.fromEntries(C.profiles.flatMap(e=>e.agentAvatar?[[e.name,e.agentAvatar]]:[]))),Ye=g(()=>Ke.value.map(e=>we(e,v.snapshot.conversations.find(t=>t.mode===`chat`&&t.id===e.id&&t.profile===e.profile)?.count??0,qe.value.get(e.profile||C.activeProfile?.name||``)))),Xe=g(()=>Te(w.messages,e=>e?qe.value.get(e):void 0)),Ze=g(()=>Oe(Xe.value)),Qe=g(()=>Ze.value.map(e=>({url:e.previewUrl||e.downloadUrl||``,name:e.name,type:e.kind})).filter(e=>e.url)),q=g(()=>w.activeSession),J=g(()=>w.sessions.find(e=>e.id===I.value)),$e=g(()=>[`connected`,`ready`].includes(w.connectionState)),Y=g(()=>Ee(w.pendingApproval,w.pendingClarification)),et=g(()=>D.value?{id:D.value.id,content:D.value.content,author:D.value.author}:null),tt=g(()=>{let e=q.value?.parentSessionId;return e?w.sessions.find(t=>t.id===e&&t.profile===q.value?.profile)?.title||e:``}),nt=g(()=>w.selectedModel?me(w.selectedModel):``),rt=[{id:``,label:`默认`,description:`使用模型或 Profile 的默认强度`},{id:`none`,label:`关闭`,description:`不使用额外推理`},{id:`low`,label:`低`,description:`更快的轻量推理`},{id:`medium`,label:`中`,description:`速度与深度平衡`},{id:`high`,label:`高`,description:`更深入地分析复杂问题`},{id:`xhigh`,label:`极高`,description:`适用于最复杂的任务`}],it=g(()=>rt.map(e=>({id:e.id,label:e.label,detail:e.description}))),at=g(()=>rt.find(e=>e.id===(w.reasoningEffort||``))?.label||`默认`),ot=g(()=>({left:`${H.value.x}px`,top:`${H.value.y}px`}));function X(){let e=typeof T.query.profile==`string`?T.query.profile:``;return C.profiles.some(t=>t.name===e)?e:``}function Z(e,t){return{path:`/chat/${encodeURIComponent(e)}`,query:{profile:t}}}async function st(e){for(let t of C.profiles)try{if((await de(e,t.name)).id===e)return t.name}catch{}return C.activeProfile?.name||``}async function ct(e){!e||C.activeProfile?.name===e||(w.switchProfile(e),K.value=e,C.selectProfile(e),await i())}async function lt(){let e=typeof T.params.sessionId==`string`?T.params.sessionId:``,t=X()||(e?await st(e):C.activeProfile?.name||``);if(t&&C.activeProfile?.name!==t&&(e&&await E.replace(Z(e,t)),await ct(t)),await w.loadSessions(t,`chat`),e){let n=await de(e,t).catch(()=>void 0);if(n&&!S(n)){await E.replace({path:`/history/${encodeURIComponent(e)}`,query:{profile:t}});return}}e&&w.activeSessionId!==e&&await w.selectSession(e,t),e&&t&&X()!==t&&await E.replace(Z(e,t)),w.loadUnread(t).catch(()=>void 0),!e&&w.activeSession&&!S(w.activeSession)&&w.clearSelection()}let ut=new Set;async function dt(e){if(O.value||k.value||j.value||M.value||!w.activeSessionId||typeof T.query.unread==`string`)return;let t=w.activeSessionId,n=w.activeProfileName,r=`${n}:${t}:${e.join(`,`)}`;if(!ut.has(r)){ut.add(r);try{await v.visible(`chat`,t,n,e)}catch{}finally{ut.delete(r)}}}let ft=0;o(()=>[T.params.id,T.query.unread,w.messages.length],async()=>{let e=T.query.unread;if(typeof e!=`string`||!w.activeSessionId)return;let t=++ft;for(let n=0;n<100&&t===ft;n++){if(await i(),W.value?.scrollToMessage(e)){let e={...T.query};delete e.unread,await E.replace({query:e});return}if(!w.hasMoreBefore)return;let t=w.messages.length;if(await w.loadOlder(),w.messages.length===t)return}},{flush:`post`});async function pt(e){j.value=!1,O.value=null;let t=w.sessions.find(t=>t.id===e)?.profile||C.activeProfile?.name||`default`;await E.push(Z(e,t)),await ct(t),w.activeProfileName!==t&&await w.loadSessions(t,`chat`),await w.selectSession(e,t),D.value=null}async function mt(){j.value=!1,O.value=null;let e=w.createSession(C.activeProfile?.name);await E.push(Z(e,C.activeProfile?.name||`default`))}async function ht(e){try{await w.send(e.text,e.files,F.value?`queue`:w.isStreaming?`steer`:`submit`),U.value?.clearAfterSend()}catch{}}function gt(e){let t=x(e.name,e.url||``,e.id,e.kind);t.size=e.size,t.kind===`image`||t.kind===`video`?_t(t):(j.value=!1,O.value=null,k.value=t)}function _t(e){let t=De(e.previewUrl||e.downloadUrl||``),n=Qe.value.findIndex(e=>De(e.url)===t);A.value=n>=0?n:null}function vt({name:e,url:t}){let n=x(e,t);n.kind===`image`||n.kind===`video`?_t(n):(j.value=!1,k.value=n)}async function yt(e){let t=await Fe(e);!t||!U.value||(U.value.attachFiles([t]),O.value=null,k.value=null,A.value=null,await i(),U.value?.focus())}async function bt(e){await yt(x(e.name,e.url,`preview:${e.url}`,e.type))}async function xt(e){if(e===nt.value){M.value=!1;return}let t=ve(w.models,e);if(!(!t||N.value)){N.value=!0;try{await w.setModel(t),M.value=!1}finally{N.value=!1}}}function St(e){w.reasoningEffort=e||void 0}async function Ct(e){try{await w.setFastMode(e)}catch{}}function wt(e=C.activeProfile?.name||`default`){P.value=_e(C.user?.id??`local`,e)}function Tt(){P.value=!P.value,ue(C.user?.id??`local`,C.activeProfile?.name||`default`,P.value)}function Q(e,t){I.value=e;let n=w.sessions.find(t=>t.id===e);V.value=n?.title||``,L.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;H.value={x:Math.max(8,Math.min(i,window.innerWidth-208-8)),y:Math.max(8,Math.min(a,window.innerHeight-210-8))}}function $(){I.value=``,L.value=!1}async function Et(){$();try{await w.forceRefreshHistory()}catch{}}function Dt(e){!I.value||e.target.closest(`.session-actions`)||$()}function Ot(e){e.key===`Escape`&&I.value&&$()}async function kt(){let e=w.sessions.find(e=>e.id===I.value);!e||!V.value.trim()||(await w.renameSession(e.id,V.value.trim(),e.profile),$())}async function At(){let e=J.value;e&&(await w.setSessionPinned(e.id,!e.pinned,e.profile),$())}async function jt(){let e=J.value;e&&($(),(e.id!==w.activeSessionId||e.profile!==w.activeProfileName)&&await pt(e.id),O.value=null,j.value=!0)}function Mt(){let e=j.value;O.value=null,j.value=!1,e&&i(()=>G.value?.focus())}function Nt(e){W.value?.scrollToAnchor(e.messageId,e.anchorId),window.matchMedia(`(max-width: 900px)`).matches&&Mt()}function Pt(){let e=J.value;e&&(R.value={id:e.id,profile:e.profile,title:e.title},B.value=``,$())}function Ft(){z.value||(R.value=null,B.value=``,i(()=>G.value?.focus()))}async function It(){let e=R.value;if(!(!e||z.value)){z.value=!0,B.value=``;try{await w.removeSession(e.id,e.profile),T.params.sessionId===e.id&&await E.replace({path:`/chat`,query:{profile:e.profile}}),R.value=null}catch(e){B.value=e instanceof Error?e.message:`删除失败,请重试`}finally{z.value=!1}}}async function Lt(){let e=await w.branchSession();e&&await E.push(Z(e,w.activeProfileName||C.activeProfile?.name||`default`))}async function Rt(){let e=typeof T.query.message==`string`?T.query.message:``;if(e){await i();for(let t=0;t<10;t+=1){if(W.value?.scrollToMessage(e)||!w.hasMoreBefore)return;await w.loadOlder(),await i()}}}return te(async()=>{wt(),document.addEventListener(`pointerdown`,Dt),document.addEventListener(`keydown`,Ot),window.addEventListener(n,Ge),await lt(),await Promise.allSettled([w.loadModels(C.activeProfile?.name),w.connect()]),w.refreshActiveSessionModel().catch(()=>void 0),await Rt();let e=await Ie();e&&U.value?.attachFiles([e])}),r(()=>{document.removeEventListener(`pointerdown`,Dt),document.removeEventListener(`keydown`,Ot),window.removeEventListener(n,Ge)}),o(()=>C.activeProfile?.name,async(e,t)=>{if(!e||e===t)return;if(wt(e),j.value=!1,O.value=null,K.value===e){K.value=``;return}w.switchProfile(e);let n=typeof T.params.sessionId==`string`?T.params.sessionId:``;if(n&&X()===e){await Promise.allSettled([w.loadSessions(e,`chat`),w.loadModels(e),w.loadUnread(e),w.connect()]),await w.selectSession(n,e);return}await E.replace({path:`/chat`,query:{profile:e}}),await Promise.allSettled([w.loadSessions(e,`chat`),w.loadModels(e),w.loadUnread(e),w.connect()])}),o(()=>w.activeSessionId,async e=>{let t=w.activeProfileName||C.activeProfile?.name||``;e&&w.refreshActiveSessionModel().catch(()=>void 0),!(!e||T.params.sessionId===e&&X()===t)&&await E.replace(Z(e,t))}),(e,n)=>(a(),c(d,null,[y(Pe,{"sidebar-title":`对话`,"sidebar-subtitle":`${Ke.value.length} 个会话`,"inspector-open":!!O.value||j.value,"inspector-close-label":j.value?`关闭会话大纲`:`关闭预览`,onCloseInspector:Mt},{"sidebar-action":s(()=>[h(`button`,{class:`sidebar-primary-action`,type:`button`,title:`新建聊天`,"aria-label":`新建聊天`,onClick:mt},[y(t,{name:`add`}),n[17]||=h(`span`,null,`新建聊天`,-1)])]),sidebar:s(()=>[y(xe,{items:Ye.value,"active-id":l(w).activeSessionId,loading:l(w).isLoading,"external-search":``,"single-line":``,"has-more":l(w).hasMoreSessions,"loading-more":l(w).isLoadingMoreSessions,"search-placeholder":`搜索会话`,"empty-title":`还没有会话`,"empty-description":`新建会话后,从输入框开始聊天。`,onLoadMore:n[0]||=e=>l(w).loadMoreSessions(l(C).activeProfile?.name),onSelect:pt,onMore:Q,onContextMenu:Q},null,8,[`items`,`active-id`,`loading`,`has-more`,`loading-more`])]),inspector:s(()=>[j.value?(a(),m(Me,{key:0,messages:Xe.value,"has-older":l(w).hasMoreBefore,onNavigate:Nt},null,8,[`messages`,`has-older`])):O.value?(a(),m(be,{key:1,item:O.value,onClose:n[8]||=e=>O.value=null,onAddToComposer:yt},null,8,[`item`])):p(``,!0)]),default:s(()=>[h(`div`,Le,[y(Ne,{onVisibleMessages:dt,ref_key:`timeline`,ref:W,messages:Xe.value,title:q.value?.title||`新会话`,subtitle:q.value?`${q.value.profile||l(C).activeProfile?.name||``} · ${q.value.model||l(w).selectedModel?.name||`默认模型`}`:`选择会话或直接开始输入`,loading:l(w).activeRouteState?.isLoadingHistory,"loading-older":l(w).activeRouteState?.isLoadingHistory,"has-older":l(w).hasMoreBefore,connected:$e.value,synced:l(w).historySynced,"show-tools":P.value,thinking:l(w).isSending||l(w).isStreaming,"show-assistant-identity":!1,"agent-avatars":Je.value,interaction:Y.value,"empty-logo":``,"transparent-header":``,"fork-source-title":tt.value,onLoadOlder:l(w).loadOlder,onQuote:n[2]||=e=>D.value=e,onBranch:Lt,onPreview:gt,onPreviewFile:vt,onApprove:n[3]||=e=>Y.value&&l(w).respondToApproval(Y.value.id,e),onClarify:n[4]||=e=>Y.value&&l(w).respondToClarification(Y.value.id,e)},{"header-actions":s(()=>[q.value?(a(),c(`button`,{key:0,ref_key:`headerSessionMenuButton`,ref:G,class:`icon-button header-session-menu`,type:`button`,title:`会话操作`,"aria-label":`会话操作`,onClick:n[1]||=e=>Q(q.value.id,e)},[y(b,{name:`dots`,size:18})],512)):p(``,!0)]),_:1},8,[`messages`,`title`,`subtitle`,`loading`,`loading-older`,`has-older`,`connected`,`synced`,`show-tools`,`thinking`,`agent-avatars`,`interaction`,`fork-source-title`,`onLoadOlder`]),l(w).error?(a(),c(`p`,Re,[y(b,{name:`alert`,size:13}),_(u(l(w).error),1)])):p(``,!0),y(Ae,{ref_key:`composer`,ref:U,mode:`chat`,"draft-key":`${l(C).user?.id||`local`}:${l(C).activeProfile?.name||`default`}:${l(w).activeSessionId||`new`}`,disabled:l(w).connectionState===`failed`,streaming:l(w).isStreaming,sending:l(w).isSending,"model-label":l(w).selectedModel?.name||`选择模型`,"fast-mode":l(w).fastMode,"fast-mode-disabled":!l(w).activeSessionId,"reasoning-effort":at.value,"reasoning-value":l(w).reasoningEffort||``,"reasoning-options":it.value,"show-context":``,"context-used":l(w).contextUsage?.contextTokens,"context-limit":l(w).contextUsage?.contextLimit,"context-percent":l(w).contextUsage?.percentUsed,"queue-mode":F.value||l(w).isQueued,"tool-trace-visible":P.value,reference:et.value,"slash-commands":[{id:`fork`,label:`fork`,detail:`从当前会话创建分支`},{id:`compact`,label:`compact`,detail:`压缩当前会话上下文`},{id:`model`,label:`model`,detail:`切换模型`}],onSend:ht,onStop:l(w).interrupt,onModelClick:n[5]||=e=>M.value=!0,onFastModeToggle:Ct,onReasoningChange:St,onSettingsClick:Tt,onQueueToggle:n[6]||=e=>F.value=!F.value,onClearReference:n[7]||=e=>D.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-percent`,`queue-mode`,`tool-trace-visible`,`reference`,`onStop`])])]),_:1},8,[`sidebar-subtitle`,`inspector-open`,`inspector-close-label`]),y(ke,{section:`chat`,label:`搜索会话`,items:Ye.value,onSelect:pt},null,8,[`items`]),k.value?(a(),m(Se,{key:0,item:k.value,items:Ze.value,onClose:n[9]||=e=>k.value=null,onAddToComposer:yt,onSource:n[10]||=e=>k.value=null},null,8,[`item`,`items`])):p(``,!0),y(Ce,{modelValue:A.value,"onUpdate:modelValue":n[11]||=e=>A.value=e,images:Qe.value,onAdd:bt},null,8,[`modelValue`,`images`]),y(je,{open:M.value,options:l(w).models,"selected-id":nt.value,busy:N.value,onClose:n[12]||=e=>M.value=!1,onSelect:xt},null,8,[`open`,`options`,`selected-id`,`busy`]),R.value?(a(),m(ye,{key:1,title:`删除会话`,compact:``,"before-close":()=>!z.value,onClose:Ft},{default:s(()=>[h(`div`,{class:`session-delete`,"aria-busy":z.value},[h(`p`,null,`确定删除「`+u(R.value.title||`新会话`)+`」吗?删除后无法恢复。`,1),B.value?(a(),c(`p`,Be,u(B.value),1)):p(``,!0),h(`div`,Ve,[h(`button`,{class:`quiet-button`,type:`button`,disabled:z.value,onClick:Ft},`取消`,8,He),h(`button`,{class:`solid-button session-delete-confirm`,type:`button`,disabled:z.value,onClick:It},u(z.value?`删除中…`:`删除`),9,Ue)])],8,ze)]),_:1},8,[`before-close`])):p(``,!0),(a(),m(ne,{to:`body`},[y(ie,{name:`session-menu`},{default:s(()=>[I.value?(a(),c(`section`,{key:0,class:`session-actions`,style:oe(ot.value),role:`menu`,"aria-label":`会话操作`,onContextmenu:n[16]||=ce(()=>{},[`prevent`])},[L.value?(a(),c(d,{key:0},[h(`label`,null,[n[18]||=_(`会话名称`,-1),ee(h(`input`,{"onUpdate:modelValue":n[13]||=e=>V.value=e,maxlength:`120`,autofocus:``,onKeydown:re(kt,[`enter`])},null,544),[[ae,V.value]])]),h(`div`,null,[h(`button`,{class:`quiet-button`,type:`button`,onClick:n[14]||=e=>L.value=!1},`取消`),h(`button`,{class:`solid-button`,type:`button`,onClick:kt},`保存`)])],64)):(a(),c(d,{key:1},[h(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:jt},[y(b,{name:`menu`,size:14}),n[19]||=_(`会话大纲`,-1)]),I.value===l(w).activeSessionId?(a(),c(`button`,{key:0,class:`action-row`,role:`menuitem`,type:`button`,disabled:l(w).isStreaming||l(w).isQueued||l(w).isSending||l(w).activeRouteState?.isLoadingHistory,onClick:Et},[y(b,{name:`refresh`,size:14}),n[20]||=_(`强制刷新历史`,-1)],8,We)):p(``,!0),h(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:At},[y(b,{name:J.value?.pinned?`pin-off`:`pin`,size:14},null,8,[`name`]),_(u(J.value?.pinned?`取消置顶`:`置顶会话`),1)]),h(`button`,{class:`action-row`,role:`menuitem`,type:`button`,onClick:n[15]||=e=>L.value=!0},[y(b,{name:`edit`,size:14}),n[21]||=_(`重命名`,-1)]),h(`button`,{class:`action-row danger`,role:`menuitem`,type:`button`,onClick:Pt},[y(b,{name:`trash`,size:14}),n[22]||=_(`删除会话`,-1)])],64))],36)):p(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-058ae687`]]);export{w as default};
|
|
2
|
+
//# sourceMappingURL=ChatView-DHyj3yzu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatView-BKNyjhWf.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 {useUnreadStore} from '@/stores/unread'\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 StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nimport type { SessionSummary } from '@shared/types'\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 { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst unread=useUnreadStore()\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 pendingDeleteSession = ref<Pick<SessionSummary, 'id' | 'profile' | 'title'> | null>(null)\nconst deletingSession = ref(false)\nconst deleteSessionError = ref('')\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 unread.snapshot.conversations.find(c=>c.mode==='chat'&&c.id===session.id&&c.profile===session.profile)?.count ?? 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 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\nconst readPending=new Set<string>()\nasync function markVisible(ids:string[]){\n if(preview.value||filePreview.value||outlineOpen.value||modelDialog.value||!chat.activeSessionId||typeof route.query.unread==='string')return\n const session=chat.activeSessionId,profile=chat.activeProfileName,key=`${profile}:${session}:${ids.join(',')}`\n if(readPending.has(key))return\n readPending.add(key);try{await unread.visible('chat',session,profile,ids)}catch{}finally{readPending.delete(key)}\n}\nlet unreadNavigation=0\nwatch(()=>[route.params.id,route.query.unread,chat.messages.length],async()=>{\n const id=route.query.unread;if(typeof id!=='string'||!chat.activeSessionId)return\n const own=++unreadNavigation\n for(let i=0;i<100&&own===unreadNavigation;i++){\n await nextTick();if(timeline.value?.scrollToMessage(id)){const query={...route.query};delete query.unread;await router.replace({query});return}\n if(!chat.hasMoreBefore)return\n const before=chat.messages.length;await chat.loadOlder();if(chat.messages.length===before)return\n }\n},{flush:'post'})\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\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\nfunction confirmDeleteSession() {\n const session = actionSession.value\n if (!session) return\n pendingDeleteSession.value = { id: session.id, profile: session.profile, title: session.title }\n deleteSessionError.value = ''\n closeSessionActions()\n}\n\nfunction cancelDeleteSession() {\n if (deletingSession.value) return\n pendingDeleteSession.value = null\n deleteSessionError.value = ''\n void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nasync function deleteSession() {\n const session = pendingDeleteSession.value\n if (!session || deletingSession.value) return\n deletingSession.value = true\n deleteSessionError.value = ''\n try {\n await chat.removeSession(session.id, session.profile)\n if (route.params.sessionId === session.id) await router.replace({ path: '/chat', query: { profile: session.profile } })\n pendingDeleteSession.value = null\n } catch (cause) {\n deleteSessionError.value = cause instanceof Error ? cause.message : '删除失败,请重试'\n } finally {\n deletingSession.value = false\n }\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 @visible-messages=\"markVisible\"\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 show-context\n :context-used=\"chat.contextUsage?.contextTokens\"\n :context-limit=\"chat.contextUsage?.contextLimit\"\n :context-percent=\"chat.contextUsage?.percentUsed\"\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 <StandaloneDialog v-if=\"pendingDeleteSession\" title=\"删除会话\" compact :before-close=\"() => !deletingSession\" @close=\"cancelDeleteSession\">\n <div class=\"session-delete\" :aria-busy=\"deletingSession\">\n <p>确定删除「{{ pendingDeleteSession.title || '新会话' }}」吗?删除后无法恢复。</p>\n <p v-if=\"deleteSessionError\" class=\"session-delete-error\" role=\"alert\">{{ deleteSessionError }}</p>\n <div class=\"session-delete-actions\">\n <button class=\"quiet-button\" type=\"button\" :disabled=\"deletingSession\" @click=\"cancelDeleteSession\">取消</button>\n <button class=\"solid-button session-delete-confirm\" type=\"button\" :disabled=\"deletingSession\" @click=\"deleteSession\">{{ deletingSession ? '删除中…' : '删除' }}</button>\n </div>\n </div>\n </StandaloneDialog>\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=\"confirmDeleteSession\"><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.session-delete p { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }\n.session-delete .session-delete-error { margin-top: 12px; color: var(--danger); }\n.session-delete-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }\n.session-delete-actions button { min-width: 80px; min-height: 44px; font-size: 14px; }\n.session-delete-confirm { border-color: var(--danger); background: var(--danger); color: var(--text-on-solid); }\n.session-delete-confirm:hover { transform: none; filter: brightness(.95); }\n.session-delete-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }\n.session-delete-actions button:disabled { opacity: .6; cursor: wait; }\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 {useUnreadStore} from '@/stores/unread'\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 StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nimport type { SessionSummary } from '@shared/types'\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 { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst unread=useUnreadStore()\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 pendingDeleteSession = ref<Pick<SessionSummary, 'id' | 'profile' | 'title'> | null>(null)\nconst deletingSession = ref(false)\nconst deleteSessionError = ref('')\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 unread.snapshot.conversations.find(c=>c.mode==='chat'&&c.id===session.id&&c.profile===session.profile)?.count ?? 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 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\nconst readPending=new Set<string>()\nasync function markVisible(ids:string[]){\n if(preview.value||filePreview.value||outlineOpen.value||modelDialog.value||!chat.activeSessionId||typeof route.query.unread==='string')return\n const session=chat.activeSessionId,profile=chat.activeProfileName,key=`${profile}:${session}:${ids.join(',')}`\n if(readPending.has(key))return\n readPending.add(key);try{await unread.visible('chat',session,profile,ids)}catch{}finally{readPending.delete(key)}\n}\nlet unreadNavigation=0\nwatch(()=>[route.params.id,route.query.unread,chat.messages.length],async()=>{\n const id=route.query.unread;if(typeof id!=='string'||!chat.activeSessionId)return\n const own=++unreadNavigation\n for(let i=0;i<100&&own===unreadNavigation;i++){\n await nextTick();if(timeline.value?.scrollToMessage(id)){const query={...route.query};delete query.unread;await router.replace({query});return}\n if(!chat.hasMoreBefore)return\n const before=chat.messages.length;await chat.loadOlder();if(chat.messages.length===before)return\n }\n},{flush:'post'})\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\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\nfunction confirmDeleteSession() {\n const session = actionSession.value\n if (!session) return\n pendingDeleteSession.value = { id: session.id, profile: session.profile, title: session.title }\n deleteSessionError.value = ''\n closeSessionActions()\n}\n\nfunction cancelDeleteSession() {\n if (deletingSession.value) return\n pendingDeleteSession.value = null\n deleteSessionError.value = ''\n void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nasync function deleteSession() {\n const session = pendingDeleteSession.value\n if (!session || deletingSession.value) return\n deletingSession.value = true\n deleteSessionError.value = ''\n try {\n await chat.removeSession(session.id, session.profile)\n if (route.params.sessionId === session.id) await router.replace({ path: '/chat', query: { profile: session.profile } })\n pendingDeleteSession.value = null\n } catch (cause) {\n deleteSessionError.value = cause instanceof Error ? cause.message : '删除失败,请重试'\n } finally {\n deletingSession.value = false\n }\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 @visible-messages=\"markVisible\"\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 show-context\n :context-used=\"chat.contextUsage?.contextTokens\"\n :context-limit=\"chat.contextUsage?.contextLimit\"\n :context-percent=\"chat.contextUsage?.percentUsed\"\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 <StandaloneDialog v-if=\"pendingDeleteSession\" title=\"删除会话\" compact :before-close=\"() => !deletingSession\" @close=\"cancelDeleteSession\">\n <div class=\"session-delete\" :aria-busy=\"deletingSession\">\n <p>确定删除「{{ pendingDeleteSession.title || '新会话' }}」吗?删除后无法恢复。</p>\n <p v-if=\"deleteSessionError\" class=\"session-delete-error\" role=\"alert\">{{ deleteSessionError }}</p>\n <div class=\"session-delete-actions\">\n <button class=\"quiet-button\" type=\"button\" :disabled=\"deletingSession\" @click=\"cancelDeleteSession\">取消</button>\n <button class=\"solid-button session-delete-confirm\" type=\"button\" :disabled=\"deletingSession\" @click=\"deleteSession\">{{ deletingSession ? '删除中…' : '删除' }}</button>\n </div>\n </div>\n </StandaloneDialog>\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=\"confirmDeleteSession\"><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.session-delete p { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }\n.session-delete .session-delete-error { margin-top: 12px; color: var(--danger); }\n.session-delete-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }\n.session-delete-actions button { min-width: 80px; min-height: 44px; font-size: 14px; }\n.session-delete-confirm { border-color: var(--danger); background: var(--danger); color: var(--text-on-solid); }\n.session-delete-confirm:hover { transform: none; filter: brightness(.95); }\n.session-delete-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }\n.session-delete-actions button:disabled { opacity: .6; cursor: wait; }\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":"6wBAEA,IAAM,EAAM,sCAcZ,eAAsB,GAAiB,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,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EAAA,CAAA,CAAA,EACvH,EAA8I,SAAA,CAAtI,MAAM,oBAAoB,KAAK,WAAW,KAAK,SAAU,QAAO,EAAsB,EAAA,CAAA,EAAmC,EAAA,CAA1B,KAAK,QAAS,KAAM,EAAM,CAAA,EAAA,AAAA,EAAA,MAAA,EAAA,OAAI,EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ChatView-DHyj3yzu.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 {useUnreadStore} from '@/stores/unread'\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 StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nimport type { SessionSummary } from '@shared/types'\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 { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst unread=useUnreadStore()\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 pendingDeleteSession = ref<Pick<SessionSummary, 'id' | 'profile' | 'title'> | null>(null)\nconst deletingSession = ref(false)\nconst deleteSessionError = ref('')\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 unread.snapshot.conversations.find(c=>c.mode==='chat'&&c.id===session.id&&c.profile===session.profile)?.count ?? 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 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\nconst readPending=new Set<string>()\nasync function markVisible(ids:string[]){\n if(preview.value||filePreview.value||outlineOpen.value||modelDialog.value||!chat.activeSessionId||typeof route.query.unread==='string')return\n const session=chat.activeSessionId,profile=chat.activeProfileName,key=`${profile}:${session}:${ids.join(',')}`\n if(readPending.has(key))return\n readPending.add(key);try{await unread.visible('chat',session,profile,ids)}catch{}finally{readPending.delete(key)}\n}\nlet unreadNavigation=0\nwatch(()=>[route.params.id,route.query.unread,chat.messages.length],async()=>{\n const id=route.query.unread;if(typeof id!=='string'||!chat.activeSessionId)return\n const own=++unreadNavigation\n for(let i=0;i<100&&own===unreadNavigation;i++){\n await nextTick();if(timeline.value?.scrollToMessage(id)){const query={...route.query};delete query.unread;await router.replace({query});return}\n if(!chat.hasMoreBefore)return\n const before=chat.messages.length;await chat.loadOlder();if(chat.messages.length===before)return\n }\n},{flush:'post'})\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\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\nfunction confirmDeleteSession() {\n const session = actionSession.value\n if (!session) return\n pendingDeleteSession.value = { id: session.id, profile: session.profile, title: session.title }\n deleteSessionError.value = ''\n closeSessionActions()\n}\n\nfunction cancelDeleteSession() {\n if (deletingSession.value) return\n pendingDeleteSession.value = null\n deleteSessionError.value = ''\n void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nasync function deleteSession() {\n const session = pendingDeleteSession.value\n if (!session || deletingSession.value) return\n deletingSession.value = true\n deleteSessionError.value = ''\n try {\n await chat.removeSession(session.id, session.profile)\n if (route.params.sessionId === session.id) await router.replace({ path: '/chat', query: { profile: session.profile } })\n pendingDeleteSession.value = null\n } catch (cause) {\n deleteSessionError.value = cause instanceof Error ? cause.message : '删除失败,请重试'\n } finally {\n deletingSession.value = false\n }\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 @visible-messages=\"markVisible\"\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 show-context\n :context-used=\"chat.contextUsage?.contextTokens\"\n :context-limit=\"chat.contextUsage?.contextLimit\"\n :context-percent=\"chat.contextUsage?.percentUsed\"\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 <StandaloneDialog v-if=\"pendingDeleteSession\" title=\"删除会话\" compact :before-close=\"() => !deletingSession\" @close=\"cancelDeleteSession\">\n <div class=\"session-delete\" :aria-busy=\"deletingSession\">\n <p>确定删除「{{ pendingDeleteSession.title || '新会话' }}」吗?删除后无法恢复。</p>\n <p v-if=\"deleteSessionError\" class=\"session-delete-error\" role=\"alert\">{{ deleteSessionError }}</p>\n <div class=\"session-delete-actions\">\n <button class=\"quiet-button\" type=\"button\" :disabled=\"deletingSession\" @click=\"cancelDeleteSession\">取消</button>\n <button class=\"solid-button session-delete-confirm\" type=\"button\" :disabled=\"deletingSession\" @click=\"deleteSession\">{{ deletingSession ? '删除中…' : '删除' }}</button>\n </div>\n </div>\n </StandaloneDialog>\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=\"confirmDeleteSession\"><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.session-delete p { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }\n.session-delete .session-delete-error { margin-top: 12px; color: var(--danger); }\n.session-delete-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }\n.session-delete-actions button { min-width: 80px; min-height: 44px; font-size: 14px; }\n.session-delete-confirm { border-color: var(--danger); background: var(--danger); color: var(--text-on-solid); }\n.session-delete-confirm:hover { transform: none; filter: brightness(.95); }\n.session-delete-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }\n.session-delete-actions button:disabled { opacity: .6; cursor: wait; }\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 {useUnreadStore} from '@/stores/unread'\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 StandaloneDialog from '@/components/common/StandaloneDialog.vue'\nimport type { SessionSummary } from '@shared/types'\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 { isOwnedChatSession } from '@/utils/sessionOwnership'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\nimport { getSession } from '@/api/sessions'\n\nconst unread=useUnreadStore()\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 pendingDeleteSession = ref<Pick<SessionSummary, 'id' | 'profile' | 'title'> | null>(null)\nconst deletingSession = ref(false)\nconst deleteSessionError = ref('')\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 unread.snapshot.conversations.find(c=>c.mode==='chat'&&c.id===session.id&&c.profile===session.profile)?.count ?? 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 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\nconst readPending=new Set<string>()\nasync function markVisible(ids:string[]){\n if(preview.value||filePreview.value||outlineOpen.value||modelDialog.value||!chat.activeSessionId||typeof route.query.unread==='string')return\n const session=chat.activeSessionId,profile=chat.activeProfileName,key=`${profile}:${session}:${ids.join(',')}`\n if(readPending.has(key))return\n readPending.add(key);try{await unread.visible('chat',session,profile,ids)}catch{}finally{readPending.delete(key)}\n}\nlet unreadNavigation=0\nwatch(()=>[route.params.id,route.query.unread,chat.messages.length],async()=>{\n const id=route.query.unread;if(typeof id!=='string'||!chat.activeSessionId)return\n const own=++unreadNavigation\n for(let i=0;i<100&&own===unreadNavigation;i++){\n await nextTick();if(timeline.value?.scrollToMessage(id)){const query={...route.query};delete query.unread;await router.replace({query});return}\n if(!chat.hasMoreBefore)return\n const before=chat.messages.length;await chat.loadOlder();if(chat.messages.length===before)return\n }\n},{flush:'post'})\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\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\nfunction confirmDeleteSession() {\n const session = actionSession.value\n if (!session) return\n pendingDeleteSession.value = { id: session.id, profile: session.profile, title: session.title }\n deleteSessionError.value = ''\n closeSessionActions()\n}\n\nfunction cancelDeleteSession() {\n if (deletingSession.value) return\n pendingDeleteSession.value = null\n deleteSessionError.value = ''\n void nextTick(() => headerSessionMenuButton.value?.focus())\n}\n\nasync function deleteSession() {\n const session = pendingDeleteSession.value\n if (!session || deletingSession.value) return\n deletingSession.value = true\n deleteSessionError.value = ''\n try {\n await chat.removeSession(session.id, session.profile)\n if (route.params.sessionId === session.id) await router.replace({ path: '/chat', query: { profile: session.profile } })\n pendingDeleteSession.value = null\n } catch (cause) {\n deleteSessionError.value = cause instanceof Error ? cause.message : '删除失败,请重试'\n } finally {\n deletingSession.value = false\n }\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 @visible-messages=\"markVisible\"\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 show-context\n :context-used=\"chat.contextUsage?.contextTokens\"\n :context-limit=\"chat.contextUsage?.contextLimit\"\n :context-percent=\"chat.contextUsage?.percentUsed\"\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 <StandaloneDialog v-if=\"pendingDeleteSession\" title=\"删除会话\" compact :before-close=\"() => !deletingSession\" @close=\"cancelDeleteSession\">\n <div class=\"session-delete\" :aria-busy=\"deletingSession\">\n <p>确定删除「{{ pendingDeleteSession.title || '新会话' }}」吗?删除后无法恢复。</p>\n <p v-if=\"deleteSessionError\" class=\"session-delete-error\" role=\"alert\">{{ deleteSessionError }}</p>\n <div class=\"session-delete-actions\">\n <button class=\"quiet-button\" type=\"button\" :disabled=\"deletingSession\" @click=\"cancelDeleteSession\">取消</button>\n <button class=\"solid-button session-delete-confirm\" type=\"button\" :disabled=\"deletingSession\" @click=\"deleteSession\">{{ deletingSession ? '删除中…' : '删除' }}</button>\n </div>\n </div>\n </StandaloneDialog>\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=\"confirmDeleteSession\"><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.session-delete p { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }\n.session-delete .session-delete-error { margin-top: 12px; color: var(--danger); }\n.session-delete-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }\n.session-delete-actions button { min-width: 80px; min-height: 44px; font-size: 14px; }\n.session-delete-confirm { border-color: var(--danger); background: var(--danger); color: var(--text-on-solid); }\n.session-delete-confirm:hover { transform: none; filter: brightness(.95); }\n.session-delete-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }\n.session-delete-actions button:disabled { opacity: .6; cursor: wait; }\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":"6wBAEA,IAAM,EAAM,sCAcZ,eAAsB,GAAiB,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,GAAiB,CAAE,KAAM,EAAQ,KAAM,YAAa,EAAQ,IAAK,SAAU,EAAQ,QAAS,CAAC,CAC5G,MAAQ,CACN,OAAO,IACT,CACF,0QCLA,IAAM,EAAO,GAAe,EACtB,EAAO,GAAa,EACpB,EAAO,GAAa,EACpB,EAAQ,GAAS,EACjB,EAAS,GAAU,EACnB,EAAS,EAAsB,IAAI,EACnC,EAAU,EAA0B,IAAI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