hermes-web-ui 0.6.24 → 0.6.25
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/dist/client/assets/js/{ChannelsView-DV-LtXVi.js → ChannelsView-p3dSvD02.js} +1 -1
- package/dist/client/assets/js/{ChatPanel-DyZWRnQs.js → ChatPanel-DRCE0v4g.js} +1 -1
- package/dist/client/assets/js/{ChatView-CuWpMwOd.js → ChatView-CAoJp8-Q.js} +1 -1
- package/dist/client/assets/js/{CodingAgentsView-D_Ngirz0.js → CodingAgentsView-X0I-H0Yu.js} +1 -1
- package/dist/client/assets/js/{DesktopPetView-BGY-7Dcd.js → DesktopPetView-BH9a1zur.js} +1 -1
- package/dist/client/assets/js/{DevicesView-BNZqDe2U.js → DevicesView-CMcwuGZ6.js} +1 -1
- package/dist/client/assets/js/{FileEditor-BPFC-M3W.js → FileEditor-CzWdryd5.js} +1 -1
- package/dist/client/assets/js/{FileRenameModal-5mJtyNBP.js → FileRenameModal-C2YmHkSN.js} +1 -1
- package/dist/client/assets/js/{FilesView-CRbkvC6l.js → FilesView-CKxvh6yi.js} +1 -1
- package/dist/client/assets/js/{GlobalAgentView-my3AKdll.js → GlobalAgentView-77p8MKvy.js} +1 -1
- package/dist/client/assets/js/{GroupChatView-btwSVoC0.js → GroupChatView-D1WFEfIs.js} +1 -1
- package/dist/client/assets/js/{HistoryMessageList-IubX9-tb.js → HistoryMessageList-BcG-gj6N.js} +1 -1
- package/dist/client/assets/js/{HistoryView-N3v7MNfo.js → HistoryView-CzybyBXj.js} +1 -1
- package/dist/client/assets/js/{JobsView-CHq_TJQ6.js → JobsView-BviznpSY.js} +1 -1
- package/dist/client/assets/js/{KanbanView-BMh8IgQo.js → KanbanView-B0c6OMrf.js} +1 -1
- package/dist/client/assets/js/{LoginView-sE4g4Zua.js → LoginView-B9nES8-3.js} +1 -1
- package/dist/client/assets/js/{LogsView-awh5ZCp8.js → LogsView-kLI6-05w.js} +1 -1
- package/dist/client/assets/js/{MarkdownRenderer-BbGvq6C-.js → MarkdownRenderer-DQvs79tf.js} +1 -1
- package/dist/client/assets/js/{McpManagerView-CnSCITtQ.js → McpManagerView-BZU1Puf0.js} +1 -1
- package/dist/client/assets/js/{MemoryView-CbQOeUKI.js → MemoryView-BH4LZtYd.js} +1 -1
- package/dist/client/assets/js/{MessageItem-DSHiAgFE.js → MessageItem-Cu3_aQT8.js} +2 -2
- package/dist/client/assets/js/{MessageList-oRCKlivC.js → MessageList-Ds_mjMbf.js} +1 -1
- package/dist/client/assets/js/{ModelsView-B0esXyBm.js → ModelsView-CZK6wwtt.js} +1 -1
- package/dist/client/assets/js/{OutlinePanel-BofcYepl.js → OutlinePanel-CYuSrNX9.js} +1 -1
- package/dist/client/assets/js/{PageSidebarFooter-BPeWlPvZ.js → PageSidebarFooter-Dk-OfmNy.js} +1 -1
- package/dist/client/assets/js/{PerformanceView-gc12dWCZ.js → PerformanceView-DkXk4HB_.js} +1 -1
- package/dist/client/assets/js/{PetdexView-CZjbg41u.js → PetdexView-DGkSZYVi.js} +1 -1
- package/dist/client/assets/js/{PluginsView-DRwyXTJC.js → PluginsView-D197obRC.js} +1 -1
- package/dist/client/assets/js/{ProfilesView-zVd3TfNW.js → ProfilesView-BhGBaYDE.js} +1 -1
- package/dist/client/assets/js/{SettingRow-G7ZusJw_.js → SettingRow-DfRI-z7L.js} +1 -1
- package/dist/client/assets/js/{SettingsCircuitBadge-CFo2KqP-.js → SettingsCircuitBadge-Eiv8LQz0.js} +1 -1
- package/dist/client/assets/js/{SettingsView-DDjt6UpN.js → SettingsView-B4ipIIOj.js} +1 -1
- package/dist/client/assets/js/{SkillsUsageView-DnVnAYHG.js → SkillsUsageView-DT4o1LA9.js} +1 -1
- package/dist/client/assets/js/{SkillsView-CHi4L7Oi.js → SkillsView-CUK-9OLz.js} +1 -1
- package/dist/client/assets/js/{TerminalPanel-Dx7huJY2.js → TerminalPanel-gyT2AS7Z.js} +1 -1
- package/dist/client/assets/js/{TerminalView-PQIIFHwX.js → TerminalView-C3a6BwEG.js} +1 -1
- package/dist/client/assets/js/{UsageView-Dzr2wBc7.js → UsageView-DrUS9OIk.js} +1 -1
- package/dist/client/assets/js/{VersionPreviewView-JQrieRPU.js → VersionPreviewView-qbXwqYd3.js} +1 -1
- package/dist/client/assets/js/{WorkflowView-DRanDY9s.js → WorkflowView-D-6z--9A.js} +1 -1
- package/dist/client/assets/js/{_plugin-vue_export-helper-fFMkIM4P.js → _plugin-vue_export-helper-CvnFozKy.js} +2 -2
- package/dist/client/assets/js/{chat-timestamp-CZtP79YD.js → chat-timestamp-CkDNtK9Y.js} +1 -1
- package/dist/client/assets/js/{files-DOpu4Qfg.js → files-CBYc0MSs.js} +1 -1
- package/dist/client/assets/js/index-B2IKGvbR.js +3 -0
- package/dist/client/assets/js/{models-y7NaVj-e.js → models-DetB4_Ug.js} +1 -1
- package/dist/client/assets/js/{session-browser-prefs-BOqwOeHi.js → session-browser-prefs-BYjSnxJq.js} +1 -1
- package/dist/client/assets/js/{skills-D7ZMzzzG.js → skills-5qxphanX.js} +1 -1
- package/dist/client/assets/js/{system-CRmVbE8Z.js → system-Onp4yS9N.js} +1 -1
- package/dist/client/assets/js/{ttsHelpers-vHLmbeY4.js → ttsHelpers-DNcZ5khq.js} +1 -1
- package/dist/client/assets/js/{useSttSettings-s4LBWl55.js → useSttSettings-C-jexrW7.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/server/agent-bridge/python/bridge_runtime.py +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/openapi.json +1 -1
- package/package.json +1 -1
- package/dist/client/assets/js/index-Brl4qW5V.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as U}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as J,Bt as P,Hn as r,I as xe,It as W,K as He,Kt as Ee,Nn as X,Ot as _,P as Ke,V as Je,an as s,cn as g,cr as t,er as m,fn as o,g as We,hn as Xe,in as A,jn as d,kn as Ae,on as k,pn as u,pr as a,sn as T,t as Ge,tn as G,w as Qe}from"./ui-vendor-DDMfmCj2.js";import{O as Ye,k as Ze}from"./vue-vendor-BsMpqyaC.js";import{f as y,n as en,t as nn,u as tn}from"./_plugin-vue_export-helper-fFMkIM4P.js";import{n as an,t as sn}from"./clipboard-1NPxC3YL.js";async function ln(){return y("/api/devices")}async function rn(){return y("/api/devices/pairing-link")}async function on(){return y("/api/devices/scan",{method:"POST"})}async function un(c,i){return y(`/api/devices/${encodeURIComponent(c)}/request`,{method:"POST",body:JSON.stringify({pairing_code:i})})}async function dn(c){return y("/api/devices/manual-request",{method:"POST",body:JSON.stringify({url:c})})}async function cn(c){return y(`/api/devices/${encodeURIComponent(c)}/approve`,{method:"POST"})}async function _n(c){return y(`/api/devices/${encodeURIComponent(c)}/reject`,{method:"POST"})}async function pn(c){return y(`/api/devices/${encodeURIComponent(c)}/block`,{method:"POST"})}async function vn(c){return y(`/api/devices/${encodeURIComponent(c)}/unblock`,{method:"POST"})}async function fn(c){return y(`/api/devices/${encodeURIComponent(c)}/request-history`,{method:"DELETE"})}var gn=U((()=>{tn()})),Q,Y,Z,ee,ne,te,ie,ae,se,le,re,oe,ue,de,ce,_e,pe,ve,fe,ge,me,ye,he,ke,be,we,Pe,Ce=U((()=>{Ee(),Ge(),Ye(),an(),gn(),Q={class:"devices-view"},Y={class:"page-header"},Z={class:"header-title"},ee={class:"header-actions"},ne={class:"header-meta"},te={class:"devices-content"},ie={key:0,class:"empty-state"},ae={class:"empty-title"},se={key:1,class:"device-grid"},le={class:"device-card-header"},re={class:"device-title-block"},oe={class:"device-name"},ue=["href"],de={key:1,class:"device-link"},ce={class:"device-status-row"},_e={class:"device-meta-list"},pe={class:"device-actions"},ve={key:0,class:"request-empty"},fe={key:1,class:"request-list"},ge={class:"request-name"},me={class:"request-meta"},ye={class:"request-status-row"},he={class:"request-actions"},ke={class:"pairing-code-dialog"},be={class:"pairing-code-title"},we={class:"pairing-code-actions"},Pe=Xe({__name:"DevicesView",setup(c){const{t:i}=Ze(),v=Je(),L=m(!1),S=m(!1),z=m(!1),R=m(""),f=m(""),B=m(!1),O=m(!1),$=m(!1),b=m(""),q=m(null),p=m({scanning:!1,last_scanned_at:null,devices:[],requests:[]}),V=A(()=>[...p.value.devices].sort((e,l)=>{const n=+!!l.online-+!!e.online;if(n!==0)return n;const h=I(e.endpoint_kind)-I(l.endpoint_kind);return h!==0?h:e.id.localeCompare(l.id)})),w=A(()=>!!(q.value&&f.value===q.value.id));function I(e){return e==="web"?0:e==="desktop"?1:2}function qe(e){return i(`devices.endpoint.${e}`)}function Te(e){return e==="desktop"?"success":e==="web"?"info":"default"}function N(e){return i(`devices.inboundStatus.${e}`)}function Le(e){return i(`devices.outboundStatus.${e}`)}function Se(e){return e.outbound_status==="approved"?i("devices.paired"):Le(e.outbound_status)}function ze(e){return e.outbound_status==="approved"?"success":e.outbound_status==="pending"?"info":e.outbound_status==="blocked"?"error":e.outbound_status==="rejected"?"warning":"default"}function Re(e){return e.online?i("devices.online"):i("devices.offline")}function $e(e){return e.online?"success":"default"}function Ue(e){return!!e.online&&(e.outbound_status==="none"||e.outbound_status==="rejected")}function Be(e){return e.inbound_status!=="blocked"}function Oe(){return p.value.requests.length>0?i("devices.requestsWithCount",{count:p.value.requests.length}):i("devices.requests")}function M(e){return e.inbound_status!=="pending"}function Ve(e){return M(e)?i("devices.processed"):i("devices.unprocessed")}function Ie(e){return M(e)?"success":"warning"}function Ne(e){return[e.os.type||e.os.platform,e.os.release,e.os.arch].filter(Boolean).join(" ")}function Me(e){if(!e)return i("devices.never");const l=new Date(e);return Number.isNaN(l.getTime())?String(e):l.toLocaleString()}function j(e){return e||i("devices.unknown")}function D(e){try{const l=new URL(e);return l.protocol==="http:"||l.protocol==="https:"?l.toString():""}catch{return""}}async function je(){L.value=!0;try{p.value=await ln()}catch(e){v.error(e?.message||i("devices.loadFailed"))}finally{L.value=!1}}async function F(){S.value=!0;try{p.value=await on()}catch(e){v.error(e?.message||i("devices.scanFailed"))}finally{S.value=!1}}async function De(){O.value=!0;try{await sn((await rn()).link)?v.success(i("devices.pairingLinkCopied")):v.error(i("devices.pairingLinkCopyFailed"))}catch(e){v.error(e?.message||i("devices.pairingLinkCopyFailed"))}finally{O.value=!1}}function Fe(e){q.value=e,b.value="",$.value=!0}function x(){$.value=!1,b.value="",q.value=null}function H(){w.value||x()}async function E(){const e=q.value;if(!e||w.value)return;const l=b.value.trim();if(!l){v.warning(i("devices.pairingCodeRequired"));return}f.value=e.id;try{p.value=await un(e.id,l),x()}catch(n){if(String(n?.message||"").includes("Duplicate pairing request")){v.warning(i("devices.duplicateRequest"));return}v.error(n?.message||i("devices.updateFailed"))}finally{f.value=""}}async function C(e,l){f.value=e.id;try{p.value=l==="approve"?await cn(e.id):l==="reject"?await _n(e.id):l==="block"?await pn(e.id):l==="deleteHistory"?await fn(e.id):await vn(e.id)}catch(n){v.error(n?.message||i("devices.updateFailed"))}finally{f.value=""}}async function K(){const e=R.value.trim();if(!e){v.warning(i("devices.manualUrlRequired"));return}z.value=!0;try{p.value=await dn(e),R.value="",v.success(i("devices.manualRequestSent"))}catch(l){v.error(l?.message||i("devices.manualRequestFailed"))}finally{z.value=!1}}return Ae(()=>{je()}),(e,l)=>(d(),g("div",Q,[s("header",Y,[s("h2",Z,a(t(i)("devices.title")),1),s("div",ee,[u(t(W),{value:R.value,"onUpdate:value":l[0]||(l[0]=n=>R.value=n),class:"manual-pairing-input",size:"small",clearable:"",placeholder:t(i)("devices.manualUrlPlaceholder"),disabled:z.value,onKeyup:J(K,["enter"])},null,8,["value","placeholder","disabled"]),u(t(_),{size:"small",loading:z.value,onClick:K},{default:r(()=>[o(a(t(i)("devices.manualPairing")),1)]),_:1},8,["loading"]),u(t(_),{size:"small",loading:O.value,onClick:De},{default:r(()=>[o(a(t(i)("devices.copyPairingLink")),1)]),_:1},8,["loading"]),s("div",ne,[s("span",null,a(t(i)("devices.count",{count:V.value.length})),1),s("span",null,a(t(i)("devices.lastScanned",{time:Me(p.value.last_scanned_at)})),1)]),u(t(_),{size:"small",onClick:l[1]||(l[1]=n=>B.value=!0)},{default:r(()=>[o(a(Oe()),1)]),_:1}),u(t(_),{size:"small",type:"primary",loading:S.value||p.value.scanning,onClick:F},{default:r(()=>[o(a(t(i)("devices.refresh")),1)]),_:1},8,["loading"])])]),u(t(We),{show:L.value,class:"devices-spin"},{default:r(()=>[s("div",te,[V.value.length===0&&!L.value?(d(),g("div",ie,[s("div",ae,a(t(i)("devices.empty")),1),u(t(_),{size:"small",loading:S.value||p.value.scanning,onClick:F},{default:r(()=>[o(a(t(i)("devices.refresh")),1)]),_:1},8,["loading"])])):(d(),g("div",se,[(d(!0),g(G,null,X(V.value,n=>(d(),g("article",{key:n.id,class:"device-card"},[s("div",le,[s("div",re,[s("div",oe,a(n.computer_name||n.ip),1),D(n.url)?(d(),g("a",{key:0,class:"device-link",href:D(n.url),target:"_blank",rel:"noopener noreferrer"},a(n.ip)+":"+a(n.http_port),9,ue)):(d(),g("span",de,a(n.ip)+":"+a(n.http_port),1))]),u(t(P),{size:"small",type:Te(n.endpoint_kind),round:""},{default:r(()=>[o(a(qe(n.endpoint_kind)),1)]),_:2},1032,["type"])]),s("div",ce,[u(t(P),{size:"small",type:$e(n),round:""},{default:r(()=>[o(a(Re(n)),1)]),_:2},1032,["type"]),u(t(P),{size:"small",type:ze(n),round:""},{default:r(()=>[o(a(Se(n)),1)]),_:2},1032,["type"]),n.inbound_status==="blocked"?(d(),k(t(P),{key:0,size:"small",type:"error",round:""},{default:r(()=>[o(a(N(n.inbound_status)),1)]),_:2},1024)):T("",!0)]),s("dl",_e,[s("div",null,[s("dt",null,a(t(i)("devices.os")),1),s("dd",null,a(Ne(n)||t(i)("devices.unknown")),1)]),s("div",null,[s("dt",null,a(t(i)("devices.agentVersion")),1),s("dd",null,a(j(n.hermes_agent_version)),1)]),s("div",null,[s("dt",null,a(t(i)("devices.webUiVersion")),1),s("dd",null,a(j(n.hermes_web_ui_version)),1)]),s("div",null,[s("dt",null,a(t(i)("devices.responseMs")),1),s("dd",null,a(n.response_ms)+"ms",1)])]),s("div",pe,[Ue(n)?(d(),k(t(_),{key:0,size:"tiny",type:"primary",loading:f.value===n.id,onClick:h=>Fe(n)},{default:r(()=>[o(a(t(i)("devices.requestPairing")),1)]),_:1},8,["loading","onClick"])):T("",!0),Be(n)?(d(),k(t(_),{key:1,size:"tiny",quaternary:"",type:"error",loading:f.value===n.id,onClick:h=>C(n,"block")},{default:r(()=>[o(a(t(i)("devices.block")),1)]),_:1},8,["loading","onClick"])):(d(),k(t(_),{key:2,size:"tiny",quaternary:"",loading:f.value===n.id,onClick:h=>C(n,"unblock")},{default:r(()=>[o(a(t(i)("devices.unblock")),1)]),_:1},8,["loading","onClick"]))])]))),128))]))])]),_:1},8,["show"]),u(t(xe),{show:B.value,"onUpdate:show":l[2]||(l[2]=n=>B.value=n),width:"min(420px, 100vw)",placement:"right"},{default:r(()=>[u(t(Ke),{title:t(i)("devices.requests"),closable:""},{default:r(()=>[p.value.requests.length===0?(d(),g("div",ve,a(t(i)("devices.noRequests")),1)):(d(),g("div",fe,[(d(!0),g(G,null,X(p.value.requests,n=>(d(),g("article",{key:n.id,class:"request-item"},[s("div",null,[s("div",ge,a(n.computer_name||n.ip),1),s("div",me,a(n.ip)+":"+a(n.http_port),1),s("div",ye,[u(t(P),{size:"small",type:Ie(n),round:""},{default:r(()=>[o(a(Ve(n)),1)]),_:2},1032,["type"]),u(t(P),{size:"small",type:n.inbound_status==="blocked"?"error":n.inbound_status==="rejected"?"warning":n.inbound_status==="approved"?"success":"info",round:""},{default:r(()=>[o(a(N(n.inbound_status)),1)]),_:2},1032,["type"])])]),s("div",he,[n.inbound_status==="pending"?(d(),k(t(_),{key:0,size:"tiny",type:"success",loading:f.value===n.id,onClick:h=>C(n,"approve")},{default:r(()=>[o(a(t(i)("devices.approve")),1)]),_:1},8,["loading","onClick"])):T("",!0),n.inbound_status==="pending"?(d(),k(t(_),{key:1,size:"tiny",quaternary:"",type:"warning",loading:f.value===n.id,onClick:h=>C(n,"reject")},{default:r(()=>[o(a(t(i)("devices.reject")),1)]),_:1},8,["loading","onClick"])):T("",!0),n.inbound_status==="pending"?(d(),k(t(_),{key:2,size:"tiny",quaternary:"",type:"error",loading:f.value===n.id,onClick:h=>C(n,"block")},{default:r(()=>[o(a(t(i)("devices.block")),1)]),_:1},8,["loading","onClick"])):T("",!0),u(t(Qe),{onPositiveClick:h=>C(n,"deleteHistory")},{trigger:r(()=>[u(t(_),{size:"tiny",quaternary:"",type:"error",loading:f.value===n.id},{default:r(()=>[o(a(t(i)("devices.deleteHistory")),1)]),_:1},8,["loading"])]),default:r(()=>[o(" "+a(t(i)("devices.deleteHistoryConfirm")),1)]),_:2},1032,["onPositiveClick"])])]))),128))]))]),_:1},8,["title"])]),_:1},8,["show"]),u(t(He),{show:$.value,"onUpdate:show":l[4]||(l[4]=n=>$.value=n),"mask-closable":!w.value,onEsc:H},{default:r(()=>[s("div",ke,[s("div",be,a(t(i)("devices.pairingCodeTitle")),1),u(t(W),{value:b.value,"onUpdate:value":l[3]||(l[3]=n=>b.value=n),clearable:"",placeholder:t(i)("devices.pairingCodePlaceholder"),disabled:w.value,onKeyup:J(E,["enter"])},null,8,["value","placeholder","disabled"]),s("div",we,[u(t(_),{disabled:w.value,onClick:H},{default:r(()=>[o(a(t(i)("common.cancel")),1)]),_:1},8,["disabled"]),u(t(_),{type:"primary",loading:w.value,disabled:!b.value.trim(),onClick:E},{default:r(()=>[o(a(t(i)("devices.submitPairingRequest")),1)]),_:1},8,["loading","disabled"])])])]),_:1},8,["show","mask-closable"])]))}})})),mn=U((()=>{})),yn,hn=U((()=>{Ce(),Ce(),mn(),en(),yn=nn(Pe,[["__scopeId","data-v-7f90b0ec"]])}));hn();export{yn as default};
|
|
1
|
+
import{n as U}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as J,Bt as P,Hn as r,I as xe,It as W,K as He,Kt as Ee,Nn as X,Ot as _,P as Ke,V as Je,an as s,cn as g,cr as t,er as m,fn as o,g as We,hn as Xe,in as A,jn as d,kn as Ae,on as k,pn as u,pr as a,sn as T,t as Ge,tn as G,w as Qe}from"./ui-vendor-DDMfmCj2.js";import{O as Ye,k as Ze}from"./vue-vendor-BsMpqyaC.js";import{f as y,n as en,t as nn,u as tn}from"./_plugin-vue_export-helper-CvnFozKy.js";import{n as an,t as sn}from"./clipboard-1NPxC3YL.js";async function ln(){return y("/api/devices")}async function rn(){return y("/api/devices/pairing-link")}async function on(){return y("/api/devices/scan",{method:"POST"})}async function un(c,i){return y(`/api/devices/${encodeURIComponent(c)}/request`,{method:"POST",body:JSON.stringify({pairing_code:i})})}async function dn(c){return y("/api/devices/manual-request",{method:"POST",body:JSON.stringify({url:c})})}async function cn(c){return y(`/api/devices/${encodeURIComponent(c)}/approve`,{method:"POST"})}async function _n(c){return y(`/api/devices/${encodeURIComponent(c)}/reject`,{method:"POST"})}async function pn(c){return y(`/api/devices/${encodeURIComponent(c)}/block`,{method:"POST"})}async function vn(c){return y(`/api/devices/${encodeURIComponent(c)}/unblock`,{method:"POST"})}async function fn(c){return y(`/api/devices/${encodeURIComponent(c)}/request-history`,{method:"DELETE"})}var gn=U((()=>{tn()})),Q,Y,Z,ee,ne,te,ie,ae,se,le,re,oe,ue,de,ce,_e,pe,ve,fe,ge,me,ye,he,ke,be,we,Pe,Ce=U((()=>{Ee(),Ge(),Ye(),an(),gn(),Q={class:"devices-view"},Y={class:"page-header"},Z={class:"header-title"},ee={class:"header-actions"},ne={class:"header-meta"},te={class:"devices-content"},ie={key:0,class:"empty-state"},ae={class:"empty-title"},se={key:1,class:"device-grid"},le={class:"device-card-header"},re={class:"device-title-block"},oe={class:"device-name"},ue=["href"],de={key:1,class:"device-link"},ce={class:"device-status-row"},_e={class:"device-meta-list"},pe={class:"device-actions"},ve={key:0,class:"request-empty"},fe={key:1,class:"request-list"},ge={class:"request-name"},me={class:"request-meta"},ye={class:"request-status-row"},he={class:"request-actions"},ke={class:"pairing-code-dialog"},be={class:"pairing-code-title"},we={class:"pairing-code-actions"},Pe=Xe({__name:"DevicesView",setup(c){const{t:i}=Ze(),v=Je(),L=m(!1),S=m(!1),z=m(!1),R=m(""),f=m(""),B=m(!1),O=m(!1),$=m(!1),b=m(""),q=m(null),p=m({scanning:!1,last_scanned_at:null,devices:[],requests:[]}),V=A(()=>[...p.value.devices].sort((e,l)=>{const n=+!!l.online-+!!e.online;if(n!==0)return n;const h=I(e.endpoint_kind)-I(l.endpoint_kind);return h!==0?h:e.id.localeCompare(l.id)})),w=A(()=>!!(q.value&&f.value===q.value.id));function I(e){return e==="web"?0:e==="desktop"?1:2}function qe(e){return i(`devices.endpoint.${e}`)}function Te(e){return e==="desktop"?"success":e==="web"?"info":"default"}function N(e){return i(`devices.inboundStatus.${e}`)}function Le(e){return i(`devices.outboundStatus.${e}`)}function Se(e){return e.outbound_status==="approved"?i("devices.paired"):Le(e.outbound_status)}function ze(e){return e.outbound_status==="approved"?"success":e.outbound_status==="pending"?"info":e.outbound_status==="blocked"?"error":e.outbound_status==="rejected"?"warning":"default"}function Re(e){return e.online?i("devices.online"):i("devices.offline")}function $e(e){return e.online?"success":"default"}function Ue(e){return!!e.online&&(e.outbound_status==="none"||e.outbound_status==="rejected")}function Be(e){return e.inbound_status!=="blocked"}function Oe(){return p.value.requests.length>0?i("devices.requestsWithCount",{count:p.value.requests.length}):i("devices.requests")}function M(e){return e.inbound_status!=="pending"}function Ve(e){return M(e)?i("devices.processed"):i("devices.unprocessed")}function Ie(e){return M(e)?"success":"warning"}function Ne(e){return[e.os.type||e.os.platform,e.os.release,e.os.arch].filter(Boolean).join(" ")}function Me(e){if(!e)return i("devices.never");const l=new Date(e);return Number.isNaN(l.getTime())?String(e):l.toLocaleString()}function j(e){return e||i("devices.unknown")}function D(e){try{const l=new URL(e);return l.protocol==="http:"||l.protocol==="https:"?l.toString():""}catch{return""}}async function je(){L.value=!0;try{p.value=await ln()}catch(e){v.error(e?.message||i("devices.loadFailed"))}finally{L.value=!1}}async function F(){S.value=!0;try{p.value=await on()}catch(e){v.error(e?.message||i("devices.scanFailed"))}finally{S.value=!1}}async function De(){O.value=!0;try{await sn((await rn()).link)?v.success(i("devices.pairingLinkCopied")):v.error(i("devices.pairingLinkCopyFailed"))}catch(e){v.error(e?.message||i("devices.pairingLinkCopyFailed"))}finally{O.value=!1}}function Fe(e){q.value=e,b.value="",$.value=!0}function x(){$.value=!1,b.value="",q.value=null}function H(){w.value||x()}async function E(){const e=q.value;if(!e||w.value)return;const l=b.value.trim();if(!l){v.warning(i("devices.pairingCodeRequired"));return}f.value=e.id;try{p.value=await un(e.id,l),x()}catch(n){if(String(n?.message||"").includes("Duplicate pairing request")){v.warning(i("devices.duplicateRequest"));return}v.error(n?.message||i("devices.updateFailed"))}finally{f.value=""}}async function C(e,l){f.value=e.id;try{p.value=l==="approve"?await cn(e.id):l==="reject"?await _n(e.id):l==="block"?await pn(e.id):l==="deleteHistory"?await fn(e.id):await vn(e.id)}catch(n){v.error(n?.message||i("devices.updateFailed"))}finally{f.value=""}}async function K(){const e=R.value.trim();if(!e){v.warning(i("devices.manualUrlRequired"));return}z.value=!0;try{p.value=await dn(e),R.value="",v.success(i("devices.manualRequestSent"))}catch(l){v.error(l?.message||i("devices.manualRequestFailed"))}finally{z.value=!1}}return Ae(()=>{je()}),(e,l)=>(d(),g("div",Q,[s("header",Y,[s("h2",Z,a(t(i)("devices.title")),1),s("div",ee,[u(t(W),{value:R.value,"onUpdate:value":l[0]||(l[0]=n=>R.value=n),class:"manual-pairing-input",size:"small",clearable:"",placeholder:t(i)("devices.manualUrlPlaceholder"),disabled:z.value,onKeyup:J(K,["enter"])},null,8,["value","placeholder","disabled"]),u(t(_),{size:"small",loading:z.value,onClick:K},{default:r(()=>[o(a(t(i)("devices.manualPairing")),1)]),_:1},8,["loading"]),u(t(_),{size:"small",loading:O.value,onClick:De},{default:r(()=>[o(a(t(i)("devices.copyPairingLink")),1)]),_:1},8,["loading"]),s("div",ne,[s("span",null,a(t(i)("devices.count",{count:V.value.length})),1),s("span",null,a(t(i)("devices.lastScanned",{time:Me(p.value.last_scanned_at)})),1)]),u(t(_),{size:"small",onClick:l[1]||(l[1]=n=>B.value=!0)},{default:r(()=>[o(a(Oe()),1)]),_:1}),u(t(_),{size:"small",type:"primary",loading:S.value||p.value.scanning,onClick:F},{default:r(()=>[o(a(t(i)("devices.refresh")),1)]),_:1},8,["loading"])])]),u(t(We),{show:L.value,class:"devices-spin"},{default:r(()=>[s("div",te,[V.value.length===0&&!L.value?(d(),g("div",ie,[s("div",ae,a(t(i)("devices.empty")),1),u(t(_),{size:"small",loading:S.value||p.value.scanning,onClick:F},{default:r(()=>[o(a(t(i)("devices.refresh")),1)]),_:1},8,["loading"])])):(d(),g("div",se,[(d(!0),g(G,null,X(V.value,n=>(d(),g("article",{key:n.id,class:"device-card"},[s("div",le,[s("div",re,[s("div",oe,a(n.computer_name||n.ip),1),D(n.url)?(d(),g("a",{key:0,class:"device-link",href:D(n.url),target:"_blank",rel:"noopener noreferrer"},a(n.ip)+":"+a(n.http_port),9,ue)):(d(),g("span",de,a(n.ip)+":"+a(n.http_port),1))]),u(t(P),{size:"small",type:Te(n.endpoint_kind),round:""},{default:r(()=>[o(a(qe(n.endpoint_kind)),1)]),_:2},1032,["type"])]),s("div",ce,[u(t(P),{size:"small",type:$e(n),round:""},{default:r(()=>[o(a(Re(n)),1)]),_:2},1032,["type"]),u(t(P),{size:"small",type:ze(n),round:""},{default:r(()=>[o(a(Se(n)),1)]),_:2},1032,["type"]),n.inbound_status==="blocked"?(d(),k(t(P),{key:0,size:"small",type:"error",round:""},{default:r(()=>[o(a(N(n.inbound_status)),1)]),_:2},1024)):T("",!0)]),s("dl",_e,[s("div",null,[s("dt",null,a(t(i)("devices.os")),1),s("dd",null,a(Ne(n)||t(i)("devices.unknown")),1)]),s("div",null,[s("dt",null,a(t(i)("devices.agentVersion")),1),s("dd",null,a(j(n.hermes_agent_version)),1)]),s("div",null,[s("dt",null,a(t(i)("devices.webUiVersion")),1),s("dd",null,a(j(n.hermes_web_ui_version)),1)]),s("div",null,[s("dt",null,a(t(i)("devices.responseMs")),1),s("dd",null,a(n.response_ms)+"ms",1)])]),s("div",pe,[Ue(n)?(d(),k(t(_),{key:0,size:"tiny",type:"primary",loading:f.value===n.id,onClick:h=>Fe(n)},{default:r(()=>[o(a(t(i)("devices.requestPairing")),1)]),_:1},8,["loading","onClick"])):T("",!0),Be(n)?(d(),k(t(_),{key:1,size:"tiny",quaternary:"",type:"error",loading:f.value===n.id,onClick:h=>C(n,"block")},{default:r(()=>[o(a(t(i)("devices.block")),1)]),_:1},8,["loading","onClick"])):(d(),k(t(_),{key:2,size:"tiny",quaternary:"",loading:f.value===n.id,onClick:h=>C(n,"unblock")},{default:r(()=>[o(a(t(i)("devices.unblock")),1)]),_:1},8,["loading","onClick"]))])]))),128))]))])]),_:1},8,["show"]),u(t(xe),{show:B.value,"onUpdate:show":l[2]||(l[2]=n=>B.value=n),width:"min(420px, 100vw)",placement:"right"},{default:r(()=>[u(t(Ke),{title:t(i)("devices.requests"),closable:""},{default:r(()=>[p.value.requests.length===0?(d(),g("div",ve,a(t(i)("devices.noRequests")),1)):(d(),g("div",fe,[(d(!0),g(G,null,X(p.value.requests,n=>(d(),g("article",{key:n.id,class:"request-item"},[s("div",null,[s("div",ge,a(n.computer_name||n.ip),1),s("div",me,a(n.ip)+":"+a(n.http_port),1),s("div",ye,[u(t(P),{size:"small",type:Ie(n),round:""},{default:r(()=>[o(a(Ve(n)),1)]),_:2},1032,["type"]),u(t(P),{size:"small",type:n.inbound_status==="blocked"?"error":n.inbound_status==="rejected"?"warning":n.inbound_status==="approved"?"success":"info",round:""},{default:r(()=>[o(a(N(n.inbound_status)),1)]),_:2},1032,["type"])])]),s("div",he,[n.inbound_status==="pending"?(d(),k(t(_),{key:0,size:"tiny",type:"success",loading:f.value===n.id,onClick:h=>C(n,"approve")},{default:r(()=>[o(a(t(i)("devices.approve")),1)]),_:1},8,["loading","onClick"])):T("",!0),n.inbound_status==="pending"?(d(),k(t(_),{key:1,size:"tiny",quaternary:"",type:"warning",loading:f.value===n.id,onClick:h=>C(n,"reject")},{default:r(()=>[o(a(t(i)("devices.reject")),1)]),_:1},8,["loading","onClick"])):T("",!0),n.inbound_status==="pending"?(d(),k(t(_),{key:2,size:"tiny",quaternary:"",type:"error",loading:f.value===n.id,onClick:h=>C(n,"block")},{default:r(()=>[o(a(t(i)("devices.block")),1)]),_:1},8,["loading","onClick"])):T("",!0),u(t(Qe),{onPositiveClick:h=>C(n,"deleteHistory")},{trigger:r(()=>[u(t(_),{size:"tiny",quaternary:"",type:"error",loading:f.value===n.id},{default:r(()=>[o(a(t(i)("devices.deleteHistory")),1)]),_:1},8,["loading"])]),default:r(()=>[o(" "+a(t(i)("devices.deleteHistoryConfirm")),1)]),_:2},1032,["onPositiveClick"])])]))),128))]))]),_:1},8,["title"])]),_:1},8,["show"]),u(t(He),{show:$.value,"onUpdate:show":l[4]||(l[4]=n=>$.value=n),"mask-closable":!w.value,onEsc:H},{default:r(()=>[s("div",ke,[s("div",be,a(t(i)("devices.pairingCodeTitle")),1),u(t(W),{value:b.value,"onUpdate:value":l[3]||(l[3]=n=>b.value=n),clearable:"",placeholder:t(i)("devices.pairingCodePlaceholder"),disabled:w.value,onKeyup:J(E,["enter"])},null,8,["value","placeholder","disabled"]),s("div",we,[u(t(_),{disabled:w.value,onClick:H},{default:r(()=>[o(a(t(i)("common.cancel")),1)]),_:1},8,["disabled"]),u(t(_),{type:"primary",loading:w.value,disabled:!b.value.trim(),onClick:E},{default:r(()=>[o(a(t(i)("devices.submitPairingRequest")),1)]),_:1},8,["loading","disabled"])])])]),_:1},8,["show","mask-closable"])]))}})})),mn=U((()=>{})),yn,hn=U((()=>{Ce(),Ce(),mn(),en(),yn=nn(Pe,[["__scopeId","data-v-7f90b0ec"]])}));hn();export{yn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as d,r as w}from"./rolldown-runtime-M0oDzQ_3.js";import{Dn as D,Hn as o,Kt as M,M as L,Ot as p,V as N,Y as V,an as r,cn as z,cr as a,er as f,fn as v,hn as K,jn as T,kn as U,pn as l,pr as _,t as W}from"./ui-vendor-DDMfmCj2.js";import{O as j,k as A}from"./vue-vendor-BsMpqyaC.js";import{n as I,t as O}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as d,r as w}from"./rolldown-runtime-M0oDzQ_3.js";import{Dn as D,Hn as o,Kt as M,M as L,Ot as p,V as N,Y as V,an as r,cn as z,cr as a,er as f,fn as v,hn as K,jn as T,kn as U,pn as l,pr as _,t as W}from"./ui-vendor-DDMfmCj2.js";import{O as j,k as A}from"./vue-vendor-BsMpqyaC.js";import{n as I,t as O}from"./_plugin-vue_export-helper-CvnFozKy.js";import{i as q,n as H,r as J,t as P}from"./monaco-editor-YM0cdSGX.js";import{i as R,t as Y}from"./files-CBYc0MSs.js";var g,h,y,F,C=d((()=>{M(),W(),j(),Y(),P(),g={class:"file-editor"},h={class:"editor-header"},y={class:"editor-filename"},F=K({__name:"FileEditor",props:{customClose:{type:Function}},setup(E){self.MonacoEnvironment={getWorker(S,B){return new Worker(new URL("/assets/editor.worker-D9luhcDD.js",""+import.meta.url),{type:"module"})}};const{t}=A(),u=N(),x=V(),e=R(),c=E,s=f(null);let i=null;const n=f(!1);U(()=>{!s.value||!e.editingFile||(i=q.create(s.value,{value:e.editingFile.content,language:e.editingFile.language,theme:document.documentElement.classList.contains("dark")?"vs-dark":"vs",minimap:{enabled:!1},fontSize:13,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}),i.onDidChangeModelContent(()=>{e.editingFile&&(e.editingFile.content=i.getValue())}),i.addCommand(J.CtrlCmd|H.KeyS,()=>{m()}))}),D(()=>{i?.dispose(),i=null});async function m(){n.value=!0;try{await e.saveEditor(),u.success(t("files.saved"))}catch{u.error(t("files.saveFailed"))}finally{n.value=!1}}function b(){if(c.customClose){c.customClose();return}e.hasUnsavedChanges?x.warning({title:t("files.unsavedChanges"),positiveText:t("common.ok"),negativeText:t("common.cancel"),onPositiveClick:()=>{e.closeEditor()}}):e.closeEditor()}return(S,B)=>(T(),z("div",g,[r("div",h,[r("span",y,_(a(e).editingFile?.path),1),l(a(L),null,{default:o(()=>[l(a(p),{size:"small",type:"primary",loading:n.value,onClick:m},{default:o(()=>[v(_(a(t)("files.saveFile")),1)]),_:1},8,["loading"]),l(a(p),{size:"small",onClick:b},{default:o(()=>[v(_(a(t)("files.closeEditor")),1)]),_:1})]),_:1})]),r("div",{ref_key:"editorContainer",ref:s,class:"editor-container"},null,512)]))}})})),$=d((()=>{})),de=w({default:()=>k}),k,ue=d((()=>{C(),C(),$(),I(),k=O(F,[["__scopeId","data-v-24aa69c1"]])}));export{de as n,ue as r,k as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as m}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as Ke,At as Y,Bn as Me,Hn as c,It as Oe,K as Te,Kt as S,M as X,Mt as qe,Nn as Be,Ot as T,V as N,Wt as Ve,Y as Xe,an as h,c as Ye,cn as b,cr as e,en as K,er as B,fn as k,g as Ge,hn as P,i as Je,in as H,it as Ae,jn as v,nt as We,on as D,pn as w,pr as f,sn as $,t as z,tn as $e,vn as O,wn as Ze}from"./ui-vendor-DDMfmCj2.js";import{O as E,k as L}from"./vue-vendor-BsMpqyaC.js";import{n as R,t as j}from"./_plugin-vue_export-helper-fFMkIM4P.js";import{J as De,Z as Se}from"./index-Brl4qW5V.js";import{a as Qe,i as I,n as q,o as Pe,r as V,s as et,t as U}from"./files-DOpu4Qfg.js";import{n as tt,t as at}from"./clipboard-1NPxC3YL.js";import{a as it,c as lt,n as st,s as nt,t as rt}from"./MarkdownRenderer-BbGvq6C-.js";var G,ze,J=m((()=>{S(),z(),E(),U(),Pe(),G={class:"file-tree"},ze=P({__name:"FileTree",props:{profile:{}},setup(C){const{t:F}=L(),i=I(),a=C,l=H(()=>a.profile===void 0?i.currentProfile:a.profile),n=B([]),_=B([]);async function r(p){try{return(await et(p,l.value)).entries.filter(t=>t.isDir).sort((t,o)=>t.name.localeCompare(o.name)).map(t=>({key:t.path,label:t.name,isLeaf:!1}))}catch{return[]}}async function s(p){p.children=await r(p.key)}function g(p){p.length>0&&(_.value=p,i.navigateTo(p[0],{profile:l.value}))}function x(){_.value=[],i.navigateTo("",{profile:l.value})}function M({option:p}){const t=String(p.label||"");return O("span",{class:"tree-node-label",title:t},t)}return Me(l,async()=>{_.value=[],n.value=await r("")},{immediate:!0}),(p,t)=>(v(),b("div",G,[h("div",{class:"tree-header",onClick:x},[t[0]||(t[0]=h("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[h("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),h("polyline",{points:"9 22 9 12 15 12 15 22"})],-1)),h("span",null,f(e(F)("files.breadcrumbRoot")),1)]),w(e(Ye),{data:n.value,"selected-keys":_.value,"on-load":s,"render-label":M,"expand-on-click":"","block-line":"","onUpdate:selectedKeys":g},null,8,["data","selected-keys"])]))}})})),ot=m((()=>{})),ut,At=m((()=>{J(),J(),ot(),R(),ut=j(ze,[["__scopeId","data-v-70587383"]])})),A,Ee,W=m((()=>{S(),E(),z(),U(),A={class:"file-breadcrumb"},Ee=P({__name:"FileBreadcrumb",setup(C){const{t:F}=L(),i=I();function a(l){if(l<0)i.navigateTo("");else{const n=i.pathSegments.slice(0,l+1).join("/");i.navigateTo(n)}}return(l,n)=>(v(),b("div",A,[w(e(qe),null,{default:c(()=>[w(e(Y),{onClick:n[0]||(n[0]=_=>a(-1))},{default:c(()=>[k(f(e(F)("files.breadcrumbRoot")),1)]),_:1}),(v(!0),b($e,null,Be(e(i).pathSegments,(_,r)=>(v(),D(e(Y),{key:r,onClick:s=>a(r)},{default:c(()=>[k(f(_),1)]),_:2},1032,["onClick"]))),128))]),_:1})]))}})})),dt=m((()=>{})),_t,Wt=m((()=>{W(),W(),dt(),R(),_t=j(Ee,[["__scopeId","data-v-061302de"]])})),Z,Le,Q=m((()=>{S(),z(),E(),U(),Z={class:"file-toolbar"},Le=P({__name:"FileToolbar",emits:["showNewFile","showNewFolder","showUpload"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=F;async function _(){try{await l.fetchEntries()}catch{a.error(i("files.backendError"))}}return(r,s)=>(v(),b("div",Z,[w(e(X),{size:8,wrap:!0,class:"toolbar-space"},{default:c(()=>[w(e(T),{size:"small",onClick:s[0]||(s[0]=g=>n("showNewFile")),class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.newFile")),1)]),_:1}),w(e(T),{size:"small",onClick:s[1]||(s[1]=g=>n("showNewFolder")),class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.newFolder")),1)]),_:1}),w(e(T),{size:"small",onClick:s[2]||(s[2]=g=>n("showUpload")),class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.upload")),1)]),_:1}),w(e(T),{size:"small",onClick:_,class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.refresh")),1)]),_:1})]),_:1})]))}})})),ct=m((()=>{})),pt,Zt=m((()=>{Q(),Q(),ct(),R(),pt=j(Le,[["__scopeId","data-v-64269d74"]])})),ee,te,ae,ie,le,se,ne,re,oe,ue,de,_e,ce,Ie,pe=m((()=>{S(),z(),E(),U(),Se(),ee={class:"file-list"},te={key:1,class:"file-list-items"},ae={class:"file-list-header file-list-grid"},ie={key:0,class:"sort-indicator"},le={key:0,class:"sort-indicator"},se={key:0,class:"sort-indicator"},ne=["onDblclick","onContextmenu"],re={class:"file-name"},oe={class:"file-icon"},ue=["title"],de={class:"file-size"},_e={class:"file-date"},ce={class:"file-actions"},Ie=P({__name:"FileList",emits:["contextmenu-entry"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=F;function _(t){if(t===0)return"—";const o=["B","KB","MB","GB"];let d=0,y=t;for(;y>=1024&&d<o.length-1;)y/=1024,d++;return`${y.toFixed(d===0?0:1)} ${o[d]}`}function r(t){return t?new Date(t).toLocaleString():"—"}function s(t){return t.isDir?"📁":{yaml:"⚙️",yml:"⚙️",json:"📋",toml:"⚙️",md:"📝",txt:"📄",log:"📄",py:"🐍",js:"📜",ts:"📜",vue:"💚",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",svg:"🖼️",webp:"🖼️",zip:"📦",gz:"📦",tar:"📦",sh:"⚡",bash:"⚡"}[t.name.split(".").pop()?.toLowerCase()||""]||"📄"}async function g(t){try{await l.openPreview(t)}catch{a.error(i("files.backendError"))}}async function x(t){t.isDir?l.navigateTo(t.path):V(t.name)?await l.openEditor(t.path):q(t.name)&&await g(t)}function M(t,o){t.preventDefault(),n("contextmenu-entry",t,o)}async function p(t){try{await De(t.path,t.name,l.currentProfile)}catch(o){a.error(o.message||i("files.backendError"))}}return(t,o)=>(v(),b("div",ee,[w(e(Ge),{show:e(l).loading},{default:c(()=>[!e(l).loading&&e(l).sortedEntries.length===0?(v(),D(e(Ve),{key:0,description:e(i)("files.emptyDir")},null,8,["description"])):(v(),b("div",te,[h("div",ae,[h("div",{class:"file-name sort-header",onClick:o[0]||(o[0]=d=>e(l).setSort("name"))},[k(f(e(i)("files.name"))+" ",1),e(l).sortBy==="name"?(v(),b("span",ie,f(e(l).sortOrder==="asc"?"↑":"↓"),1)):$("",!0)]),h("div",{class:"file-size sort-header",onClick:o[1]||(o[1]=d=>e(l).setSort("size"))},[k(f(e(i)("files.size"))+" ",1),e(l).sortBy==="size"?(v(),b("span",le,f(e(l).sortOrder==="asc"?"↑":"↓"),1)):$("",!0)]),h("div",{class:"file-date sort-header",onClick:o[2]||(o[2]=d=>e(l).setSort("modTime"))},[k(f(e(i)("files.modified"))+" ",1),e(l).sortBy==="modTime"?(v(),b("span",se,f(e(l).sortOrder==="asc"?"↑":"↓"),1)):$("",!0)]),o[3]||(o[3]=h("div",{class:"file-actions-placeholder"},null,-1))]),(v(!0),b($e,null,Be(e(l).sortedEntries,d=>(v(),b("div",{key:d.path,class:"file-list-row file-list-grid",onDblclick:y=>x(d),onContextmenu:y=>M(y,d)},[h("div",re,[h("span",oe,f(s(d)),1),h("span",{class:"file-label",title:d.name},f(d.name),9,ue)]),h("div",de,f(d.isDir?"—":_(d.size)),1),h("div",_e,f(r(d.modTime)),1),h("div",ce,[e(q)(d.name)&&!d.isDir?(v(),D(e(T),{key:0,size:"tiny",quaternary:"",onClick:K(y=>g(d),["stop"]),title:e(i)("files.preview")},{default:c(()=>[...o[4]||(o[4]=[k("👁️",-1)])]),_:1},8,["onClick","title"])):$("",!0),e(V)(d.name)&&!d.isDir?(v(),D(e(T),{key:1,size:"tiny",quaternary:"",onClick:K(y=>e(l).openEditor(d.path),["stop"]),title:e(i)("files.edit")},{default:c(()=>[...o[5]||(o[5]=[k("✏️",-1)])]),_:1},8,["onClick","title"])):$("",!0),d.isDir?$("",!0):(v(),D(e(T),{key:2,size:"tiny",quaternary:"",onClick:K(y=>p(d),["stop"]),title:e(i)("files.download")},{default:c(()=>[...o[6]||(o[6]=[k("⬇️",-1)])]),_:1},8,["onClick","title"]))])],40,ne))),128))]))]),_:1},8,["show"])]))}})})),ft=m((()=>{})),vt,Qt=m((()=>{pe(),pe(),ft(),R(),vt=j(Ie,[["__scopeId","data-v-352e394e"]])}));function mt(C){return C.absolutePath||C.path}var ht=m((()=>{})),Ue,fe=m((()=>{S(),z(),E(),U(),Se(),tt(),ht(),Ue=P({__name:"FileContextMenu",emits:["rename","newFolder"],setup(C,{expose:F,emit:i}){const{t:a}=L(),l=N(),n=Xe(),_=I(),r=B(!1),s=B(0),g=B(0),x=B(null),M=i;function p(y,u){x.value=u,s.value=y.clientX,g.value=y.clientY,r.value=!1,Ze(()=>{r.value=!0})}function t(){const y=x.value;if(!y)return[];const u=[];return y.isDir?u.push({label:a("files.open"),key:"open"}):(V(y.name)&&u.push({label:a("files.edit"),key:"edit"}),q(y.name)&&u.push({label:a("files.preview"),key:"preview"}),u.push({label:a("files.download"),key:"download"})),u.push({type:"divider",key:"d1"}),u.push({label:a("files.copyPath"),key:"copyPath"}),u.push({label:a("files.newFolder"),key:"newFolder"}),u.push({label:a("files.rename"),key:"rename"}),u.push({type:"divider",key:"d2"}),u.push({label:a("files.delete"),key:"delete"}),u}async function o(y){r.value=!1;const u=x.value;if(u)switch(y){case"open":_.navigateTo(u.path);break;case"edit":try{await _.openEditor(u.path)}catch{l.error(a("files.backendError"))}break;case"preview":try{await _.openPreview(u)}catch{l.error(a("files.backendError"))}break;case"download":try{await De(u.path,u.name,_.currentProfile)}catch(He){l.error(He.message)}break;case"copyPath":await at(mt(u))?l.success(a("files.pathCopied")):l.error(a("files.pathCopied")+" ✗");break;case"rename":M("rename",u);break;case"newFolder":M("newFolder",u);break;case"delete":n.warning({title:a("files.delete"),content:u.isDir?a("files.confirmDeleteDir",{name:u.name}):a("files.confirmDelete",{name:u.name}),positiveText:a("common.delete"),negativeText:a("common.cancel"),onPositiveClick:async()=>{try{await _.deleteEntry(u),l.success(a("files.deleted"))}catch{l.error(a("files.deleteFailed"))}}});break}}function d(){r.value=!1}return F({show:p}),(y,u)=>(v(),D(e(We),{show:r.value,x:s.value,y:g.value,options:t(),placement:"bottom-start",trigger:"manual",onSelect:o,onClickoutside:d},null,8,["show","x","y","options"]))}})})),wt,ea=m((()=>{fe(),fe(),wt=Ue})),ve,me,he,we,ge,ye,Fe,Ne,ke=m((()=>{S(),z(),E(),U(),Pe(),st(),nt(),ve={key:0,class:"file-preview"},me={class:"preview-header"},he={class:"preview-filename"},we={class:"preview-content"},ge=["src","alt"],ye={key:1,class:"preview-markdown"},Fe=["innerHTML"],Ne=P({__name:"FilePreview",setup(C){const{t:F}=L(),i=N(),a=I();function l(){return a.previewFile?Qe(a.previewFile.path,void 0,a.previewFile.profile):""}const n=H(()=>{const s=a.previewFile;return!s||s.type!=="text"?"":lt(s.content||"",s.language,F("common.copy"),{maxHighlightLength:2e5})});async function _(s){const g=await it(s);g?i.success(F("common.copied")):g===!1&&i.error(F("chat.copyFailed"))}const r=()=>O("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},[O("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})]);return(s,g)=>e(a).previewFile?(v(),b("div",ve,[h("div",me,[h("span",he,f(e(a).previewFile.path),1),w(e(T),{size:"small",quaternary:"",onClick:g[0]||(g[0]=x=>e(a).closePreview())},{icon:c(()=>[w(e(Ae),null,{default:c(()=>[w(r)]),_:1})]),default:c(()=>[k(" "+f(e(F)("files.closePreview")),1)]),_:1})]),h("div",we,[e(a).previewFile.type==="image"?(v(),b("img",{key:0,src:l(),class:"preview-image",alt:e(a).previewFile.path},null,8,ge)):e(a).previewFile.type==="markdown"?(v(),b("div",ye,[w(rt,{content:e(a).previewFile.content||""},null,8,["content"])])):e(a).previewFile.type==="text"?(v(),b("div",{key:2,class:"preview-code",innerHTML:n.value,onClick:_},null,8,Fe)):$("",!0)])])):$("",!0)}})})),gt=m((()=>{})),yt,ta=m((()=>{ke(),ke(),gt(),R(),yt=j(Ne,[["__scopeId","data-v-d91658dd"]])})),be,Re,Ce=m((()=>{S(),z(),E(),U(),be={class:"upload-dragger"},Re=P({__name:"FileUploadModal",props:{show:{type:Boolean}},emits:["update:show"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=C,_=F,r=B(!1),s=B([]);function g(p){s.value=p.fileList.map(t=>t.file).filter(t=>t!=null)}async function x(){if(s.value.length!==0){r.value=!0;try{await l.uploadFiles(s.value),a.success(i("files.uploadSuccess",{count:s.value.length})),s.value=[],_("update:show",!1)}catch(p){a.error(p.message||i("files.uploadFailed"))}finally{r.value=!1}}}function M(){s.value=[],_("update:show",!1)}return(p,t)=>(v(),D(e(Te),{show:n.show,preset:"dialog",title:e(i)("files.upload"),"onUpdate:show":M,style:{width:"500px"}},{action:c(()=>[w(e(X),null,{default:c(()=>[w(e(T),{onClick:M},{default:c(()=>[k(f(e(i)("common.cancel")),1)]),_:1}),w(e(T),{type:"primary",loading:r.value,disabled:s.value.length===0,onClick:x},{default:c(()=>[k(f(e(i)("files.upload"))+" ("+f(s.value.length)+") ",1)]),_:1},8,["loading","disabled"])]),_:1})]),default:c(()=>[w(e(Je),{multiple:"","directory-dnd":"","default-upload":!1,onChange:g},{default:c(()=>[h("div",be,[h("p",null,f(e(i)("files.dragDropHint")),1)])]),_:1})]),_:1},8,["show","title"]))}})})),Ft=m((()=>{})),kt,aa=m((()=>{Ce(),Ce(),Ft(),R(),kt=j(Re,[["__scopeId","data-v-e54e68b1"]])})),je,xe=m((()=>{S(),z(),E(),U(),je=P({__name:"FileRenameModal",props:{show:{type:Boolean},mode:{},entry:{},targetPath:{}},emits:["update:show"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=C,_=F,r=B(""),s=B(!1);Me(()=>n.show,p=>{p&&(n.mode==="rename"&&n.entry?r.value=n.entry.name:r.value="")});const g=H(()=>{switch(n.mode){case"newFile":return i("files.newFile");case"newFolder":return i("files.newFolder");case"rename":return i("files.rename")}}),x=H(()=>{switch(n.mode){case"newFile":return i("files.newFileName");case"newFolder":return i("files.newFolderName");case"rename":return i("files.renameTo")}});async function M(){if(r.value.trim()){s.value=!0;try{switch(n.mode){case"newFile":await l.createFile(r.value.trim()),a.success(i("files.created"));break;case"newFolder":await l.createDir(r.value.trim(),n.targetPath||void 0),a.success(i("files.created"));break;case"rename":n.entry&&(await l.renameEntry(n.entry,r.value.trim()),a.success(i("files.renamed")));break}_("update:show",!1)}catch(p){const t=n.mode==="rename"?i("files.renameFailed"):i("files.createFailed");a.error(p.message||t)}finally{s.value=!1}}}return(p,t)=>(v(),D(e(Te),{show:n.show,preset:"dialog",title:g.value,"onUpdate:show":t[2]||(t[2]=o=>_("update:show",!1)),style:{width:"400px"}},{action:c(()=>[w(e(X),null,{default:c(()=>[w(e(T),{onClick:t[1]||(t[1]=o=>_("update:show",!1))},{default:c(()=>[k(f(e(i)("common.cancel")),1)]),_:1}),w(e(T),{type:"primary",loading:s.value,disabled:!r.value.trim(),onClick:M},{default:c(()=>[k(f(e(i)("common.ok")),1)]),_:1},8,["loading","disabled"])]),_:1})]),default:c(()=>[w(e(Oe),{value:r.value,"onUpdate:value":t[0]||(t[0]=o=>r.value=o),placeholder:x.value,onKeydown:Ke(M,["enter"]),autofocus:""},null,8,["value","placeholder"])]),_:1},8,["show","title"]))}})})),bt,ia=m((()=>{xe(),xe(),bt=je}));export{yt as a,ea as c,pt as d,Zt as f,At as g,ut as h,aa as i,vt as l,Wt as m,ia as n,ta as o,_t as p,kt as r,wt as s,bt as t,Qt as u};
|
|
1
|
+
import{n as m}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as Ke,At as Y,Bn as Me,Hn as c,It as Oe,K as Te,Kt as S,M as X,Mt as qe,Nn as Be,Ot as T,V as N,Wt as Ve,Y as Xe,an as h,c as Ye,cn as b,cr as e,en as K,er as B,fn as k,g as Ge,hn as P,i as Je,in as H,it as Ae,jn as v,nt as We,on as D,pn as w,pr as f,sn as $,t as z,tn as $e,vn as O,wn as Ze}from"./ui-vendor-DDMfmCj2.js";import{O as E,k as L}from"./vue-vendor-BsMpqyaC.js";import{n as R,t as j}from"./_plugin-vue_export-helper-CvnFozKy.js";import{J as De,Z as Se}from"./index-B2IKGvbR.js";import{a as Qe,i as I,n as q,o as Pe,r as V,s as et,t as U}from"./files-CBYc0MSs.js";import{n as tt,t as at}from"./clipboard-1NPxC3YL.js";import{a as it,c as lt,n as st,s as nt,t as rt}from"./MarkdownRenderer-DQvs79tf.js";var G,ze,J=m((()=>{S(),z(),E(),U(),Pe(),G={class:"file-tree"},ze=P({__name:"FileTree",props:{profile:{}},setup(C){const{t:F}=L(),i=I(),a=C,l=H(()=>a.profile===void 0?i.currentProfile:a.profile),n=B([]),_=B([]);async function r(p){try{return(await et(p,l.value)).entries.filter(t=>t.isDir).sort((t,o)=>t.name.localeCompare(o.name)).map(t=>({key:t.path,label:t.name,isLeaf:!1}))}catch{return[]}}async function s(p){p.children=await r(p.key)}function g(p){p.length>0&&(_.value=p,i.navigateTo(p[0],{profile:l.value}))}function x(){_.value=[],i.navigateTo("",{profile:l.value})}function M({option:p}){const t=String(p.label||"");return O("span",{class:"tree-node-label",title:t},t)}return Me(l,async()=>{_.value=[],n.value=await r("")},{immediate:!0}),(p,t)=>(v(),b("div",G,[h("div",{class:"tree-header",onClick:x},[t[0]||(t[0]=h("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[h("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),h("polyline",{points:"9 22 9 12 15 12 15 22"})],-1)),h("span",null,f(e(F)("files.breadcrumbRoot")),1)]),w(e(Ye),{data:n.value,"selected-keys":_.value,"on-load":s,"render-label":M,"expand-on-click":"","block-line":"","onUpdate:selectedKeys":g},null,8,["data","selected-keys"])]))}})})),ot=m((()=>{})),ut,At=m((()=>{J(),J(),ot(),R(),ut=j(ze,[["__scopeId","data-v-70587383"]])})),A,Ee,W=m((()=>{S(),E(),z(),U(),A={class:"file-breadcrumb"},Ee=P({__name:"FileBreadcrumb",setup(C){const{t:F}=L(),i=I();function a(l){if(l<0)i.navigateTo("");else{const n=i.pathSegments.slice(0,l+1).join("/");i.navigateTo(n)}}return(l,n)=>(v(),b("div",A,[w(e(qe),null,{default:c(()=>[w(e(Y),{onClick:n[0]||(n[0]=_=>a(-1))},{default:c(()=>[k(f(e(F)("files.breadcrumbRoot")),1)]),_:1}),(v(!0),b($e,null,Be(e(i).pathSegments,(_,r)=>(v(),D(e(Y),{key:r,onClick:s=>a(r)},{default:c(()=>[k(f(_),1)]),_:2},1032,["onClick"]))),128))]),_:1})]))}})})),dt=m((()=>{})),_t,Wt=m((()=>{W(),W(),dt(),R(),_t=j(Ee,[["__scopeId","data-v-061302de"]])})),Z,Le,Q=m((()=>{S(),z(),E(),U(),Z={class:"file-toolbar"},Le=P({__name:"FileToolbar",emits:["showNewFile","showNewFolder","showUpload"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=F;async function _(){try{await l.fetchEntries()}catch{a.error(i("files.backendError"))}}return(r,s)=>(v(),b("div",Z,[w(e(X),{size:8,wrap:!0,class:"toolbar-space"},{default:c(()=>[w(e(T),{size:"small",onClick:s[0]||(s[0]=g=>n("showNewFile")),class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.newFile")),1)]),_:1}),w(e(T),{size:"small",onClick:s[1]||(s[1]=g=>n("showNewFolder")),class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.newFolder")),1)]),_:1}),w(e(T),{size:"small",onClick:s[2]||(s[2]=g=>n("showUpload")),class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.upload")),1)]),_:1}),w(e(T),{size:"small",onClick:_,class:"toolbar-btn"},{default:c(()=>[k(f(e(i)("files.refresh")),1)]),_:1})]),_:1})]))}})})),ct=m((()=>{})),pt,Zt=m((()=>{Q(),Q(),ct(),R(),pt=j(Le,[["__scopeId","data-v-64269d74"]])})),ee,te,ae,ie,le,se,ne,re,oe,ue,de,_e,ce,Ie,pe=m((()=>{S(),z(),E(),U(),Se(),ee={class:"file-list"},te={key:1,class:"file-list-items"},ae={class:"file-list-header file-list-grid"},ie={key:0,class:"sort-indicator"},le={key:0,class:"sort-indicator"},se={key:0,class:"sort-indicator"},ne=["onDblclick","onContextmenu"],re={class:"file-name"},oe={class:"file-icon"},ue=["title"],de={class:"file-size"},_e={class:"file-date"},ce={class:"file-actions"},Ie=P({__name:"FileList",emits:["contextmenu-entry"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=F;function _(t){if(t===0)return"—";const o=["B","KB","MB","GB"];let d=0,y=t;for(;y>=1024&&d<o.length-1;)y/=1024,d++;return`${y.toFixed(d===0?0:1)} ${o[d]}`}function r(t){return t?new Date(t).toLocaleString():"—"}function s(t){return t.isDir?"📁":{yaml:"⚙️",yml:"⚙️",json:"📋",toml:"⚙️",md:"📝",txt:"📄",log:"📄",py:"🐍",js:"📜",ts:"📜",vue:"💚",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",svg:"🖼️",webp:"🖼️",zip:"📦",gz:"📦",tar:"📦",sh:"⚡",bash:"⚡"}[t.name.split(".").pop()?.toLowerCase()||""]||"📄"}async function g(t){try{await l.openPreview(t)}catch{a.error(i("files.backendError"))}}async function x(t){t.isDir?l.navigateTo(t.path):V(t.name)?await l.openEditor(t.path):q(t.name)&&await g(t)}function M(t,o){t.preventDefault(),n("contextmenu-entry",t,o)}async function p(t){try{await De(t.path,t.name,l.currentProfile)}catch(o){a.error(o.message||i("files.backendError"))}}return(t,o)=>(v(),b("div",ee,[w(e(Ge),{show:e(l).loading},{default:c(()=>[!e(l).loading&&e(l).sortedEntries.length===0?(v(),D(e(Ve),{key:0,description:e(i)("files.emptyDir")},null,8,["description"])):(v(),b("div",te,[h("div",ae,[h("div",{class:"file-name sort-header",onClick:o[0]||(o[0]=d=>e(l).setSort("name"))},[k(f(e(i)("files.name"))+" ",1),e(l).sortBy==="name"?(v(),b("span",ie,f(e(l).sortOrder==="asc"?"↑":"↓"),1)):$("",!0)]),h("div",{class:"file-size sort-header",onClick:o[1]||(o[1]=d=>e(l).setSort("size"))},[k(f(e(i)("files.size"))+" ",1),e(l).sortBy==="size"?(v(),b("span",le,f(e(l).sortOrder==="asc"?"↑":"↓"),1)):$("",!0)]),h("div",{class:"file-date sort-header",onClick:o[2]||(o[2]=d=>e(l).setSort("modTime"))},[k(f(e(i)("files.modified"))+" ",1),e(l).sortBy==="modTime"?(v(),b("span",se,f(e(l).sortOrder==="asc"?"↑":"↓"),1)):$("",!0)]),o[3]||(o[3]=h("div",{class:"file-actions-placeholder"},null,-1))]),(v(!0),b($e,null,Be(e(l).sortedEntries,d=>(v(),b("div",{key:d.path,class:"file-list-row file-list-grid",onDblclick:y=>x(d),onContextmenu:y=>M(y,d)},[h("div",re,[h("span",oe,f(s(d)),1),h("span",{class:"file-label",title:d.name},f(d.name),9,ue)]),h("div",de,f(d.isDir?"—":_(d.size)),1),h("div",_e,f(r(d.modTime)),1),h("div",ce,[e(q)(d.name)&&!d.isDir?(v(),D(e(T),{key:0,size:"tiny",quaternary:"",onClick:K(y=>g(d),["stop"]),title:e(i)("files.preview")},{default:c(()=>[...o[4]||(o[4]=[k("👁️",-1)])]),_:1},8,["onClick","title"])):$("",!0),e(V)(d.name)&&!d.isDir?(v(),D(e(T),{key:1,size:"tiny",quaternary:"",onClick:K(y=>e(l).openEditor(d.path),["stop"]),title:e(i)("files.edit")},{default:c(()=>[...o[5]||(o[5]=[k("✏️",-1)])]),_:1},8,["onClick","title"])):$("",!0),d.isDir?$("",!0):(v(),D(e(T),{key:2,size:"tiny",quaternary:"",onClick:K(y=>p(d),["stop"]),title:e(i)("files.download")},{default:c(()=>[...o[6]||(o[6]=[k("⬇️",-1)])]),_:1},8,["onClick","title"]))])],40,ne))),128))]))]),_:1},8,["show"])]))}})})),ft=m((()=>{})),vt,Qt=m((()=>{pe(),pe(),ft(),R(),vt=j(Ie,[["__scopeId","data-v-352e394e"]])}));function mt(C){return C.absolutePath||C.path}var ht=m((()=>{})),Ue,fe=m((()=>{S(),z(),E(),U(),Se(),tt(),ht(),Ue=P({__name:"FileContextMenu",emits:["rename","newFolder"],setup(C,{expose:F,emit:i}){const{t:a}=L(),l=N(),n=Xe(),_=I(),r=B(!1),s=B(0),g=B(0),x=B(null),M=i;function p(y,u){x.value=u,s.value=y.clientX,g.value=y.clientY,r.value=!1,Ze(()=>{r.value=!0})}function t(){const y=x.value;if(!y)return[];const u=[];return y.isDir?u.push({label:a("files.open"),key:"open"}):(V(y.name)&&u.push({label:a("files.edit"),key:"edit"}),q(y.name)&&u.push({label:a("files.preview"),key:"preview"}),u.push({label:a("files.download"),key:"download"})),u.push({type:"divider",key:"d1"}),u.push({label:a("files.copyPath"),key:"copyPath"}),u.push({label:a("files.newFolder"),key:"newFolder"}),u.push({label:a("files.rename"),key:"rename"}),u.push({type:"divider",key:"d2"}),u.push({label:a("files.delete"),key:"delete"}),u}async function o(y){r.value=!1;const u=x.value;if(u)switch(y){case"open":_.navigateTo(u.path);break;case"edit":try{await _.openEditor(u.path)}catch{l.error(a("files.backendError"))}break;case"preview":try{await _.openPreview(u)}catch{l.error(a("files.backendError"))}break;case"download":try{await De(u.path,u.name,_.currentProfile)}catch(He){l.error(He.message)}break;case"copyPath":await at(mt(u))?l.success(a("files.pathCopied")):l.error(a("files.pathCopied")+" ✗");break;case"rename":M("rename",u);break;case"newFolder":M("newFolder",u);break;case"delete":n.warning({title:a("files.delete"),content:u.isDir?a("files.confirmDeleteDir",{name:u.name}):a("files.confirmDelete",{name:u.name}),positiveText:a("common.delete"),negativeText:a("common.cancel"),onPositiveClick:async()=>{try{await _.deleteEntry(u),l.success(a("files.deleted"))}catch{l.error(a("files.deleteFailed"))}}});break}}function d(){r.value=!1}return F({show:p}),(y,u)=>(v(),D(e(We),{show:r.value,x:s.value,y:g.value,options:t(),placement:"bottom-start",trigger:"manual",onSelect:o,onClickoutside:d},null,8,["show","x","y","options"]))}})})),wt,ea=m((()=>{fe(),fe(),wt=Ue})),ve,me,he,we,ge,ye,Fe,Ne,ke=m((()=>{S(),z(),E(),U(),Pe(),st(),nt(),ve={key:0,class:"file-preview"},me={class:"preview-header"},he={class:"preview-filename"},we={class:"preview-content"},ge=["src","alt"],ye={key:1,class:"preview-markdown"},Fe=["innerHTML"],Ne=P({__name:"FilePreview",setup(C){const{t:F}=L(),i=N(),a=I();function l(){return a.previewFile?Qe(a.previewFile.path,void 0,a.previewFile.profile):""}const n=H(()=>{const s=a.previewFile;return!s||s.type!=="text"?"":lt(s.content||"",s.language,F("common.copy"),{maxHighlightLength:2e5})});async function _(s){const g=await it(s);g?i.success(F("common.copied")):g===!1&&i.error(F("chat.copyFailed"))}const r=()=>O("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},[O("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})]);return(s,g)=>e(a).previewFile?(v(),b("div",ve,[h("div",me,[h("span",he,f(e(a).previewFile.path),1),w(e(T),{size:"small",quaternary:"",onClick:g[0]||(g[0]=x=>e(a).closePreview())},{icon:c(()=>[w(e(Ae),null,{default:c(()=>[w(r)]),_:1})]),default:c(()=>[k(" "+f(e(F)("files.closePreview")),1)]),_:1})]),h("div",we,[e(a).previewFile.type==="image"?(v(),b("img",{key:0,src:l(),class:"preview-image",alt:e(a).previewFile.path},null,8,ge)):e(a).previewFile.type==="markdown"?(v(),b("div",ye,[w(rt,{content:e(a).previewFile.content||""},null,8,["content"])])):e(a).previewFile.type==="text"?(v(),b("div",{key:2,class:"preview-code",innerHTML:n.value,onClick:_},null,8,Fe)):$("",!0)])])):$("",!0)}})})),gt=m((()=>{})),yt,ta=m((()=>{ke(),ke(),gt(),R(),yt=j(Ne,[["__scopeId","data-v-d91658dd"]])})),be,Re,Ce=m((()=>{S(),z(),E(),U(),be={class:"upload-dragger"},Re=P({__name:"FileUploadModal",props:{show:{type:Boolean}},emits:["update:show"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=C,_=F,r=B(!1),s=B([]);function g(p){s.value=p.fileList.map(t=>t.file).filter(t=>t!=null)}async function x(){if(s.value.length!==0){r.value=!0;try{await l.uploadFiles(s.value),a.success(i("files.uploadSuccess",{count:s.value.length})),s.value=[],_("update:show",!1)}catch(p){a.error(p.message||i("files.uploadFailed"))}finally{r.value=!1}}}function M(){s.value=[],_("update:show",!1)}return(p,t)=>(v(),D(e(Te),{show:n.show,preset:"dialog",title:e(i)("files.upload"),"onUpdate:show":M,style:{width:"500px"}},{action:c(()=>[w(e(X),null,{default:c(()=>[w(e(T),{onClick:M},{default:c(()=>[k(f(e(i)("common.cancel")),1)]),_:1}),w(e(T),{type:"primary",loading:r.value,disabled:s.value.length===0,onClick:x},{default:c(()=>[k(f(e(i)("files.upload"))+" ("+f(s.value.length)+") ",1)]),_:1},8,["loading","disabled"])]),_:1})]),default:c(()=>[w(e(Je),{multiple:"","directory-dnd":"","default-upload":!1,onChange:g},{default:c(()=>[h("div",be,[h("p",null,f(e(i)("files.dragDropHint")),1)])]),_:1})]),_:1},8,["show","title"]))}})})),Ft=m((()=>{})),kt,aa=m((()=>{Ce(),Ce(),Ft(),R(),kt=j(Re,[["__scopeId","data-v-e54e68b1"]])})),je,xe=m((()=>{S(),z(),E(),U(),je=P({__name:"FileRenameModal",props:{show:{type:Boolean},mode:{},entry:{},targetPath:{}},emits:["update:show"],setup(C,{emit:F}){const{t:i}=L(),a=N(),l=I(),n=C,_=F,r=B(""),s=B(!1);Me(()=>n.show,p=>{p&&(n.mode==="rename"&&n.entry?r.value=n.entry.name:r.value="")});const g=H(()=>{switch(n.mode){case"newFile":return i("files.newFile");case"newFolder":return i("files.newFolder");case"rename":return i("files.rename")}}),x=H(()=>{switch(n.mode){case"newFile":return i("files.newFileName");case"newFolder":return i("files.newFolderName");case"rename":return i("files.renameTo")}});async function M(){if(r.value.trim()){s.value=!0;try{switch(n.mode){case"newFile":await l.createFile(r.value.trim()),a.success(i("files.created"));break;case"newFolder":await l.createDir(r.value.trim(),n.targetPath||void 0),a.success(i("files.created"));break;case"rename":n.entry&&(await l.renameEntry(n.entry,r.value.trim()),a.success(i("files.renamed")));break}_("update:show",!1)}catch(p){const t=n.mode==="rename"?i("files.renameFailed"):i("files.createFailed");a.error(p.message||t)}finally{s.value=!1}}}return(p,t)=>(v(),D(e(Te),{show:n.show,preset:"dialog",title:g.value,"onUpdate:show":t[2]||(t[2]=o=>_("update:show",!1)),style:{width:"400px"}},{action:c(()=>[w(e(X),null,{default:c(()=>[w(e(T),{onClick:t[1]||(t[1]=o=>_("update:show",!1))},{default:c(()=>[k(f(e(i)("common.cancel")),1)]),_:1}),w(e(T),{type:"primary",loading:s.value,disabled:!r.value.trim(),onClick:M},{default:c(()=>[k(f(e(i)("common.ok")),1)]),_:1},8,["loading","disabled"])]),_:1})]),default:c(()=>[w(e(Oe),{value:r.value,"onUpdate:value":t[0]||(t[0]=o=>r.value=o),placeholder:x.value,onKeydown:Ke(M,["enter"]),autofocus:""},null,8,["value","placeholder"])]),_:1},8,["show","title"]))}})})),bt,ia=m((()=>{xe(),xe(),bt=je}));export{yt as a,ea as c,pt as d,Zt as f,At as g,ut as h,aa as i,vt as l,Wt as m,ia as n,ta as o,_t as p,kt as r,wt as s,bt as t,Qt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as C}from"./rolldown-runtime-M0oDzQ_3.js";import{Bn as W,Kt as X,Y as Z,an as s,cn as m,cr as h,er as r,hn as ee,in as w,jn as a,on as F,pn as u,pr as b,sn as M,t as ie,tn as te,ur as ae}from"./ui-vendor-DDMfmCj2.js";import{M as le,N as ne,O as oe,P as se,k as re}from"./vue-vendor-BsMpqyaC.js";import{n as ue,t as _e}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as C}from"./rolldown-runtime-M0oDzQ_3.js";import{Bn as W,Kt as X,Y as Z,an as s,cn as m,cr as h,er as r,hn as ee,in as w,jn as a,on as F,pn as u,pr as b,sn as M,t as ie,tn as te,ur as ae}from"./ui-vendor-DDMfmCj2.js";import{M as le,N as ne,O as oe,P as se,k as re}from"./vue-vendor-BsMpqyaC.js";import{n as ue,t as _e}from"./_plugin-vue_export-helper-CvnFozKy.js";import{Dt as fe,Et as de}from"./index-B2IKGvbR.js";import{i as ce,t as pe}from"./files-CBYc0MSs.js";import{r as ve,t as S}from"./FileEditor-CzWdryd5.js";import{a as me,c as he,d as we,f as Fe,g as ge,h as ye,i as xe,l as Ce,m as Pe,n as ke,o as be,p as Me,r as Se,s as Ee,t as Ne,u as Re}from"./FileRenameModal-C2YmHkSN.js";var E,N,R,V,T,q,B,U,I,D=C((()=>{X(),le(),ie(),oe(),pe(),de(),ge(),Pe(),Fe(),Re(),he(),ve(),be(),xe(),ke(),E={class:"profile-config-editor-header"},N={class:"profile-config-title"},R={class:"profile-config-eyebrow"},V={class:"profile-config-file"},T={class:"profile-config-editor-content"},q={key:1,class:"files-tree-panel"},B={key:2,class:"files-main-panel"},U={class:"files-content"},I=ee({__name:"FilesView",setup(Be){const t=ce(),g=fe(),l=ne(),L=se(),A=Z(),{t:p}=re(),P=r(null),y=r(!1),n=r(!1),_=r("newFile"),f=r(null),d=r(null),c=w(()=>x(l.query.profile)),k=w(()=>x(l.query.file)),v=w(()=>!!c.value&&k.value==="config.yaml"),O=w(()=>c.value?`${c.value} / config.yaml`:"config.yaml");function $(e,i){P.value?.show(e,i)}function j(){_.value="newFile",f.value=null,d.value=null,n.value=!0}function z(){_.value="newFolder",f.value=null,d.value=null,n.value=!0}function J(e){_.value="newFolder",f.value=null,d.value=e.isDir?e.path:t.currentPath,n.value=!0}function K(e){_.value="rename",f.value=e,d.value=null,n.value=!0}function x(e){const i=Array.isArray(e)?e[0]:e;return typeof i=="string"&&i.trim()?i.trim():null}function Q(e){const i=e.lastIndexOf("/");return i>0?e.slice(0,i):""}async function Y(){(!g.activeProfileName||g.profiles.length===0)&&await g.fetchProfiles()}async function G(){await Y();const e=c.value,i=k.value,o=i?Q(i):x(l.query.path)||"";v.value||await t.fetchEntries(o,{profile:e}),i&&await t.openEditor(i,{profile:e})}function H(){const e=()=>{t.closeEditor(),L.push({name:"hermes.profiles"})};if(t.hasUnsavedChanges){A.warning({title:p("files.unsavedChanges"),positiveText:p("common.ok"),negativeText:p("common.cancel"),onPositiveClick:e});return}e()}return W([()=>l.query.profile,()=>l.query.path,()=>l.query.file],()=>{G()},{immediate:!0}),(e,i)=>(a(),m("div",{class:ae(["files-view",{"profile-config-editor-view":v.value}])},[v.value?(a(),m(te,{key:0},[s("div",E,[s("div",N,[s("span",R,b(h(p)("profiles.editConfig")),1),s("span",V,b(O.value),1)])]),s("div",T,[h(t).editingFile?(a(),F(S,{key:0,"custom-close":H})):M("",!0)])],64)):(a(),m("div",q,[u(ye,{profile:c.value},null,8,["profile"])])),v.value?M("",!0):(a(),m("div",B,[u(we,{onShowNewFile:j,onShowNewFolder:z,onShowUpload:i[0]||(i[0]=o=>y.value=!0)}),u(Me),s("div",U,[h(t).editingFile?(a(),F(S,{key:0})):h(t).previewFile?(a(),F(me,{key:1})):(a(),F(Ce,{key:2,onContextmenuEntry:$}))])])),u(Ee,{ref_key:"contextMenuRef",ref:P,onRename:K,onNewFolder:J},null,512),u(Se,{show:y.value,"onUpdate:show":i[1]||(i[1]=o=>y.value=o)},null,8,["show"]),u(Ne,{show:n.value,"onUpdate:show":i[2]||(i[2]=o=>n.value=o),mode:_.value,entry:f.value,"target-path":d.value},null,8,["show","mode","entry","target-path"])],2))}})})),Ve=C((()=>{})),Te,qe=C((()=>{D(),D(),Ve(),ue(),Te=_e(I,[["__scopeId","data-v-936ba9a7"]])}));qe();export{Te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as s}from"./rolldown-runtime-M0oDzQ_3.js";import{An as g,Bn as v,Kt as S,cn as w,hn as b,in as r,jn as h,kn as y,pn as A}from"./ui-vendor-DDMfmCj2.js";import{M as P,N as M,P as V}from"./vue-vendor-BsMpqyaC.js";import{n as G,t as R}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as s}from"./rolldown-runtime-M0oDzQ_3.js";import{An as g,Bn as v,Kt as S,cn as w,hn as b,in as r,jn as h,kn as y,pn as A}from"./ui-vendor-DDMfmCj2.js";import{M as P,N as M,P as V}from"./vue-vendor-BsMpqyaC.js";import{n as G,t as R}from"./_plugin-vue_export-helper-CvnFozKy.js";import{Dt as x,E as k,Et as C,L as B,Ot as E,R as F,T as I,kt as L}from"./index-B2IKGvbR.js";import{n as N,t as j}from"./ChatPanel-DRCE0v4g.js";var l,u,_=s((()=>{S(),P(),N(),E(),I(),C(),B(),l={class:"global-agent-view"},u=b({__name:"GlobalAgentView",setup(O){const p=L(),t=k(),c=x(),d=F(),n=M(),m=V(),a=r(()=>{const e=n.params.sessionId;return typeof e=="string"&&e.trim()?e:null}),f=r(()=>{const e=n.query.profile;return typeof e=="string"&&e.trim()?e:null});async function o(){await t.loadSessions(t.sessionProfileFilter,a.value),a.value&&t.activeSessionId!==a.value&&await m.replace({name:"hermes.globalAgent"})}return y(async()=>{t.setRuntimeMode("global_agent"),p.loadModels(),await Promise.all([c.fetchProfiles(),d.fetchSettings()]),await o()}),g(()=>{t.setRuntimeMode("default")}),v([a,f],async([e])=>{if(!(t.runtimeMode!=="global_agent"||!t.sessionsLoaded)){if(!e){await t.loadSessions(t.sessionProfileFilter);return}if(t.activeSessionId!==e){if(!t.sessions.some(i=>i.id===e)){await o();return}await t.switchSession(e)}}}),(e,i)=>(h(),w("div",l,[A(j)]))}})})),q=s((()=>{})),D,K=s((()=>{_(),_(),q(),G(),D=R(u,[["__scopeId","data-v-ba1ede1a"]])}));K();export{D as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as V}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as rt,An as yt,Bn as et,Dn as fs,E as Xe,Hn as B,Ht as hs,It as Be,Jt as Hn,Kt as Je,M as st,Nn as Ge,Ot as X,St as _s,Un as ys,V as Gn,Zt as Cs,an as t,bt as ks,cn as w,cr as o,en as ze,er as b,fn as K,fr as lt,hn as je,in as T,jn as y,kn as qe,mt as ws,nn as wt,nt as Vn,on as Re,ot as bt,pn as I,pr as g,sn as E,t as it,tn as Le,ur as te,vn as xt,w as St,wn as Ve}from"./ui-vendor-DDMfmCj2.js";import{I as bs,L as xs,M as jn,N as Ss,O as tt,P as Jn,k as at}from"./vue-vendor-BsMpqyaC.js";import{a as Is,c as Kn,f as me,n as Ze,o as Wn,t as Qe,u as Ct}from"./_plugin-vue_export-helper-fFMkIM4P.js";import{M as Ms,j as Ts}from"./vendor-B1Lfatlz.js";import{D as $s,Dt as Yn,Et as Xn,L as qn,M as Rs,N as As,O as Ns,R as Zn,Tt as Qn,X as es,Z as ts,f as Ps,g as Ds,j as Bs,wt as He}from"./index-Brl4qW5V.js";import{n as Ls,t as Es}from"./clipboard-1NPxC3YL.js";import{a as as,i as Us,n as Fs,o as os,r as Os,t as zs}from"./chat-timestamp-CZtP79YD.js";import{a as Hs,d as Gs,f as Vs,i as js,n as Js,r as Ks,t as Ws}from"./ttsHelpers-vHLmbeY4.js";import{n as Ys,r as It,t as Mt}from"./chat-input-height-BhYiNOv7.js";import{a as Xs,c as qs,i as Zs,n as Qs,o as er,r as vt,s as tr,t as Tt}from"./MarkdownRenderer-BbGvq6C-.js";import{i as ar,n as or,r as nr,t as sr}from"./SettingsCircuitBadge-CFo2KqP-.js";function rr(v){if(Se?.connected)return Se;const e=Wn(),d=v?.userId||localStorage.getItem("gc_user_id")||ns();return v?.userId||localStorage.setItem("gc_user_id",d),Se=Ms("/group-chat",{auth:{token:e||void 0,userId:d,name:v?.userName||localStorage.getItem("gc_user_name")||void 0,description:v?.description||localStorage.getItem("gc_user_description")||void 0,authUserId:v?.authUserId},transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:3e4,randomizationFactor:.5,timeout:3e4}),Se}function lr(){let v=localStorage.getItem("gc_user_id");return v||(v=ns(),localStorage.setItem("gc_user_id",v)),v}function ir(){return localStorage.getItem("gc_user_name")}function ns(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,v=>{const e=Math.random()*16|0;return(v==="x"?e:e&3|8).toString(16)})}function Ye(){return Se?.connected?Se:null}function ur(){Se&&(Se.disconnect(),Se=null)}async function cr(v){return me("/api/hermes/group-chat/rooms",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function dr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/clone`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e||{})})}async function vr(){return me("/api/hermes/group-chat/rooms")}async function mt(v,e={}){const d=new URLSearchParams;e.offset!=null&&d.set("offset",String(e.offset)),e.limit!=null&&d.set("limit",String(e.limit));const n=d.toString();return me(`/api/hermes/group-chat/rooms/${v}${n?`?${n}`:""}`)}async function mr(v){return me(`/api/hermes/group-chat/rooms/join/${v}`)}async function pr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function gr(v){return me(`/api/hermes/group-chat/rooms/${v}/agents`)}async function fr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/agents/${e}`,{method:"DELETE"})}async function hr(v){return me(`/api/hermes/group-chat/rooms/${v}`,{method:"DELETE"})}async function _r(v){return me(`/api/hermes/group-chat/rooms/${v}/clear-context`,{method:"POST"})}async function yr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Cr(v){return me(`/api/hermes/group-chat/rooms/${v}/compress`,{method:"POST"})}var Se,ss=V((()=>{Ts(),Ct(),Se=null}));async function kr(v){const e=new FormData;for(const h of v)h.file&&e.append("file",h.file,h.name);const d=Wn(),n=Is(),i={};d&&(i.Authorization=`Bearer ${d}`),n&&(i["X-Hermes-Profile"]=n);const p=await fetch("/upload",{method:"POST",body:e,headers:i});if(!p.ok)throw new Error(await Ns(p,"Upload failed"));return(await p.json()).files}function wr(v,e,d){const n=[];v.trim()&&n.push({type:"text",text:v.trim()});for(let i=0;i<d.length;i+=1){const p=d[i],h=e[i];h?.type.startsWith("image/")?n.push({type:"image",name:p.name,path:p.path,media_type:h.type}):n.push({type:"file",name:p.name,path:p.path,media_type:h?.type})}return n}function br(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function xr(v){return/^[a-zA-Z]:\\/.test(v)?v.replace(/\\/g,"/"):v}function Ae(v){return!!v?.trim()}function Sr(v){return`auth:${v}`}function pt(){return ir()?.trim()||""}function Ir(v){return!!v.tool_calls?.length}function gt(v){return v.role==="assistant"&&!Ae(v.content)&&Ae(v.reasoning)&&!Ir(v)}function $t(v,e){return{...e,content:Ae(e.content)?e.content:v?.content||e.content||"",reasoning:Ae(e.reasoning)?e.reasoning:v?.reasoning??e.reasoning??null,reasoning_content:Ae(e.reasoning_content)?e.reasoning_content:v?.reasoning_content??e.reasoning_content??null,isStreaming:!1,firstSeenAt:v?.firstSeenAt??e.firstSeenAt,attachments:v?.attachments||e.attachments}}function kt(v){return v!=null&&v!==""}function Rt(v){return kt(v)?v:void 0}function ft(v){if(!kt(v))return"";if(typeof v=="string")return v;try{const e=JSON.stringify(v);if(e!==void 0)return e}catch{}return String(v)}function Mr(v){const e=new Map,d=new Map;for(const i of v)if(i.role==="assistant"&&i.tool_calls?.length)for(const p of i.tool_calls)p?.id&&(p.function?.name&&e.set(p.id,p.function.name),kt(p.function?.arguments)&&d.set(p.id,p.function.arguments));const n=[];for(const i of v)if(!(i.role!=="tool"&&!i.tool_calls?.length&&!ft(i.content).trim()&&!i.reasoning?.trim()&&(!i.isStreaming||i.finish_reason==="streaming"))){if(i.role==="assistant"&&i.tool_calls?.length&&!ft(i.content).trim()){for(const p of i.tool_calls)n.push({...i,id:`${i.id}_${p.id}`,role:"tool",content:"",toolName:p.function?.name||void 0,toolCallId:p.id,toolArgs:Rt(p.function?.arguments),toolStatus:"running"});continue}if(i.role==="tool"){const p=i.tool_call_id||"",h=i.tool_name||e.get(p)||void 0,L=d.has(p)?d.get(p):void 0;let P="";const A=ft(i.content);if(A)try{const U=typeof i.content=="string"?JSON.parse(A):i.content;P=U?.url||U?.title||U?.preview||U?.summary||""}catch{P=A.slice(0,80)}const R=n.findIndex(U=>U.role==="tool"&&U.toolCallId===p&&!U.toolResult),F={...i,id:R!==-1?n[R].id:i.id,senderId:R!==-1?n[R].senderId:i.senderId,senderName:R!==-1?n[R].senderName:i.senderName,timestamp:R!==-1?n[R].timestamp:i.timestamp,role:"tool",content:"",toolName:h||(R!==-1?n[R].toolName:void 0),toolCallId:p||void 0,toolArgs:L!==void 0?L:R!==-1?n[R].toolArgs:void 0,toolPreview:typeof P=="string"&&P.slice(0,100)||void 0,toolResult:Rt(i.content),toolStatus:"done"};R!==-1?n[R]=F:n.push(F);continue}n.push(i)}return n}var At,Tr,$r,ot,ut=V((()=>{xs(),Je(),Ct(),Ds(),ts(),$s(),ss(),At=300,Tr=150,$r=600,ot=bs("groupChat",()=>{const v=b(!1),e=b(null),d=b([]),n=b([]),i=b([]),p=b([]),h=b(""),L=b(!1),P=b(null),A=b(new Map),R=b(new Map),F=b(!1),U=b(new Map),D=b(0),M=b(0),S=b(!1),O=b(!1),H=T(()=>S.value&&M.value>=600),ae=b("");function oe(){D.value=0,M.value=0,S.value=!1,O.value=!1}function W(c){M.value=c.messages.length,D.value=c.total??c.messages.length,S.value=c.hasMore??M.value<D.value}function ye(c){F.value=c}function Ne(c,C){window.dispatchEvent(new CustomEvent("auto-play-speech",{detail:{messageId:c,content:C}}))}async function ee(c,C){if(e.value!==c)return;const k=n.value.findIndex(r=>r.id===C);if(!(k<0||!gt(n.value[k])))try{const r=(await mt(c)).messages.find(x=>x.id===C);if(!r||!Ae(r.content))return;const m=n.value.findIndex(x=>x.id===C);if(m<0||!gt(n.value[m]))return;n.value[m]=$t(n.value[m],r),n.value=[...n.value]}catch{}}function re(c,C){setTimeout(()=>{ee(c,C)},At)}const Ce=T(()=>{for(const[,c]of R.value)return c;return null}),le=T(()=>{if(!e.value)return null;for(const c of U.value.values())if(c.roomId===e.value)return c;return null}),q=b(lr()),Q=b(pt()||Kn()||"");function z(c,C={}){i.value=c.members||[],c.agents&&(p.value=c.agents),c.roomName&&(h.value=c.roomName);const k=i.value.find(r=>r.userId===q.value);if(k?.name&&(Q.value=k.name),k?.avatar&&(ae.value=k.avatar),C.syncMessages&&Array.isArray(c.messages)){const r=new Map(n.value.map(m=>[m.id,m]));for(const m of c.messages){const x=r.get(m.id);r.set(m.id,x?{...x,...m}:m)}n.value=Array.from(r.values()).sort((m,x)=>m.timestamp-x.timestamp),typeof c.total=="number"||typeof c.hasMore=="boolean"?W(c):(M.value=Math.max(M.value,n.value.length),D.value=Math.max(D.value,M.value))}for(const r of A.value.values())clearTimeout(r.timer);if(A.value.clear(),c.typingUsers)for(const r of c.typingUsers){const m=setTimeout(()=>A.value.delete(r.userId),5e3);A.value.set(r.userId,{name:r.userName,timer:m})}c.contextStatuses?R.value=new Map(c.contextStatuses.map(r=>[r.agentName,r])):R.value.clear()}async function ie(c,C={}){const k=Ye();if(!k)return;const r=pt();await new Promise(m=>{k.emit("join",{roomId:c,name:r||void 0,description:localStorage.getItem("gc_user_description")||void 0},x=>{if(e.value!==c){m();return}x?.error?P.value=x.error:z(x,C),m()})})}const G=T(()=>Mr([...n.value].sort((c,C)=>(c.firstSeenAt??c.timestamp)-(C.firstSeenAt??C.timestamp)))),pe=T(()=>i.value.map(c=>c.name)),ue=T(()=>Array.from(A.value.values()).map(c=>c.name)),ne=T(()=>{const c=ue.value;return c.length===0?"":c.length===1?`${c[0]} is typing...`:c.length===2?`${c[0]} and ${c[1]} are typing...`:`${c[0]} and ${c.length-1} others are typing...`});async function ce(){let c;const C=pt();try{const r=await Ps();c=r.id,q.value=Sr(r.id),C||(Q.value=r.username),ae.value=r.avatar||""}catch{}const k=rr({userId:q.value,userName:C||void 0,authUserId:c});console.log("[GroupChat] connecting...",{userId:q.value,userName:Q.value}),k.on("connect",()=>{console.log("[GroupChat] connected, socket id:",k.id),v.value=!0,P.value=null;const r=e.value;r&&ie(r,{syncMessages:!0}).catch(m=>{P.value=m.message})}),k.on("disconnect",r=>{console.log("[GroupChat] disconnected:",r),v.value=!1}),k.on("connect_error",r=>{console.error("[GroupChat] connect_error:",r.message),P.value=r.message,v.value=!1}),k.on("message",r=>{if(r.roomId===e.value){const m=n.value.findIndex(Z=>Z.id===r.id),x=$t(m>=0?n.value[m]:null,r);m>=0?(n.value[m]=x,n.value=[...n.value]):(n.value.push(x),M.value+=1,D.value=Math.max(D.value+1,M.value)),F.value&&x.role==="assistant"&&x.content?.trim()&&setTimeout(()=>Ne(x.id,x.content),300)}}),k.on("message_stream_start",r=>{if(r.roomId!==e.value)return;n.value=n.value.filter(x=>!(x.roomId===r.roomId&&x.senderId===r.senderId&&x.id!==r.id&&x.isStreaming&&!x.content?.trim()&&!x.reasoning?.trim()&&!x.tool_calls?.length)),r.isStreaming=!0,r.firstSeenAt=r.firstSeenAt??r.timestamp??Date.now();const m=n.value.findIndex(x=>x.id===r.id);if(m>=0){const x=n.value[m];if(!x.isStreaming)return;n.value[m]={...x,...r,content:Ae(r.content)?r.content:x.content||"",reasoning:Ae(r.reasoning)?r.reasoning:x.reasoning,reasoning_content:Ae(r.reasoning_content)?r.reasoning_content:x.reasoning_content,isStreaming:!0},n.value=[...n.value]}else n.value.push(r),M.value+=1,D.value=Math.max(D.value+1,M.value)}),k.on("message_stream_delta",r=>{if(r.roomId!==e.value)return;const m=n.value.findIndex(x=>x.id===r.id);m<0||!n.value[m].isStreaming||(n.value[m]={...n.value[m],content:n.value[m].content+r.delta},n.value=[...n.value])}),k.on("message_reasoning_delta",r=>{if(r.roomId!==e.value)return;const m=n.value.findIndex(x=>x.id===r.id);m<0||!n.value[m].isStreaming||(n.value[m]={...n.value[m],reasoning:(n.value[m].reasoning||"")+r.delta,reasoning_content:(n.value[m].reasoning_content||"")+r.delta,isStreaming:!0},n.value=[...n.value])}),k.on("message_stream_end",r=>{if(r.roomId!==e.value)return;const m=n.value.findIndex(x=>x.id===r.id);m>=0&&!n.value[m].content?.trim()&&!n.value[m].reasoning?.trim()&&!n.value[m].tool_calls?.length?n.value.splice(m,1):m>=0&&(n.value[m]={...n.value[m],isStreaming:!1},n.value=[...n.value],gt(n.value[m])&&re(r.roomId,r.id))}),k.on("member_joined",r=>{r.roomId===e.value&&(i.value=r.members)}),k.on("member_left",r=>{r.roomId===e.value&&(i.value=r.members)}),k.on("typing",r=>{if(r.roomId===e.value&&!A.value.has(r.userId)){const m=setTimeout(()=>A.value.delete(r.userId),5e3);A.value.set(r.userId,{name:r.userName,timer:m})}}),k.on("stop_typing",r=>{if(r.roomId===e.value&&A.value.has(r.userId)){const m=A.value.get(r.userId);clearTimeout(m.timer),A.value.delete(r.userId)}}),k.on("context_status",r=>{r.roomId===e.value&&(r.status==="ready"?(R.value.delete(r.agentName),n.value=n.value.map(m=>m.senderName===r.agentName&&m.isStreaming?{...m,isStreaming:!1}:m).filter(m=>!(m.senderName===r.agentName&&!m.content?.trim()&&!m.reasoning?.trim()&&!m.tool_calls?.length))):R.value.set(r.agentName,{agentName:r.agentName,status:r.status}),R.value=new Map(R.value))}),k.on("approval.requested",r=>{if(!r.approval_id)return;const m=r.description||"",x=m.trim().toLowerCase().replace(/\s+/g," "),Z=!r.allow_permanent&&(x==="save to memory"||x.startsWith("save to memory:")||x.startsWith("save to memory?")),a=(Array.isArray(r.choices)?r.choices:["once","session","deny"]).filter(l=>l==="once"||l==="session"||l==="always"||l==="deny");U.value.set(r.approval_id,{roomId:r.roomId,agentName:r.agentName||"",approvalId:r.approval_id,command:r.command||"",description:m,choices:Z?["once","deny"]:a.length?a:["once","session","deny"],allowPermanent:!!r.allow_permanent,isMemoryWrite:Z,requestedAt:Date.now()}),U.value=new Map(U.value)}),k.on("approval.resolved",r=>{r.approval_id&&(U.value.delete(r.approval_id),U.value=new Map(U.value))}),k.on("room_updated",r=>{const m=d.value.find(x=>x.id===r.roomId);m&&(m.totalTokens=r.totalTokens)}),k.on("room_cleared",r=>{const m=d.value.find(x=>x.id===r.roomId);m&&(m.totalTokens=r.totalTokens),r.roomId===e.value&&(n.value=[],oe(),A.value.clear(),R.value.clear(),U.value.clear())})}function j(){ur(),v.value=!1,e.value=null,n.value=[],oe(),i.value=[],p.value=[],h.value="",A.value.clear(),R.value.clear(),U.value.clear()}function Y(c,C){Q.value=c,localStorage.setItem("gc_user_name",c),localStorage.setItem("gc_user_description",C)}async function ge(c){L.value=!0,P.value=null;try{const C=await mt(c);e.value=C.room.id,h.value=C.room.name,n.value=C.messages,W(C),p.value=C.agents,i.value=C.members||[]}catch(C){throw P.value=C.message,C}finally{L.value=!1}await ie(c)}async function Ie(){const c=e.value;if(!c||O.value||!S.value)return!1;const C=M.value;if(C>=600)return!1;O.value=!0;try{const k=await mt(c,{offset:C,limit:Math.min(150,600-C)}),r=new Set(n.value.map(x=>x.id)),m=k.messages.filter(x=>!r.has(x.id));return n.value=[...m,...n.value],M.value=C+k.messages.length,D.value=k.total??D.value,S.value=k.hasMore??M.value<D.value,m.length>0}catch(k){return P.value=k.message,!1}finally{O.value=!1}}async function ke(c,C){const k=Ye();if(!k||!e.value)return;xe();const r=br();let m=c.trim();if(C?.length){const x=await kr(C);m=wr(c,C,x);const Z=new Map(x.map(a=>[a.name,es(xr(a.path),a.name)]));n.value.push({id:r,roomId:e.value,senderId:q.value,senderName:Q.value||"You",content:JSON.stringify(m),timestamp:Date.now(),role:"user",attachments:C.map(a=>({...a,url:Z.get(a.name)||a.url,file:void 0}))}),M.value+=1,D.value=Math.max(D.value+1,M.value)}return new Promise((x,Z)=>{k.emit("message",{roomId:e.value,id:r,content:m},a=>{if(a.error){n.value=n.value.filter(l=>l.id!==r),Z(new Error(a.error));return}x()})})}async function Me(){try{d.value=(await vr()).rooms}catch(c){P.value=c.message}}async function we(c,C,k,r){try{const m=await cr({name:c,inviteCode:C,agents:k,compression:r||{triggerTokens:1e5,maxHistoryTokens:32e3,tailMessageCount:10}});return d.value.push(m.room),m}catch(m){throw P.value=m.message,m}}async function Te(c){try{const C=await mr(c);return await ge(C.room.id),C.room}catch(C){throw P.value=C.message,C}}async function Ee(c){try{await hr(c),d.value=d.value.filter(C=>C.id!==c),e.value===c&&(e.value=null,n.value=[],oe(),i.value=[],p.value=[],h.value="")}catch(C){throw P.value=C.message,C}}async function $e(c,C){try{const k=await dr(c,C);return d.value.push(k.room),k}catch(k){throw P.value=k.message,k}}async function be(){if(e.value)try{const c=await _r(e.value);n.value=[],oe(),A.value.clear(),R.value.clear();const C=d.value.findIndex(k=>k.id===e.value);return C>=0&&c.room&&(d.value[C]=c.room),c}catch(c){throw P.value=c.message,c}}async function fe(c){try{p.value=(await gr(c)).agents}catch{}}async function Ue(c,C){try{const k=await pr(c,C);return p.value.push(k.agent),k.agent}catch(k){throw P.value=k.message,k}}async function Fe(c,C){try{const k=await fr(c,C);p.value=k.agents??p.value.filter(r=>r.id!==C&&r.agentId!==C),k.members&&(i.value=k.members)}catch(k){throw P.value=k.message,k}}let de=null;function he(){const c=Ye();!c||!e.value||(c.emit("typing",{roomId:e.value}),de&&clearTimeout(de),de=setTimeout(()=>xe(),4e3))}function xe(){const c=Ye();!c||!e.value||(c.emit("stop_typing",{roomId:e.value}),de&&(clearTimeout(de),de=null))}async function Oe(c){const C=Ye();!C||!e.value||await new Promise((k,r)=>{C.emit("interrupt_agent",{roomId:e.value,agentName:c},m=>{m?.error?r(new Error(m.error)):k()})})}async function se(c){const C=Ye(),k=le.value;!C||!k||(await new Promise((r,m)=>{C.emit("approval.respond",{roomId:k.roomId,approval_id:k.approvalId,choice:c},x=>{x?.error?m(new Error(x.error)):r()})}),U.value.delete(k.approvalId),U.value=new Map(U.value))}return{connected:v,currentRoomId:e,rooms:d,messages:n,members:i,agents:p,roomName:h,isJoining:L,error:P,contextStatus:Ce,contextStatuses:R,pendingApprovals:U,activePendingApproval:le,autoPlaySpeechEnabled:F,totalMessages:D,loadedMessageCount:M,hasMoreBefore:S,isLoadingOlderMessages:O,hasReachedMessageDisplayLimit:H,userId:q,userName:Q,currentUserAvatar:ae,sortedMessages:G,memberNames:pe,typingNames:ue,typingText:ne,connect:ce,disconnect:j,setUserInfo:Y,setAutoPlaySpeech:ye,joinRoom:ge,loadOlderMessages:Ie,sendMessage:ke,loadRooms:Me,emitTyping:he,emitStopTyping:xe,interruptAgent:Oe,respondApproval:se,createNewRoom:we,joinByCode:Te,deleteRoom:Ee,cloneRoom:$e,clearCurrentRoomContext:be,loadAgents:fe,addAgentToRoom:Ue,removeAgentFromRoom:Fe}})})),Nt,Pt,Dt,Bt,Lt,Et,Ut,Ft,Ot,zt,Ht,Gt,Vt,jt,Jt,Kt,Wt,Yt,Xt,qt,Zt,Qt,ea,ta,aa,oa,na,sa,ra,la,ia,ua,ca,da,va,ma,pa,ga,fa,De,ht,ha,_a,ya,Ca,nt,rs,ka=V((()=>{Je(),tt(),it(),Qs(),Qn(),Xn(),tr(),Rs(),Gs(),js(),Js(),ts(),Fs(),Nt={key:0,class:"group-message tool-message"},Pt={class:"avatar"},Dt={class:"msg-body"},Bt={class:"msg-header"},Lt={class:"sender-name"},Et={key:0,class:"agent-desc"},Ut={key:1,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"tool-icon"},Ft={class:"tool-name"},Ot={key:2,class:"tool-preview"},zt={key:3,class:"tool-spinner"},Ht={key:4,class:"tool-error-badge"},Gt={key:0,class:"tool-detail-section","data-copy-source":"tool-args"},Vt={class:"tool-detail-label"},jt=["innerHTML"],Jt={key:1,class:"tool-detail-section","data-copy-source":"tool-result"},Kt={class:"tool-detail-label"},Wt=["innerHTML"],Yt={class:"msg-time"},Xt={class:"avatar"},qt={class:"msg-body"},Zt={class:"msg-header"},Qt={class:"sender-name"},ea={key:0,class:"agent-desc"},ta={key:0,class:"msg-attachments"},aa=["src","alt","onClick"],oa=["href","title"],na={class:"att-name"},sa={class:"att-size"},ra={class:"thinking-label"},la={class:"thinking-meta"},ia={key:0,class:"thinking-body"},ua={key:3,class:"streaming-dots"},ca={class:"message-meta"},da=["title"],va={key:0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ma={key:1,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},pa=["title"],ga={class:"message-time"},fa=["src"],De=1e3,ht=200,ha=6,_a=1e3,ya=50,Ca=50,nt="__truncated__",rs=je({__name:"GroupMessageItem",props:{message:{},agents:{},members:{},currentUserId:{}},setup(v){const e=v,{t:d}=at(),n=Gn(),i=Yn(),p=Vs(),h=Hs(),L=b(null),P=T(()=>e.agents.some(a=>a.agentId===e.message.senderId||a.name===e.message.senderName)),A=T(()=>e.message.role!=="assistant"?!1:e.message.finish_reason==="error"?!0:/^Error:\s*/i.test(e.message.content||"")),R=T(()=>!!e.currentUserId&&e.message.senderId===e.currentUserId),F=T(()=>e.agents.find(a=>a.agentId===e.message.senderId||a.name===e.message.senderName)),U=T(()=>zs(e.message.timestamp)),D=T(()=>F.value?.profile||e.message.senderName||e.message.senderId),M=T(()=>i.profiles.find(a=>a.name===F.value?.profile)),S=T(()=>P.value?null:e.members?.find(a=>a.userId===e.message.senderId||a.name===e.message.senderName)||null),O=T(()=>{const a=S.value?.avatar;if(!a)return null;try{const l=typeof a=="string"?JSON.parse(a):a;if(l&&l.type==="image"&&l.dataUrl)return l}catch{}return null}),H=T(()=>P.value?M.value?.avatar??null:O.value),ae=T(()=>P.value?D.value:e.message.senderName||e.message.senderId||"user"),oe=T(()=>["all",...e.agents.map(a=>a.name).filter(Boolean)]),W=T(()=>As(e.message.content||"",{streaming:!!e.message.isStreaming})),ye=T(()=>!!(e.message.reasoning&&e.message.reasoning.length>0)),Ne=T(()=>ye.value||W.value.hasThinking),ee=T(()=>{const a=[];return e.message.reasoning&&a.push(e.message.reasoning),a.push(...W.value.segments),W.value.pending&&a.push(W.value.pending),a.join(`
|
|
1
|
+
import{n as V}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as rt,An as yt,Bn as et,Dn as fs,E as Xe,Hn as B,Ht as hs,It as Be,Jt as Hn,Kt as Je,M as st,Nn as Ge,Ot as X,St as _s,Un as ys,V as Gn,Zt as Cs,an as t,bt as ks,cn as w,cr as o,en as ze,er as b,fn as K,fr as lt,hn as je,in as T,jn as y,kn as qe,mt as ws,nn as wt,nt as Vn,on as Re,ot as bt,pn as I,pr as g,sn as E,t as it,tn as Le,ur as te,vn as xt,w as St,wn as Ve}from"./ui-vendor-DDMfmCj2.js";import{I as bs,L as xs,M as jn,N as Ss,O as tt,P as Jn,k as at}from"./vue-vendor-BsMpqyaC.js";import{a as Is,c as Kn,f as me,n as Ze,o as Wn,t as Qe,u as Ct}from"./_plugin-vue_export-helper-CvnFozKy.js";import{M as Ms,j as Ts}from"./vendor-B1Lfatlz.js";import{D as $s,Dt as Yn,Et as Xn,L as qn,M as Rs,N as As,O as Ns,R as Zn,Tt as Qn,X as es,Z as ts,f as Ps,g as Ds,j as Bs,wt as He}from"./index-B2IKGvbR.js";import{n as Ls,t as Es}from"./clipboard-1NPxC3YL.js";import{a as as,i as Us,n as Fs,o as os,r as Os,t as zs}from"./chat-timestamp-CkDNtK9Y.js";import{a as Hs,d as Gs,f as Vs,i as js,n as Js,r as Ks,t as Ws}from"./ttsHelpers-DNcZ5khq.js";import{n as Ys,r as It,t as Mt}from"./chat-input-height-BhYiNOv7.js";import{a as Xs,c as qs,i as Zs,n as Qs,o as er,r as vt,s as tr,t as Tt}from"./MarkdownRenderer-DQvs79tf.js";import{i as ar,n as or,r as nr,t as sr}from"./SettingsCircuitBadge-Eiv8LQz0.js";function rr(v){if(Se?.connected)return Se;const e=Wn(),d=v?.userId||localStorage.getItem("gc_user_id")||ns();return v?.userId||localStorage.setItem("gc_user_id",d),Se=Ms("/group-chat",{auth:{token:e||void 0,userId:d,name:v?.userName||localStorage.getItem("gc_user_name")||void 0,description:v?.description||localStorage.getItem("gc_user_description")||void 0,authUserId:v?.authUserId},transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:3e4,randomizationFactor:.5,timeout:3e4}),Se}function lr(){let v=localStorage.getItem("gc_user_id");return v||(v=ns(),localStorage.setItem("gc_user_id",v)),v}function ir(){return localStorage.getItem("gc_user_name")}function ns(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,v=>{const e=Math.random()*16|0;return(v==="x"?e:e&3|8).toString(16)})}function Ye(){return Se?.connected?Se:null}function ur(){Se&&(Se.disconnect(),Se=null)}async function cr(v){return me("/api/hermes/group-chat/rooms",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function dr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/clone`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e||{})})}async function vr(){return me("/api/hermes/group-chat/rooms")}async function mt(v,e={}){const d=new URLSearchParams;e.offset!=null&&d.set("offset",String(e.offset)),e.limit!=null&&d.set("limit",String(e.limit));const n=d.toString();return me(`/api/hermes/group-chat/rooms/${v}${n?`?${n}`:""}`)}async function mr(v){return me(`/api/hermes/group-chat/rooms/join/${v}`)}async function pr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function gr(v){return me(`/api/hermes/group-chat/rooms/${v}/agents`)}async function fr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/agents/${e}`,{method:"DELETE"})}async function hr(v){return me(`/api/hermes/group-chat/rooms/${v}`,{method:"DELETE"})}async function _r(v){return me(`/api/hermes/group-chat/rooms/${v}/clear-context`,{method:"POST"})}async function yr(v,e){return me(`/api/hermes/group-chat/rooms/${v}/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Cr(v){return me(`/api/hermes/group-chat/rooms/${v}/compress`,{method:"POST"})}var Se,ss=V((()=>{Ts(),Ct(),Se=null}));async function kr(v){const e=new FormData;for(const h of v)h.file&&e.append("file",h.file,h.name);const d=Wn(),n=Is(),i={};d&&(i.Authorization=`Bearer ${d}`),n&&(i["X-Hermes-Profile"]=n);const p=await fetch("/upload",{method:"POST",body:e,headers:i});if(!p.ok)throw new Error(await Ns(p,"Upload failed"));return(await p.json()).files}function wr(v,e,d){const n=[];v.trim()&&n.push({type:"text",text:v.trim()});for(let i=0;i<d.length;i+=1){const p=d[i],h=e[i];h?.type.startsWith("image/")?n.push({type:"image",name:p.name,path:p.path,media_type:h.type}):n.push({type:"file",name:p.name,path:p.path,media_type:h?.type})}return n}function br(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function xr(v){return/^[a-zA-Z]:\\/.test(v)?v.replace(/\\/g,"/"):v}function Ae(v){return!!v?.trim()}function Sr(v){return`auth:${v}`}function pt(){return ir()?.trim()||""}function Ir(v){return!!v.tool_calls?.length}function gt(v){return v.role==="assistant"&&!Ae(v.content)&&Ae(v.reasoning)&&!Ir(v)}function $t(v,e){return{...e,content:Ae(e.content)?e.content:v?.content||e.content||"",reasoning:Ae(e.reasoning)?e.reasoning:v?.reasoning??e.reasoning??null,reasoning_content:Ae(e.reasoning_content)?e.reasoning_content:v?.reasoning_content??e.reasoning_content??null,isStreaming:!1,firstSeenAt:v?.firstSeenAt??e.firstSeenAt,attachments:v?.attachments||e.attachments}}function kt(v){return v!=null&&v!==""}function Rt(v){return kt(v)?v:void 0}function ft(v){if(!kt(v))return"";if(typeof v=="string")return v;try{const e=JSON.stringify(v);if(e!==void 0)return e}catch{}return String(v)}function Mr(v){const e=new Map,d=new Map;for(const i of v)if(i.role==="assistant"&&i.tool_calls?.length)for(const p of i.tool_calls)p?.id&&(p.function?.name&&e.set(p.id,p.function.name),kt(p.function?.arguments)&&d.set(p.id,p.function.arguments));const n=[];for(const i of v)if(!(i.role!=="tool"&&!i.tool_calls?.length&&!ft(i.content).trim()&&!i.reasoning?.trim()&&(!i.isStreaming||i.finish_reason==="streaming"))){if(i.role==="assistant"&&i.tool_calls?.length&&!ft(i.content).trim()){for(const p of i.tool_calls)n.push({...i,id:`${i.id}_${p.id}`,role:"tool",content:"",toolName:p.function?.name||void 0,toolCallId:p.id,toolArgs:Rt(p.function?.arguments),toolStatus:"running"});continue}if(i.role==="tool"){const p=i.tool_call_id||"",h=i.tool_name||e.get(p)||void 0,L=d.has(p)?d.get(p):void 0;let P="";const A=ft(i.content);if(A)try{const U=typeof i.content=="string"?JSON.parse(A):i.content;P=U?.url||U?.title||U?.preview||U?.summary||""}catch{P=A.slice(0,80)}const R=n.findIndex(U=>U.role==="tool"&&U.toolCallId===p&&!U.toolResult),F={...i,id:R!==-1?n[R].id:i.id,senderId:R!==-1?n[R].senderId:i.senderId,senderName:R!==-1?n[R].senderName:i.senderName,timestamp:R!==-1?n[R].timestamp:i.timestamp,role:"tool",content:"",toolName:h||(R!==-1?n[R].toolName:void 0),toolCallId:p||void 0,toolArgs:L!==void 0?L:R!==-1?n[R].toolArgs:void 0,toolPreview:typeof P=="string"&&P.slice(0,100)||void 0,toolResult:Rt(i.content),toolStatus:"done"};R!==-1?n[R]=F:n.push(F);continue}n.push(i)}return n}var At,Tr,$r,ot,ut=V((()=>{xs(),Je(),Ct(),Ds(),ts(),$s(),ss(),At=300,Tr=150,$r=600,ot=bs("groupChat",()=>{const v=b(!1),e=b(null),d=b([]),n=b([]),i=b([]),p=b([]),h=b(""),L=b(!1),P=b(null),A=b(new Map),R=b(new Map),F=b(!1),U=b(new Map),D=b(0),M=b(0),S=b(!1),O=b(!1),H=T(()=>S.value&&M.value>=600),ae=b("");function oe(){D.value=0,M.value=0,S.value=!1,O.value=!1}function W(c){M.value=c.messages.length,D.value=c.total??c.messages.length,S.value=c.hasMore??M.value<D.value}function ye(c){F.value=c}function Ne(c,C){window.dispatchEvent(new CustomEvent("auto-play-speech",{detail:{messageId:c,content:C}}))}async function ee(c,C){if(e.value!==c)return;const k=n.value.findIndex(r=>r.id===C);if(!(k<0||!gt(n.value[k])))try{const r=(await mt(c)).messages.find(x=>x.id===C);if(!r||!Ae(r.content))return;const m=n.value.findIndex(x=>x.id===C);if(m<0||!gt(n.value[m]))return;n.value[m]=$t(n.value[m],r),n.value=[...n.value]}catch{}}function re(c,C){setTimeout(()=>{ee(c,C)},At)}const Ce=T(()=>{for(const[,c]of R.value)return c;return null}),le=T(()=>{if(!e.value)return null;for(const c of U.value.values())if(c.roomId===e.value)return c;return null}),q=b(lr()),Q=b(pt()||Kn()||"");function z(c,C={}){i.value=c.members||[],c.agents&&(p.value=c.agents),c.roomName&&(h.value=c.roomName);const k=i.value.find(r=>r.userId===q.value);if(k?.name&&(Q.value=k.name),k?.avatar&&(ae.value=k.avatar),C.syncMessages&&Array.isArray(c.messages)){const r=new Map(n.value.map(m=>[m.id,m]));for(const m of c.messages){const x=r.get(m.id);r.set(m.id,x?{...x,...m}:m)}n.value=Array.from(r.values()).sort((m,x)=>m.timestamp-x.timestamp),typeof c.total=="number"||typeof c.hasMore=="boolean"?W(c):(M.value=Math.max(M.value,n.value.length),D.value=Math.max(D.value,M.value))}for(const r of A.value.values())clearTimeout(r.timer);if(A.value.clear(),c.typingUsers)for(const r of c.typingUsers){const m=setTimeout(()=>A.value.delete(r.userId),5e3);A.value.set(r.userId,{name:r.userName,timer:m})}c.contextStatuses?R.value=new Map(c.contextStatuses.map(r=>[r.agentName,r])):R.value.clear()}async function ie(c,C={}){const k=Ye();if(!k)return;const r=pt();await new Promise(m=>{k.emit("join",{roomId:c,name:r||void 0,description:localStorage.getItem("gc_user_description")||void 0},x=>{if(e.value!==c){m();return}x?.error?P.value=x.error:z(x,C),m()})})}const G=T(()=>Mr([...n.value].sort((c,C)=>(c.firstSeenAt??c.timestamp)-(C.firstSeenAt??C.timestamp)))),pe=T(()=>i.value.map(c=>c.name)),ue=T(()=>Array.from(A.value.values()).map(c=>c.name)),ne=T(()=>{const c=ue.value;return c.length===0?"":c.length===1?`${c[0]} is typing...`:c.length===2?`${c[0]} and ${c[1]} are typing...`:`${c[0]} and ${c.length-1} others are typing...`});async function ce(){let c;const C=pt();try{const r=await Ps();c=r.id,q.value=Sr(r.id),C||(Q.value=r.username),ae.value=r.avatar||""}catch{}const k=rr({userId:q.value,userName:C||void 0,authUserId:c});console.log("[GroupChat] connecting...",{userId:q.value,userName:Q.value}),k.on("connect",()=>{console.log("[GroupChat] connected, socket id:",k.id),v.value=!0,P.value=null;const r=e.value;r&&ie(r,{syncMessages:!0}).catch(m=>{P.value=m.message})}),k.on("disconnect",r=>{console.log("[GroupChat] disconnected:",r),v.value=!1}),k.on("connect_error",r=>{console.error("[GroupChat] connect_error:",r.message),P.value=r.message,v.value=!1}),k.on("message",r=>{if(r.roomId===e.value){const m=n.value.findIndex(Z=>Z.id===r.id),x=$t(m>=0?n.value[m]:null,r);m>=0?(n.value[m]=x,n.value=[...n.value]):(n.value.push(x),M.value+=1,D.value=Math.max(D.value+1,M.value)),F.value&&x.role==="assistant"&&x.content?.trim()&&setTimeout(()=>Ne(x.id,x.content),300)}}),k.on("message_stream_start",r=>{if(r.roomId!==e.value)return;n.value=n.value.filter(x=>!(x.roomId===r.roomId&&x.senderId===r.senderId&&x.id!==r.id&&x.isStreaming&&!x.content?.trim()&&!x.reasoning?.trim()&&!x.tool_calls?.length)),r.isStreaming=!0,r.firstSeenAt=r.firstSeenAt??r.timestamp??Date.now();const m=n.value.findIndex(x=>x.id===r.id);if(m>=0){const x=n.value[m];if(!x.isStreaming)return;n.value[m]={...x,...r,content:Ae(r.content)?r.content:x.content||"",reasoning:Ae(r.reasoning)?r.reasoning:x.reasoning,reasoning_content:Ae(r.reasoning_content)?r.reasoning_content:x.reasoning_content,isStreaming:!0},n.value=[...n.value]}else n.value.push(r),M.value+=1,D.value=Math.max(D.value+1,M.value)}),k.on("message_stream_delta",r=>{if(r.roomId!==e.value)return;const m=n.value.findIndex(x=>x.id===r.id);m<0||!n.value[m].isStreaming||(n.value[m]={...n.value[m],content:n.value[m].content+r.delta},n.value=[...n.value])}),k.on("message_reasoning_delta",r=>{if(r.roomId!==e.value)return;const m=n.value.findIndex(x=>x.id===r.id);m<0||!n.value[m].isStreaming||(n.value[m]={...n.value[m],reasoning:(n.value[m].reasoning||"")+r.delta,reasoning_content:(n.value[m].reasoning_content||"")+r.delta,isStreaming:!0},n.value=[...n.value])}),k.on("message_stream_end",r=>{if(r.roomId!==e.value)return;const m=n.value.findIndex(x=>x.id===r.id);m>=0&&!n.value[m].content?.trim()&&!n.value[m].reasoning?.trim()&&!n.value[m].tool_calls?.length?n.value.splice(m,1):m>=0&&(n.value[m]={...n.value[m],isStreaming:!1},n.value=[...n.value],gt(n.value[m])&&re(r.roomId,r.id))}),k.on("member_joined",r=>{r.roomId===e.value&&(i.value=r.members)}),k.on("member_left",r=>{r.roomId===e.value&&(i.value=r.members)}),k.on("typing",r=>{if(r.roomId===e.value&&!A.value.has(r.userId)){const m=setTimeout(()=>A.value.delete(r.userId),5e3);A.value.set(r.userId,{name:r.userName,timer:m})}}),k.on("stop_typing",r=>{if(r.roomId===e.value&&A.value.has(r.userId)){const m=A.value.get(r.userId);clearTimeout(m.timer),A.value.delete(r.userId)}}),k.on("context_status",r=>{r.roomId===e.value&&(r.status==="ready"?(R.value.delete(r.agentName),n.value=n.value.map(m=>m.senderName===r.agentName&&m.isStreaming?{...m,isStreaming:!1}:m).filter(m=>!(m.senderName===r.agentName&&!m.content?.trim()&&!m.reasoning?.trim()&&!m.tool_calls?.length))):R.value.set(r.agentName,{agentName:r.agentName,status:r.status}),R.value=new Map(R.value))}),k.on("approval.requested",r=>{if(!r.approval_id)return;const m=r.description||"",x=m.trim().toLowerCase().replace(/\s+/g," "),Z=!r.allow_permanent&&(x==="save to memory"||x.startsWith("save to memory:")||x.startsWith("save to memory?")),a=(Array.isArray(r.choices)?r.choices:["once","session","deny"]).filter(l=>l==="once"||l==="session"||l==="always"||l==="deny");U.value.set(r.approval_id,{roomId:r.roomId,agentName:r.agentName||"",approvalId:r.approval_id,command:r.command||"",description:m,choices:Z?["once","deny"]:a.length?a:["once","session","deny"],allowPermanent:!!r.allow_permanent,isMemoryWrite:Z,requestedAt:Date.now()}),U.value=new Map(U.value)}),k.on("approval.resolved",r=>{r.approval_id&&(U.value.delete(r.approval_id),U.value=new Map(U.value))}),k.on("room_updated",r=>{const m=d.value.find(x=>x.id===r.roomId);m&&(m.totalTokens=r.totalTokens)}),k.on("room_cleared",r=>{const m=d.value.find(x=>x.id===r.roomId);m&&(m.totalTokens=r.totalTokens),r.roomId===e.value&&(n.value=[],oe(),A.value.clear(),R.value.clear(),U.value.clear())})}function j(){ur(),v.value=!1,e.value=null,n.value=[],oe(),i.value=[],p.value=[],h.value="",A.value.clear(),R.value.clear(),U.value.clear()}function Y(c,C){Q.value=c,localStorage.setItem("gc_user_name",c),localStorage.setItem("gc_user_description",C)}async function ge(c){L.value=!0,P.value=null;try{const C=await mt(c);e.value=C.room.id,h.value=C.room.name,n.value=C.messages,W(C),p.value=C.agents,i.value=C.members||[]}catch(C){throw P.value=C.message,C}finally{L.value=!1}await ie(c)}async function Ie(){const c=e.value;if(!c||O.value||!S.value)return!1;const C=M.value;if(C>=600)return!1;O.value=!0;try{const k=await mt(c,{offset:C,limit:Math.min(150,600-C)}),r=new Set(n.value.map(x=>x.id)),m=k.messages.filter(x=>!r.has(x.id));return n.value=[...m,...n.value],M.value=C+k.messages.length,D.value=k.total??D.value,S.value=k.hasMore??M.value<D.value,m.length>0}catch(k){return P.value=k.message,!1}finally{O.value=!1}}async function ke(c,C){const k=Ye();if(!k||!e.value)return;xe();const r=br();let m=c.trim();if(C?.length){const x=await kr(C);m=wr(c,C,x);const Z=new Map(x.map(a=>[a.name,es(xr(a.path),a.name)]));n.value.push({id:r,roomId:e.value,senderId:q.value,senderName:Q.value||"You",content:JSON.stringify(m),timestamp:Date.now(),role:"user",attachments:C.map(a=>({...a,url:Z.get(a.name)||a.url,file:void 0}))}),M.value+=1,D.value=Math.max(D.value+1,M.value)}return new Promise((x,Z)=>{k.emit("message",{roomId:e.value,id:r,content:m},a=>{if(a.error){n.value=n.value.filter(l=>l.id!==r),Z(new Error(a.error));return}x()})})}async function Me(){try{d.value=(await vr()).rooms}catch(c){P.value=c.message}}async function we(c,C,k,r){try{const m=await cr({name:c,inviteCode:C,agents:k,compression:r||{triggerTokens:1e5,maxHistoryTokens:32e3,tailMessageCount:10}});return d.value.push(m.room),m}catch(m){throw P.value=m.message,m}}async function Te(c){try{const C=await mr(c);return await ge(C.room.id),C.room}catch(C){throw P.value=C.message,C}}async function Ee(c){try{await hr(c),d.value=d.value.filter(C=>C.id!==c),e.value===c&&(e.value=null,n.value=[],oe(),i.value=[],p.value=[],h.value="")}catch(C){throw P.value=C.message,C}}async function $e(c,C){try{const k=await dr(c,C);return d.value.push(k.room),k}catch(k){throw P.value=k.message,k}}async function be(){if(e.value)try{const c=await _r(e.value);n.value=[],oe(),A.value.clear(),R.value.clear();const C=d.value.findIndex(k=>k.id===e.value);return C>=0&&c.room&&(d.value[C]=c.room),c}catch(c){throw P.value=c.message,c}}async function fe(c){try{p.value=(await gr(c)).agents}catch{}}async function Ue(c,C){try{const k=await pr(c,C);return p.value.push(k.agent),k.agent}catch(k){throw P.value=k.message,k}}async function Fe(c,C){try{const k=await fr(c,C);p.value=k.agents??p.value.filter(r=>r.id!==C&&r.agentId!==C),k.members&&(i.value=k.members)}catch(k){throw P.value=k.message,k}}let de=null;function he(){const c=Ye();!c||!e.value||(c.emit("typing",{roomId:e.value}),de&&clearTimeout(de),de=setTimeout(()=>xe(),4e3))}function xe(){const c=Ye();!c||!e.value||(c.emit("stop_typing",{roomId:e.value}),de&&(clearTimeout(de),de=null))}async function Oe(c){const C=Ye();!C||!e.value||await new Promise((k,r)=>{C.emit("interrupt_agent",{roomId:e.value,agentName:c},m=>{m?.error?r(new Error(m.error)):k()})})}async function se(c){const C=Ye(),k=le.value;!C||!k||(await new Promise((r,m)=>{C.emit("approval.respond",{roomId:k.roomId,approval_id:k.approvalId,choice:c},x=>{x?.error?m(new Error(x.error)):r()})}),U.value.delete(k.approvalId),U.value=new Map(U.value))}return{connected:v,currentRoomId:e,rooms:d,messages:n,members:i,agents:p,roomName:h,isJoining:L,error:P,contextStatus:Ce,contextStatuses:R,pendingApprovals:U,activePendingApproval:le,autoPlaySpeechEnabled:F,totalMessages:D,loadedMessageCount:M,hasMoreBefore:S,isLoadingOlderMessages:O,hasReachedMessageDisplayLimit:H,userId:q,userName:Q,currentUserAvatar:ae,sortedMessages:G,memberNames:pe,typingNames:ue,typingText:ne,connect:ce,disconnect:j,setUserInfo:Y,setAutoPlaySpeech:ye,joinRoom:ge,loadOlderMessages:Ie,sendMessage:ke,loadRooms:Me,emitTyping:he,emitStopTyping:xe,interruptAgent:Oe,respondApproval:se,createNewRoom:we,joinByCode:Te,deleteRoom:Ee,cloneRoom:$e,clearCurrentRoomContext:be,loadAgents:fe,addAgentToRoom:Ue,removeAgentFromRoom:Fe}})})),Nt,Pt,Dt,Bt,Lt,Et,Ut,Ft,Ot,zt,Ht,Gt,Vt,jt,Jt,Kt,Wt,Yt,Xt,qt,Zt,Qt,ea,ta,aa,oa,na,sa,ra,la,ia,ua,ca,da,va,ma,pa,ga,fa,De,ht,ha,_a,ya,Ca,nt,rs,ka=V((()=>{Je(),tt(),it(),Qs(),Qn(),Xn(),tr(),Rs(),Gs(),js(),Js(),ts(),Fs(),Nt={key:0,class:"group-message tool-message"},Pt={class:"avatar"},Dt={class:"msg-body"},Bt={class:"msg-header"},Lt={class:"sender-name"},Et={key:0,class:"agent-desc"},Ut={key:1,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"tool-icon"},Ft={class:"tool-name"},Ot={key:2,class:"tool-preview"},zt={key:3,class:"tool-spinner"},Ht={key:4,class:"tool-error-badge"},Gt={key:0,class:"tool-detail-section","data-copy-source":"tool-args"},Vt={class:"tool-detail-label"},jt=["innerHTML"],Jt={key:1,class:"tool-detail-section","data-copy-source":"tool-result"},Kt={class:"tool-detail-label"},Wt=["innerHTML"],Yt={class:"msg-time"},Xt={class:"avatar"},qt={class:"msg-body"},Zt={class:"msg-header"},Qt={class:"sender-name"},ea={key:0,class:"agent-desc"},ta={key:0,class:"msg-attachments"},aa=["src","alt","onClick"],oa=["href","title"],na={class:"att-name"},sa={class:"att-size"},ra={class:"thinking-label"},la={class:"thinking-meta"},ia={key:0,class:"thinking-body"},ua={key:3,class:"streaming-dots"},ca={class:"message-meta"},da=["title"],va={key:0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ma={key:1,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},pa=["title"],ga={class:"message-time"},fa=["src"],De=1e3,ht=200,ha=6,_a=1e3,ya=50,Ca=50,nt="__truncated__",rs=je({__name:"GroupMessageItem",props:{message:{},agents:{},members:{},currentUserId:{}},setup(v){const e=v,{t:d}=at(),n=Gn(),i=Yn(),p=Vs(),h=Hs(),L=b(null),P=T(()=>e.agents.some(a=>a.agentId===e.message.senderId||a.name===e.message.senderName)),A=T(()=>e.message.role!=="assistant"?!1:e.message.finish_reason==="error"?!0:/^Error:\s*/i.test(e.message.content||"")),R=T(()=>!!e.currentUserId&&e.message.senderId===e.currentUserId),F=T(()=>e.agents.find(a=>a.agentId===e.message.senderId||a.name===e.message.senderName)),U=T(()=>zs(e.message.timestamp)),D=T(()=>F.value?.profile||e.message.senderName||e.message.senderId),M=T(()=>i.profiles.find(a=>a.name===F.value?.profile)),S=T(()=>P.value?null:e.members?.find(a=>a.userId===e.message.senderId||a.name===e.message.senderName)||null),O=T(()=>{const a=S.value?.avatar;if(!a)return null;try{const l=typeof a=="string"?JSON.parse(a):a;if(l&&l.type==="image"&&l.dataUrl)return l}catch{}return null}),H=T(()=>P.value?M.value?.avatar??null:O.value),ae=T(()=>P.value?D.value:e.message.senderName||e.message.senderId||"user"),oe=T(()=>["all",...e.agents.map(a=>a.name).filter(Boolean)]),W=T(()=>As(e.message.content||"",{streaming:!!e.message.isStreaming})),ye=T(()=>!!(e.message.reasoning&&e.message.reasoning.length>0)),Ne=T(()=>ye.value||W.value.hasThinking),ee=T(()=>{const a=[];return e.message.reasoning&&a.push(e.message.reasoning),a.push(...W.value.segments),W.value.pending&&a.push(W.value.pending),a.join(`
|
|
2
2
|
|
|
3
3
|
`)}),re=T(()=>{let a=Bs(W.value);return e.message.reasoning&&(a+=e.message.reasoning.length),a}),Ce=T(()=>e.message.isStreaming?!!(W.value.pending!==null||ye.value&&!e.message.content):!1),le=b(null),q=T(()=>Ce.value?!0:le.value!==null?le.value:!1),Q=T(()=>W.value.body||e.message.content||""),z=T(()=>{const a=(e.message.content||"").trim();if(!a.startsWith("[")||!a.endsWith("]"))return null;try{const l=JSON.parse(a);return Array.isArray(l)?l:null}catch{return null}}),ie=T(()=>{if(e.message.attachments?.length)return e.message.attachments;const a=z.value;return a?a.flatMap((l,f)=>{if(l?.type!=="image"&&l?.type!=="file")return[];const N=String(l.path||"");if(!N)return[];const u=String(l.name||`${l.type}-${f+1}`);return[{id:`${e.message.id}_attachment_${f}`,name:u,type:l.type==="image"?String(l.media_type||"image/*"):String(l.media_type||"application/octet-stream"),size:0,url:es(m(N),u)}]}):[]}),G=T(()=>ie.value.length>0),pe=T(()=>{if(e.message.role!=="user")return Q.value;const a=z.value;return a?a.filter(l=>l?.type==="text"&&typeof l.text=="string").map(l=>l.text).join(`
|
|
4
4
|
`):Q.value}),ue=T(()=>{if(ce.value)return null;const a=pe.value||"";return a.trim()?a:null}),ne=b(!1),ce=T(()=>e.message.role==="tool"),j=T(()=>he(e.message.toolArgs)),Y=T(()=>he(e.message.toolResult,!0)),ge=T(()=>!!(j.value.full||Y.value.full)),Ie=T(()=>j.value.full),ke=T(()=>j.value.display),Me=T(()=>Y.value.full),we=T(()=>Y.value.display),Te=T(()=>ke.value?xe(ke.value,j.value.language):""),Ee=T(()=>we.value?xe(we.value,Y.value.language):""),$e=T(()=>e.message.role!=="assistant"||!Q.value.trim()?!1:h.provider.value==="openai"||h.provider.value==="custom"||h.provider.value==="edge"||h.provider.value==="mimo"?!0:p.isSupported),be=T(()=>h.provider.value==="openai"||h.provider.value==="custom"||h.provider.value==="edge"||h.provider.value==="mimo"?p.currentCustomMessageId.value===e.message.id&&p.isCustomPlaying.value:p.currentMessageId.value===e.message.id&&p.isPlaying.value),fe=T(()=>h.provider.value==="openai"||h.provider.value==="custom"||h.provider.value==="edge"||h.provider.value==="mimo"?p.currentCustomMessageId.value===e.message.id&&p.isCustomPaused.value:p.currentMessageId.value===e.message.id&&p.isPaused.value);function Ue(a,l){return a.length>ht?a.slice(0,ht)+`
|
package/dist/client/assets/js/{HistoryMessageList-IubX9-tb.js → HistoryMessageList-BcG-gj6N.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as b}from"./rolldown-runtime-M0oDzQ_3.js";import{Bn as r,Dn as U,Hn as M,Kt as $,an as l,cn as d,cr as p,er as B,hn as z,in as S,jn as u,kn as G,on as J,pn as Q,pr as W,sn as k,wn as c}from"./ui-vendor-DDMfmCj2.js";import{O as X,k as Y}from"./vue-vendor-BsMpqyaC.js";import{n as Z,t as ee}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{n as b}from"./rolldown-runtime-M0oDzQ_3.js";import{Bn as r,Dn as U,Hn as M,Kt as $,an as l,cn as d,cr as p,er as B,hn as z,in as S,jn as u,kn as G,on as J,pn as Q,pr as W,sn as k,wn as c}from"./ui-vendor-DDMfmCj2.js";import{O as X,k as Y}from"./vue-vendor-BsMpqyaC.js";import{n as Z,t as ee}from"./_plugin-vue_export-helper-CvnFozKy.js";import{E as se,T as te}from"./index-B2IKGvbR.js";import{a as oe,i as ae,o as ie,r as le}from"./chat-timestamp-CkDNtK9Y.js";import{n as ne,t as re}from"./MessageItem-Cu3_aQT8.js";var x,I,H,C,N,T,P,O=b((()=>{$(),X(),ae(),ne(),te(),oe(),x={class:"history-message-list-shell"},I={class:"empty-state"},H={key:0,class:"history-loader"},C={key:0,class:"history-loader-spinner"},N=["aria-label","title"],T=new Map,P=z({__name:"HistoryMessageList",props:{session:{},loadOlder:{type:Function}},setup(R,{expose:j}){const f=R,_=se(),{toolTraceVisible:A}=ie(),{t:m}=Y(),o=B(null),a=B(null),v=B(!1),t=S(()=>f.session||null),D=S(()=>t.value?.id?`history-${t.value.id}`:"history-empty"),g=S(()=>(t.value?.messages||[]).filter(e=>e.role==="tool"?A.value&&!!e.toolName:!!e.content?.trim()));function h(e=200){return o.value?.isNearBottom(e)??!0}function i(){o.value?.scrollToBottom(),v.value=!1}function y(e){o.value?.scrollToMessage(e)}function E(e,s){o.value?.scrollToAnchor(e,s)}function n(){v.value=g.value.length>0&&!h(1e3)}function K(){n()}function q(){i()}function w(e){if(!e)return;const s=o.value?.captureViewportPosition()??null;s&&T.set(e,s)}function L(e){if(t.value?.id!==e)return;if(_.focusMessageId){a.value=null,y(_.focusMessageId);return}const s=T.get(e);if(s){a.value=null,s.wasNearBottom?i():o.value?.restoreViewportPosition(s);return}i(),(t.value?.messages.length||0)>0&&(a.value=null)}async function F(){const e=t.value;if(!e?.hasMoreBefore||e.isLoadingOlderMessages||!f.loadOlder)return;const s=o.value?.captureScrollPosition()??null;await f.loadOlder(e.id)&&(await c(),o.value?.restoreScrollPosition(s),n())}return r(()=>t.value?.id,async(e,s)=>{w(s),e&&(a.value=e,await c(),L(e))},{immediate:!0}),r(()=>_.focusMessageId,e=>{e&&y(e)}),r(()=>(t.value?.messages||[])[(t.value?.messages||[]).length-1]?.content,e=>{a.value!==t.value?.id&&e&&h()&&i()}),r(()=>(t.value?.messages||[]).length,e=>{if(e===0)return;const s=t.value?.id;if(s&&a.value===s){L(s);return}h()&&(i(),c(n))},{flush:"post"}),r(()=>g.value.length,()=>{c(n)},{flush:"post"}),U(()=>{w(t.value?.id)}),G(()=>{c(n)}),j({scrollToBottom:i,scrollToMessage:y,scrollToAnchor:E}),(e,s)=>(u(),d("div",x,[(u(),J(le,{key:D.value,ref_key:"listRef",ref:o,messages:g.value,onScroll:K,onTopReach:F},{empty:M(()=>[l("div",I,[s[0]||(s[0]=l("img",{src:"/coding-agents/hermes.png",alt:"Hermes",class:"empty-logo"},null,-1)),l("p",null,W(p(m)("chat.emptyState")),1)])]),before:M(()=>[t.value?.hasMoreBefore||t.value?.isLoadingOlderMessages?(u(),d("div",H,[t.value?.isLoadingOlderMessages?(u(),d("span",C)):k("",!0)])):k("",!0)]),item:M(({message:V})=>[Q(re,{message:V,highlight:p(_).focusMessageId===V.id},null,8,["message","highlight"])]),_:1},8,["messages"])),v.value?(u(),d("button",{key:0,type:"button",class:"scroll-bottom-button","aria-label":p(m)("chat.scrollToBottom"),title:p(m)("chat.scrollToBottom"),onClick:q},[...s[1]||(s[1]=[l("svg",{class:"scroll-bottom-icon",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[l("path",{d:"m7 10 5 5 5-5"}),l("path",{d:"M6 19h12"})],-1)])],8,N)):k("",!0)]))}})})),ue=b((()=>{})),ce,Be=b((()=>{O(),O(),ue(),Z(),ce=ee(P,[["__scopeId","data-v-0234602e"]])}));export{Be as n,ce as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as ne}from"./rolldown-runtime-M0oDzQ_3.js";import{An as Mt,Bn as Y,Hn as S,Kt as Ct,Nn as se,Ot as I,V as Bt,an as a,cn as y,cr as u,er as v,fn as oe,hn as Pt,in as g,jn as d,kn as At,nt as Tt,on as H,ot as Ce,pn as P,pr as k,sn as b,t as Ht,tn as q,ur as ae,w as It}from"./ui-vendor-DDMfmCj2.js";import{M as Dt,N as Lt,O as Nt,P as Ot,k as $t}from"./vue-vendor-BsMpqyaC.js";import{n as Vt,t as qt}from"./_plugin-vue_export-helper-fFMkIM4P.js";import{Dt as Ft,Et as zt,Ot as Et,St as Rt,T as Jt,_t as Ut,ct as Kt,ft as Wt,ht as Be,kt as Gt,lt as Yt,pt as jt,vt as Xt}from"./index-Brl4qW5V.js";import{n as Qt,t as Zt}from"./session-browser-prefs-BOqwOeHi.js";import{n as es,t as Pe}from"./clipboard-1NPxC3YL.js";import{i as ts,n as ss,o as Ae,r as Te,s as os,t as as}from"./OutlinePanel-BofcYepl.js";import{i as is,r as ns}from"./SettingsCircuitBadge-CFo2KqP-.js";import{n as ls,t as rs}from"./HistoryMessageList-IubX9-tb.js";import{n as us,t as cs}from"./PageSidebarFooter-BPeWlPvZ.js";var He,Ie,De,Le,Ne,Oe,$e,Ve,qe,Fe,ze,Ee,Re,Je,Ue,Ke,We,Ge,Ye,je,Xe,Qe,Ze,ie,tt,et=ne((()=>{Ct(),Dt(),Jt(),Et(),zt(),Zt(),Ht(),Nt(),os(),es(),ls(),ts(),ss(),is(),us(),Xt(),He={class:"history-panel"},Ie={key:0,class:"page-sidebar-top"},De={class:"session-list-toolbar"},Le={class:"session-list-title"},Ne={class:"session-list-actions"},Oe={key:1,class:"session-items"},$e={key:0,class:"session-loading"},Ve={key:1,class:"session-empty"},qe={class:"session-group-header session-group-header--static"},Fe={class:"session-group-label"},ze={class:"session-group-count"},Ee=["onClick"],Re={class:"session-group-label"},Je={class:"session-group-count"},Ue={class:"chat-main"},Ke={class:"chat-header"},We={class:"header-left"},Ge={class:"header-session-title"},Ye={key:0,class:"source-badge"},je=["title"],Xe={class:"header-actions"},Qe={class:"history-content-wrapper"},Ze={class:"history-main-content"},ie=150,tt=Pt({__name:"HistoryView",setup(ps){const st=Gt(),F=Ft(),D=Qt(),h=Bt(),{t:i}=$t(),le=Lt(),B=Ot(),z=g(()=>{const e=le.params.sessionId;return typeof e=="string"&&e.trim()?e:null}),O=g(()=>{const e=le.query.profile;return typeof e=="string"&&e.trim()?e:null}),ot=g(()=>F.activeProfileName||O.value||null),_=v([]),j=v(!1),E=v(!1),f=v(null),n=v(null),R=v(!1),re=v(null),x=v(!1),w=v(!1),L=v(!1),c=v(new Set),M=v(null),J=v(!1),ue=v(0),ce=v(0);let X=0;function at(e){re.value?.scrollToAnchor(e.messageId,e.anchorId),de.value&&(R.value=!1)}function it(){B.push({name:"hermes.chat"})}async function N(){const e=++X;j.value=!0;try{const t=await jt(void 0,void 0,ot.value);if(e!==X)return;_.value=t,E.value=!0}catch(t){console.error("Failed to load Hermes sessions:",t)}finally{e===X&&(j.value=!1)}}const m=v(typeof window>"u"||!window.matchMedia("(max-width: 768px)").matches);let $=null;const de=v(!1);function A(e){return _.value.find(t=>t.id===e)}const Q=g(()=>M.value&&A(M.value)||null),nt=g(()=>M.value?D.isPinned(M.value):!1),lt=g(()=>[{label:i("chat.importToWebUi"),key:"import-webui",disabled:!!Q.value?.webui_imported},{label:i(nt.value?"chat.unpin":"chat.pin"),key:"pin"},...Q.value?.is_archived?[{label:i("chat.unarchiveSession"),key:"unarchive"}]:[],{label:i("chat.copySessionLink"),key:"copy-link"},{label:i("chat.copySessionId"),key:"copy-id"}]);function ve(e){return(e.role==="moa"||e.display_role==="tool")&&(e.tool_name==="moa_reference"||e.tool_name==="moa_aggregating")}function rt(e,t){if(e!=="moa_reference"&&e!=="moa_aggregating")return null;const o=typeof t=="string"?(()=>{try{return JSON.parse(t)}catch{return null}})():t;if(!o||typeof o!="object")return null;const s=o;return{preview:typeof s.preview=="string"?s.preview:typeof s.label=="string"?s.label:typeof s.aggregator=="string"?s.aggregator:void 0,result:s.text??s.result}}function Z(e){return e.map(t=>{const o=ve(t)?"tool":t.display_role||t.role,s={id:String(t.id),role:o==="moa"?"system":o,content:t.content||"",timestamp:t.timestamp*1e3,reasoning:t.reasoning||void 0,systemType:o==="command"?"command":void 0};if(t.role==="tool"||ve(t)){const r=rt(t.tool_name,t.content);s.toolName=t.tool_name||void 0,s.toolCallId=t.tool_call_id||void 0,s.toolArgs=t.tool_calls?.[0]?.function?.arguments?JSON.stringify(t.tool_calls[0].function.arguments):void 0,s.toolPreview=r?.preview,s.toolStatus="done",s.toolResult=r?r.result:t.content||void 0,s.content=""}return s})}function fe(e){const t=e.source==="coding_agent"||e.agent==="claude"||e.agent==="codex";return{agent:e.agent||void 0,agentSessionId:e.agent_session_id||void 0,agentNativeSessionId:e.agent_native_session_id||void 0,codingAgentId:e.agent==="codex"?"codex":e.agent==="claude"?"claude-code":void 0,codingAgentMode:t?e.agent_mode==="global"||e.agent_mode==="scoped"?e.agent_mode:e.provider==="global"?"global":"scoped":void 0}}function ut(e,t=[]){return{id:e.id,profile:e.profile||void 0,title:e.title||"",source:e.source,...fe(e),createdAt:e.started_at*1e3,updatedAt:(e.last_active||e.ended_at||e.started_at)*1e3,model:e.model,provider:e.provider,messageCount:e.message_count,messageTotal:e.message_count,loadedMessageCount:t.length,hasMoreBefore:!1,inputTokens:e.input_tokens,outputTokens:e.output_tokens,endedAt:e.ended_at?e.ended_at*1e3:void 0,lastActiveAt:e.last_active?e.last_active*1e3:void 0,isArchived:!!e.is_archived,workspace:e.workspace||void 0,messages:t}}async function ct(e,t){const o=A(e),s=t||o?.profile||null,r=await Be(e,0,ie,s);let C=null;if(r)C=ut(o||r.session,Z(r.messages)),C.profile=o?.profile||s||void 0,C.messageCount=r.total,C.messageTotal=r.total,C.loadedMessageCount=r.messages.length,C.hasMoreBefore=r.hasMore;else{const l=await Wt(e,s);if(!l){h.error(i("chat.sessionNotFound"));return}C={id:l.id,profile:l.profile||s||void 0,title:l.title||"",source:l.source,createdAt:l.started_at*1e3,updatedAt:(l.last_active||l.started_at)*1e3,model:l.model,provider:l.provider,messageCount:l.message_count,messageTotal:l.message_count,loadedMessageCount:l.messages.length,hasMoreBefore:!1,inputTokens:l.input_tokens,outputTokens:l.output_tokens,endedAt:l.ended_at?l.ended_at*1e3:void 0,lastActiveAt:l.last_active?l.last_active*1e3:void 0,workspace:l.workspace||void 0,messages:Z(l.messages)}}f.value=C.id,n.value=C,$?.matches&&(m.value=!1)}async function dt(e){const t=n.value;if(!t||t.id!==e||t.isLoadingOlderMessages||!t.hasMoreBefore)return!1;const o=t.loadedMessageCount||0;t.isLoadingOlderMessages=!0;try{const s=await Be(e,o,ie,t.profile);if(!s||s.messages.length===0)return t.hasMoreBefore=!1,!1;const r=new Set(t.messages.map(l=>l.id)),C=Z(s.messages).filter(l=>!r.has(l.id));return t.messages=[...C,...t.messages],t.loadedMessageCount=o+s.messages.length,t.messageTotal=s.total,t.messageCount=s.total,t.hasMoreBefore=s.hasMore,C.length>0}catch(s){return console.error("Failed to load older history messages:",s),!1}finally{t.isLoadingOlderMessages=!1}}async function U(e,t){await B.push({name:"hermes.historySession",params:{sessionId:e},query:t?{profile:t}:void 0})}async function K(e=!1){const t=_.value.find(s=>s.source==="cli")||_.value[0];if(!t){f.value=null,n.value=null,z.value&&await B.replace({name:"hermes.history"});return}p.value.has(t.source)&&(p.value=new Set([...p.value].filter(s=>s!==t.source)));const o={name:"hermes.historySession",params:{sessionId:t.id},query:t.profile?{profile:t.profile}:void 0};e?await B.replace(o):await B.push(o)}async function pe(){const e=z.value;if(!e)return;if(!_.value.some(s=>s.id===e)){f.value=null,n.value=null,await B.replace({name:"hermes.history"});return}const t=O.value||A(e)?.profile||null,o=n.value?.profile||null;(f.value!==e||o!==t)&&(f.value=e,n.value=null,await ct(e,t))}function ee(e){de.value=e.matches,e.matches&&m.value&&(m.value=!1)}function he(){m.value=!0}At(async()=>{st.loadModels(),await F.fetchProfiles(),await N(),await pe(),$=window.matchMedia("(max-width: 768px)"),ee($),$.addEventListener("change",ee),window.addEventListener("hermes:open-page-sidebar",he)}),Mt(()=>{$?.removeEventListener("change",ee),window.removeEventListener("hermes:open-page-sidebar",he)}),Y([z,O],async([e])=>{if(!e){f.value=null,n.value=null;return}E.value&&(O.value&&!_.value.some(t=>t.profile===O.value)&&await N(),await pe())}),Y(()=>F.activeProfileName,async()=>{E.value&&(F.switching||(f.value=null,n.value=null,await N(),await K(!0)))});const p=v(new Set(JSON.parse(localStorage.getItem("hermes_collapsed_groups")||"[]")));function vt(e){return{id:e.id,profile:e.profile||void 0,title:e.title||"",source:e.source,...fe(e),createdAt:e.started_at*1e3,updatedAt:(e.last_active||e.started_at)*1e3,model:e.model,provider:e.provider,messageCount:e.message_count,inputTokens:e.input_tokens,outputTokens:e.output_tokens,endedAt:e.ended_at?e.ended_at*1e3:void 0,lastActiveAt:e.last_active?e.last_active*1e3:void 0,isArchived:!!e.is_archived,workspace:e.workspace||void 0,messages:[]}}const T=g(()=>_.value.map(vt));function V(e){return`${e.profile||"default"}\0${e.id}`}function ge(){w.value||(x.value=!x.value,x.value||(c.value.clear(),L.value=!1))}function W(e){if(w.value)return;const t=V(e);c.value.has(t)?c.value.delete(t):c.value.add(t),c.value=new Set(c.value),c.value.size===0&&(L.value=!1)}function _e(e){return c.value.has(V(e))}function ft(){if(!w.value){if(me.value){c.value.clear(),c.value=new Set(c.value),L.value=!1;return}c.value.clear();for(const e of T.value)c.value.add(V(e));c.value=new Set(c.value)}}const we=g(()=>c.value.size),pt=g(()=>T.value.length>0),me=g(()=>T.value.length>0&&c.value.size===T.value.length);function Se(e){return e==="api_server"?-1:e==="cron"?999:0}function ye(e){return[...e].sort((t,o)=>(o.updatedAt||0)-(t.updatedAt||0))}const te=g(()=>ye(T.value.filter(e=>D.isPinned(e.id)))),G=g(()=>{const e=new Map;for(const t of T.value){if(D.isPinned(t.id))continue;const o=t.source||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}return[...e.keys()].sort((t,o)=>{const s=Se(t),r=Se(o);return s!==r?s-r:t.localeCompare(o)}).map(t=>({source:t,label:t?Ae(t):i("chat.other"),sessions:ye(e.get(t))}))});function ht(e){if(!p.value.has(e))p.value=new Set([...p.value,e]);else{p.value=new Set(G.value.map(o=>o.source).filter(o=>o!==e));const t=G.value.find(o=>o.source===e);t?.sessions.length&&U(t.sessions[0].id,t.sessions[0].profile)}localStorage.setItem("hermes_collapsed_groups",JSON.stringify([...p.value]))}Y(G,e=>{if(localStorage.getItem("hermes_collapsed_groups")!==null){const t=n.value?.source;t&&p.value.has(t)&&(p.value=new Set([...p.value].filter(o=>o!==t)),localStorage.setItem("hermes_collapsed_groups",JSON.stringify([...p.value])));return}e.length>0&&(p.value=new Set(e.slice(1).map(t=>t.source)),localStorage.setItem("hermes_collapsed_groups",JSON.stringify([...p.value])))},{once:!0}),Y(E,e=>{e&&_.value.length>0&&!z.value&&K(!1)},{once:!0});const gt=g(()=>n.value?.title||i("chat.newChat")),ke=g(()=>n.value?.source||"");async function be(e){const t=e||f.value;t&&(await Pe(t)?h.success(i("common.copied")):h.error(i("common.copied")+" ✗"))}function _t(e){return n.value?.id===e?n.value.profile||null:A(e)?.profile||null}function wt(e,t){const o=B.resolve({name:"hermes.historySession",params:{sessionId:e},query:t?{profile:t}:void 0}).href;return`${window.location.origin}${window.location.pathname}${o}`}async function mt(e){const t=e||f.value;t&&(await Pe(wt(t,_t(t)))?h.success(i("common.copied")):h.error(i("common.copied")+" ✗"))}function xe(e,t){e.preventDefault(),M.value=t,J.value=!0,ue.value=e.clientX,ce.value=e.clientY}function St(){J.value=!1}async function yt(e){const t=A(e);try{const o=await Ut(e,t?.profile||null);if(o.ok){h.success(i(o.imported?"chat.importSessionSuccess":"chat.importSessionAlreadyExists")),await N();return}}catch{}h.error(i("chat.importSessionFailed"))}async function kt(e){if(J.value=!1,!!M.value){if(e==="pin")D.togglePinned(M.value);else if(e==="copy-link")await mt(M.value);else if(e==="copy-id")await be(M.value);else if(e==="import-webui")await yt(M.value);else if(e==="unarchive"){if(!Q.value?.is_archived)return;if(!await Rt(M.value)){h.error(i("chat.unarchiveSessionFailed"));return}h.success(i("chat.sessionUnarchived")),await N(),A(M.value)||(f.value=null,n.value=null,await B.replace({name:"hermes.history"}),await K(!0))}}}async function Me(e,t){const o=A(e);if(!await Yt(e,t||o?.profile||null)){h.error(i("common.deleteFailed"));return}if(D.removePinned(e),_.value=_.value.filter(s=>s.id!==e),f.value===e){f.value=null,n.value=null;const s=T.value[0];s?await U(s.id,s.profile):await B.replace({name:"hermes.history"})}h.success(i("chat.sessionDeleted"))}async function bt(){if(c.value.size===0||w.value)return;const e=new Map(T.value.map(s=>[V(s),s])),t=Array.from(c.value).map(s=>e.get(s)).filter(s=>!!s).map(s=>({id:s.id,profile:s.profile||null}));if(t.length===0)return;const o=n.value?c.value.has(V(n.value)):!1;w.value=!0;try{const s=await Kt(t);if(s.deleted>0){for(const r of t)D.removePinned(r.id);await N(),(o||f.value&&!A(f.value))&&(f.value=null,n.value=null,await K(!0)),h.success(i("chat.batchDeleteSuccess",{count:s.deleted})),s.failed>0&&h.warning(i("chat.batchDeletePartial",{failed:s.failed}))}else h.error(i("chat.batchDeleteFailed"))}catch{h.error(i("chat.batchDeleteFailed"))}finally{w.value=!1,L.value=!1,x.value=!1,c.value.clear()}}function xt(){return bt(),!1}return(e,t)=>(d(),y("div",He,[a("div",{class:ae(["session-backdrop",{active:m.value}]),onClick:t[0]||(t[0]=o=>m.value=!1)},null,2),a("aside",{class:ae(["session-list",{collapsed:!m.value}])},[m.value?(d(),y("div",Ie,[P(ns,{active:"history","primary-label":u(i)("chat.newChat"),"hide-mode-switch":"",onPrimary:it},null,8,["primary-label"]),a("div",De,[a("span",Le,k(u(i)("chat.hermesHistory")),1),a("div",Ne,[a("button",{class:"session-close-btn",onClick:t[1]||(t[1]=o=>m.value=!1)},[...t[6]||(t[6]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])]),x.value?b("",!0):(d(),H(u(I),{key:0,quaternary:"",size:"tiny",disabled:_.value.length===0,title:u(i)("chat.toggleBatchMode"),onClick:ge},{icon:S(()=>[...t[7]||(t[7]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("path",{d:"M9 11l3 3L22 4"}),a("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})],-1)])]),_:1},8,["disabled","title"])),x.value?(d(),H(u(I),{key:1,quaternary:"",size:"tiny",disabled:!pt.value||w.value,title:me.value?u(i)("common.cancel"):u(i)("chat.selectAll"),onClick:ft},{icon:S(()=>[...t[8]||(t[8]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("path",{d:"M9 11l3 3L22 4"}),a("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})],-1)])]),_:1},8,["disabled","title"])):b("",!0),x.value&&we.value>0?(d(),H(u(It),{key:2,show:L.value,"onUpdate:show":t[2]||(t[2]=o=>L.value=o),"positive-button-props":{loading:w.value,disabled:w.value},"negative-button-props":{disabled:w.value},onPositiveClick:xt},{trigger:S(()=>[P(u(I),{quaternary:"",size:"tiny",type:"error",loading:w.value,disabled:w.value},{icon:S(()=>[...t[9]||(t[9]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("polyline",{points:"3 6 5 6 21 6"}),a("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])]),_:1},8,["loading","disabled"])]),default:S(()=>[oe(" "+k(u(i)("chat.confirmBatchDelete",{count:we.value})),1)]),_:1},8,["show","positive-button-props","negative-button-props"])):b("",!0),x.value?(d(),H(u(I),{key:3,quaternary:"",size:"tiny",disabled:w.value,onClick:ge},{icon:S(()=>[...t[10]||(t[10]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])]),_:1},8,["disabled"])):b("",!0)])])])):b("",!0),m.value?(d(),y("div",Oe,[j.value&&_.value.length===0?(d(),y("div",$e,k(u(i)("common.loading")),1)):_.value.length===0?(d(),y("div",Ve,k(u(i)("chat.noSessions")),1)):b("",!0),te.value.length>0?(d(),y(q,{key:2},[a("div",qe,[a("span",Fe,k(u(i)("chat.pinned")),1),a("span",ze,k(te.value.length),1)]),(d(!0),y(q,null,se(te.value,o=>(d(),H(Te,{key:`pinned-${o.id}`,session:o,active:o.id===f.value,pinned:!0,"can-delete":!0,streaming:!1,selectable:x.value,selected:_e(o),"show-profile":!0,onSelect:s=>x.value?W(o):U(o.id,o.profile),onContextmenu:s=>xe(s,o.id),onDelete:s=>Me(o.id,o.profile),onToggleSelect:s=>W(o)},null,8,["session","active","selectable","selected","onSelect","onContextmenu","onDelete","onToggleSelect"]))),128))],64)):b("",!0),(d(!0),y(q,null,se(G.value,o=>(d(),y(q,{key:o.source},[a("div",{class:"session-group-header",onClick:s=>ht(o.source)},[(d(),y("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:ae(["group-chevron",{collapsed:p.value.has(o.source)}])},[...t[11]||(t[11]=[a("polyline",{points:"9 18 15 12 9 6"},null,-1)])],2)),a("span",Re,k(o.label),1),a("span",Je,k(o.sessions.length),1)],8,Ee),p.value.has(o.source)?b("",!0):(d(!0),y(q,{key:0},se(o.sessions,s=>(d(),H(Te,{key:s.id,session:s,active:s.id===f.value,pinned:!1,"can-delete":!0,streaming:!1,selectable:x.value,selected:_e(s),"show-profile":!0,onSelect:r=>x.value?W(s):U(s.id,s.profile),onContextmenu:r=>xe(r,s.id),onDelete:r=>Me(s.id,s.profile),onToggleSelect:r=>W(s)},null,8,["session","active","selectable","selected","onSelect","onContextmenu","onDelete","onToggleSelect"]))),128))],64))),128))])):b("",!0),m.value?(d(),H(cs,{key:2})):b("",!0)],2),P(u(Tt),{placement:"bottom-start",trigger:"manual",x:ue.value,y:ce.value,options:lt.value,show:J.value,onSelect:kt,onClickoutside:St},null,8,["x","y","options","show"]),a("div",Ue,[a("header",Ke,[a("div",We,[P(u(I),{class:"history-sidebar-toggle",quaternary:"",size:"small",onClick:t[3]||(t[3]=o=>m.value=!m.value),circle:""},{icon:S(()=>[...t[12]||(t[12]=[a("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[a("rect",{x:"3",y:"3",width:"7",height:"7"}),a("rect",{x:"14",y:"3",width:"7",height:"7"}),a("rect",{x:"3",y:"14",width:"7",height:"7"}),a("rect",{x:"14",y:"14",width:"7",height:"7"})],-1)])]),_:1}),a("span",Ge,k(gt.value),1),ke.value?(d(),y("span",Ye,k(u(Ae)(ke.value)),1)):b("",!0),n.value?.workspace?(d(),y("span",{key:1,class:"workspace-badge",title:n.value.workspace},"📁 "+k(n.value.workspace.split("/").pop()||n.value.workspace),9,je)):b("",!0)]),a("div",Xe,[P(u(Ce),{trigger:"hover"},{trigger:S(()=>[P(u(I),{quaternary:"",size:"small",onClick:t[4]||(t[4]=o=>R.value=!R.value),circle:""},{icon:S(()=>[...t[13]||(t[13]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[a("path",{d:"M3 12h18M3 6h18M3 18h18"})],-1)])]),_:1})]),default:S(()=>[oe(" "+k(u(i)("chat.outlineTitle")),1)]),_:1}),P(u(Ce),{trigger:"hover"},{trigger:S(()=>[P(u(I),{quaternary:"",size:"small",onClick:t[5]||(t[5]=o=>be()),circle:""},{icon:S(()=>[...t[14]||(t[14]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[a("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)])]),_:1})]),default:S(()=>[oe(" "+k(u(i)("chat.copySessionId")),1)]),_:1})])]),a("div",Qe,[a("div",Ze,[P(rs,{ref_key:"historyMessageListRef",ref:re,session:n.value,"load-older":dt},null,8,["session"])]),R.value&&n.value?(d(),H(as,{key:0,messages:n.value.messages||[],onNavigate:at},null,8,["messages"])):b("",!0)])])]))}})})),ds=ne((()=>{})),vs,fs=ne((()=>{et(),et(),ds(),Vt(),vs=qt(tt,[["__scopeId","data-v-ec25e11e"]])}));fs();export{vs as default};
|
|
1
|
+
import{n as ne}from"./rolldown-runtime-M0oDzQ_3.js";import{An as Mt,Bn as Y,Hn as S,Kt as Ct,Nn as se,Ot as I,V as Bt,an as a,cn as y,cr as u,er as v,fn as oe,hn as Pt,in as g,jn as d,kn as At,nt as Tt,on as H,ot as Ce,pn as P,pr as k,sn as b,t as Ht,tn as q,ur as ae,w as It}from"./ui-vendor-DDMfmCj2.js";import{M as Dt,N as Lt,O as Nt,P as Ot,k as $t}from"./vue-vendor-BsMpqyaC.js";import{n as Vt,t as qt}from"./_plugin-vue_export-helper-CvnFozKy.js";import{Dt as Ft,Et as zt,Ot as Et,St as Rt,T as Jt,_t as Ut,ct as Kt,ft as Wt,ht as Be,kt as Gt,lt as Yt,pt as jt,vt as Xt}from"./index-B2IKGvbR.js";import{n as Qt,t as Zt}from"./session-browser-prefs-BYjSnxJq.js";import{n as es,t as Pe}from"./clipboard-1NPxC3YL.js";import{i as ts,n as ss,o as Ae,r as Te,s as os,t as as}from"./OutlinePanel-CYuSrNX9.js";import{i as is,r as ns}from"./SettingsCircuitBadge-Eiv8LQz0.js";import{n as ls,t as rs}from"./HistoryMessageList-BcG-gj6N.js";import{n as us,t as cs}from"./PageSidebarFooter-Dk-OfmNy.js";var He,Ie,De,Le,Ne,Oe,$e,Ve,qe,Fe,ze,Ee,Re,Je,Ue,Ke,We,Ge,Ye,je,Xe,Qe,Ze,ie,tt,et=ne((()=>{Ct(),Dt(),Jt(),Et(),zt(),Zt(),Ht(),Nt(),os(),es(),ls(),ts(),ss(),is(),us(),Xt(),He={class:"history-panel"},Ie={key:0,class:"page-sidebar-top"},De={class:"session-list-toolbar"},Le={class:"session-list-title"},Ne={class:"session-list-actions"},Oe={key:1,class:"session-items"},$e={key:0,class:"session-loading"},Ve={key:1,class:"session-empty"},qe={class:"session-group-header session-group-header--static"},Fe={class:"session-group-label"},ze={class:"session-group-count"},Ee=["onClick"],Re={class:"session-group-label"},Je={class:"session-group-count"},Ue={class:"chat-main"},Ke={class:"chat-header"},We={class:"header-left"},Ge={class:"header-session-title"},Ye={key:0,class:"source-badge"},je=["title"],Xe={class:"header-actions"},Qe={class:"history-content-wrapper"},Ze={class:"history-main-content"},ie=150,tt=Pt({__name:"HistoryView",setup(ps){const st=Gt(),F=Ft(),D=Qt(),h=Bt(),{t:i}=$t(),le=Lt(),B=Ot(),z=g(()=>{const e=le.params.sessionId;return typeof e=="string"&&e.trim()?e:null}),O=g(()=>{const e=le.query.profile;return typeof e=="string"&&e.trim()?e:null}),ot=g(()=>F.activeProfileName||O.value||null),_=v([]),j=v(!1),E=v(!1),f=v(null),n=v(null),R=v(!1),re=v(null),x=v(!1),w=v(!1),L=v(!1),c=v(new Set),M=v(null),J=v(!1),ue=v(0),ce=v(0);let X=0;function at(e){re.value?.scrollToAnchor(e.messageId,e.anchorId),de.value&&(R.value=!1)}function it(){B.push({name:"hermes.chat"})}async function N(){const e=++X;j.value=!0;try{const t=await jt(void 0,void 0,ot.value);if(e!==X)return;_.value=t,E.value=!0}catch(t){console.error("Failed to load Hermes sessions:",t)}finally{e===X&&(j.value=!1)}}const m=v(typeof window>"u"||!window.matchMedia("(max-width: 768px)").matches);let $=null;const de=v(!1);function A(e){return _.value.find(t=>t.id===e)}const Q=g(()=>M.value&&A(M.value)||null),nt=g(()=>M.value?D.isPinned(M.value):!1),lt=g(()=>[{label:i("chat.importToWebUi"),key:"import-webui",disabled:!!Q.value?.webui_imported},{label:i(nt.value?"chat.unpin":"chat.pin"),key:"pin"},...Q.value?.is_archived?[{label:i("chat.unarchiveSession"),key:"unarchive"}]:[],{label:i("chat.copySessionLink"),key:"copy-link"},{label:i("chat.copySessionId"),key:"copy-id"}]);function ve(e){return(e.role==="moa"||e.display_role==="tool")&&(e.tool_name==="moa_reference"||e.tool_name==="moa_aggregating")}function rt(e,t){if(e!=="moa_reference"&&e!=="moa_aggregating")return null;const o=typeof t=="string"?(()=>{try{return JSON.parse(t)}catch{return null}})():t;if(!o||typeof o!="object")return null;const s=o;return{preview:typeof s.preview=="string"?s.preview:typeof s.label=="string"?s.label:typeof s.aggregator=="string"?s.aggregator:void 0,result:s.text??s.result}}function Z(e){return e.map(t=>{const o=ve(t)?"tool":t.display_role||t.role,s={id:String(t.id),role:o==="moa"?"system":o,content:t.content||"",timestamp:t.timestamp*1e3,reasoning:t.reasoning||void 0,systemType:o==="command"?"command":void 0};if(t.role==="tool"||ve(t)){const r=rt(t.tool_name,t.content);s.toolName=t.tool_name||void 0,s.toolCallId=t.tool_call_id||void 0,s.toolArgs=t.tool_calls?.[0]?.function?.arguments?JSON.stringify(t.tool_calls[0].function.arguments):void 0,s.toolPreview=r?.preview,s.toolStatus="done",s.toolResult=r?r.result:t.content||void 0,s.content=""}return s})}function fe(e){const t=e.source==="coding_agent"||e.agent==="claude"||e.agent==="codex";return{agent:e.agent||void 0,agentSessionId:e.agent_session_id||void 0,agentNativeSessionId:e.agent_native_session_id||void 0,codingAgentId:e.agent==="codex"?"codex":e.agent==="claude"?"claude-code":void 0,codingAgentMode:t?e.agent_mode==="global"||e.agent_mode==="scoped"?e.agent_mode:e.provider==="global"?"global":"scoped":void 0}}function ut(e,t=[]){return{id:e.id,profile:e.profile||void 0,title:e.title||"",source:e.source,...fe(e),createdAt:e.started_at*1e3,updatedAt:(e.last_active||e.ended_at||e.started_at)*1e3,model:e.model,provider:e.provider,messageCount:e.message_count,messageTotal:e.message_count,loadedMessageCount:t.length,hasMoreBefore:!1,inputTokens:e.input_tokens,outputTokens:e.output_tokens,endedAt:e.ended_at?e.ended_at*1e3:void 0,lastActiveAt:e.last_active?e.last_active*1e3:void 0,isArchived:!!e.is_archived,workspace:e.workspace||void 0,messages:t}}async function ct(e,t){const o=A(e),s=t||o?.profile||null,r=await Be(e,0,ie,s);let C=null;if(r)C=ut(o||r.session,Z(r.messages)),C.profile=o?.profile||s||void 0,C.messageCount=r.total,C.messageTotal=r.total,C.loadedMessageCount=r.messages.length,C.hasMoreBefore=r.hasMore;else{const l=await Wt(e,s);if(!l){h.error(i("chat.sessionNotFound"));return}C={id:l.id,profile:l.profile||s||void 0,title:l.title||"",source:l.source,createdAt:l.started_at*1e3,updatedAt:(l.last_active||l.started_at)*1e3,model:l.model,provider:l.provider,messageCount:l.message_count,messageTotal:l.message_count,loadedMessageCount:l.messages.length,hasMoreBefore:!1,inputTokens:l.input_tokens,outputTokens:l.output_tokens,endedAt:l.ended_at?l.ended_at*1e3:void 0,lastActiveAt:l.last_active?l.last_active*1e3:void 0,workspace:l.workspace||void 0,messages:Z(l.messages)}}f.value=C.id,n.value=C,$?.matches&&(m.value=!1)}async function dt(e){const t=n.value;if(!t||t.id!==e||t.isLoadingOlderMessages||!t.hasMoreBefore)return!1;const o=t.loadedMessageCount||0;t.isLoadingOlderMessages=!0;try{const s=await Be(e,o,ie,t.profile);if(!s||s.messages.length===0)return t.hasMoreBefore=!1,!1;const r=new Set(t.messages.map(l=>l.id)),C=Z(s.messages).filter(l=>!r.has(l.id));return t.messages=[...C,...t.messages],t.loadedMessageCount=o+s.messages.length,t.messageTotal=s.total,t.messageCount=s.total,t.hasMoreBefore=s.hasMore,C.length>0}catch(s){return console.error("Failed to load older history messages:",s),!1}finally{t.isLoadingOlderMessages=!1}}async function U(e,t){await B.push({name:"hermes.historySession",params:{sessionId:e},query:t?{profile:t}:void 0})}async function K(e=!1){const t=_.value.find(s=>s.source==="cli")||_.value[0];if(!t){f.value=null,n.value=null,z.value&&await B.replace({name:"hermes.history"});return}p.value.has(t.source)&&(p.value=new Set([...p.value].filter(s=>s!==t.source)));const o={name:"hermes.historySession",params:{sessionId:t.id},query:t.profile?{profile:t.profile}:void 0};e?await B.replace(o):await B.push(o)}async function pe(){const e=z.value;if(!e)return;if(!_.value.some(s=>s.id===e)){f.value=null,n.value=null,await B.replace({name:"hermes.history"});return}const t=O.value||A(e)?.profile||null,o=n.value?.profile||null;(f.value!==e||o!==t)&&(f.value=e,n.value=null,await ct(e,t))}function ee(e){de.value=e.matches,e.matches&&m.value&&(m.value=!1)}function he(){m.value=!0}At(async()=>{st.loadModels(),await F.fetchProfiles(),await N(),await pe(),$=window.matchMedia("(max-width: 768px)"),ee($),$.addEventListener("change",ee),window.addEventListener("hermes:open-page-sidebar",he)}),Mt(()=>{$?.removeEventListener("change",ee),window.removeEventListener("hermes:open-page-sidebar",he)}),Y([z,O],async([e])=>{if(!e){f.value=null,n.value=null;return}E.value&&(O.value&&!_.value.some(t=>t.profile===O.value)&&await N(),await pe())}),Y(()=>F.activeProfileName,async()=>{E.value&&(F.switching||(f.value=null,n.value=null,await N(),await K(!0)))});const p=v(new Set(JSON.parse(localStorage.getItem("hermes_collapsed_groups")||"[]")));function vt(e){return{id:e.id,profile:e.profile||void 0,title:e.title||"",source:e.source,...fe(e),createdAt:e.started_at*1e3,updatedAt:(e.last_active||e.started_at)*1e3,model:e.model,provider:e.provider,messageCount:e.message_count,inputTokens:e.input_tokens,outputTokens:e.output_tokens,endedAt:e.ended_at?e.ended_at*1e3:void 0,lastActiveAt:e.last_active?e.last_active*1e3:void 0,isArchived:!!e.is_archived,workspace:e.workspace||void 0,messages:[]}}const T=g(()=>_.value.map(vt));function V(e){return`${e.profile||"default"}\0${e.id}`}function ge(){w.value||(x.value=!x.value,x.value||(c.value.clear(),L.value=!1))}function W(e){if(w.value)return;const t=V(e);c.value.has(t)?c.value.delete(t):c.value.add(t),c.value=new Set(c.value),c.value.size===0&&(L.value=!1)}function _e(e){return c.value.has(V(e))}function ft(){if(!w.value){if(me.value){c.value.clear(),c.value=new Set(c.value),L.value=!1;return}c.value.clear();for(const e of T.value)c.value.add(V(e));c.value=new Set(c.value)}}const we=g(()=>c.value.size),pt=g(()=>T.value.length>0),me=g(()=>T.value.length>0&&c.value.size===T.value.length);function Se(e){return e==="api_server"?-1:e==="cron"?999:0}function ye(e){return[...e].sort((t,o)=>(o.updatedAt||0)-(t.updatedAt||0))}const te=g(()=>ye(T.value.filter(e=>D.isPinned(e.id)))),G=g(()=>{const e=new Map;for(const t of T.value){if(D.isPinned(t.id))continue;const o=t.source||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}return[...e.keys()].sort((t,o)=>{const s=Se(t),r=Se(o);return s!==r?s-r:t.localeCompare(o)}).map(t=>({source:t,label:t?Ae(t):i("chat.other"),sessions:ye(e.get(t))}))});function ht(e){if(!p.value.has(e))p.value=new Set([...p.value,e]);else{p.value=new Set(G.value.map(o=>o.source).filter(o=>o!==e));const t=G.value.find(o=>o.source===e);t?.sessions.length&&U(t.sessions[0].id,t.sessions[0].profile)}localStorage.setItem("hermes_collapsed_groups",JSON.stringify([...p.value]))}Y(G,e=>{if(localStorage.getItem("hermes_collapsed_groups")!==null){const t=n.value?.source;t&&p.value.has(t)&&(p.value=new Set([...p.value].filter(o=>o!==t)),localStorage.setItem("hermes_collapsed_groups",JSON.stringify([...p.value])));return}e.length>0&&(p.value=new Set(e.slice(1).map(t=>t.source)),localStorage.setItem("hermes_collapsed_groups",JSON.stringify([...p.value])))},{once:!0}),Y(E,e=>{e&&_.value.length>0&&!z.value&&K(!1)},{once:!0});const gt=g(()=>n.value?.title||i("chat.newChat")),ke=g(()=>n.value?.source||"");async function be(e){const t=e||f.value;t&&(await Pe(t)?h.success(i("common.copied")):h.error(i("common.copied")+" ✗"))}function _t(e){return n.value?.id===e?n.value.profile||null:A(e)?.profile||null}function wt(e,t){const o=B.resolve({name:"hermes.historySession",params:{sessionId:e},query:t?{profile:t}:void 0}).href;return`${window.location.origin}${window.location.pathname}${o}`}async function mt(e){const t=e||f.value;t&&(await Pe(wt(t,_t(t)))?h.success(i("common.copied")):h.error(i("common.copied")+" ✗"))}function xe(e,t){e.preventDefault(),M.value=t,J.value=!0,ue.value=e.clientX,ce.value=e.clientY}function St(){J.value=!1}async function yt(e){const t=A(e);try{const o=await Ut(e,t?.profile||null);if(o.ok){h.success(i(o.imported?"chat.importSessionSuccess":"chat.importSessionAlreadyExists")),await N();return}}catch{}h.error(i("chat.importSessionFailed"))}async function kt(e){if(J.value=!1,!!M.value){if(e==="pin")D.togglePinned(M.value);else if(e==="copy-link")await mt(M.value);else if(e==="copy-id")await be(M.value);else if(e==="import-webui")await yt(M.value);else if(e==="unarchive"){if(!Q.value?.is_archived)return;if(!await Rt(M.value)){h.error(i("chat.unarchiveSessionFailed"));return}h.success(i("chat.sessionUnarchived")),await N(),A(M.value)||(f.value=null,n.value=null,await B.replace({name:"hermes.history"}),await K(!0))}}}async function Me(e,t){const o=A(e);if(!await Yt(e,t||o?.profile||null)){h.error(i("common.deleteFailed"));return}if(D.removePinned(e),_.value=_.value.filter(s=>s.id!==e),f.value===e){f.value=null,n.value=null;const s=T.value[0];s?await U(s.id,s.profile):await B.replace({name:"hermes.history"})}h.success(i("chat.sessionDeleted"))}async function bt(){if(c.value.size===0||w.value)return;const e=new Map(T.value.map(s=>[V(s),s])),t=Array.from(c.value).map(s=>e.get(s)).filter(s=>!!s).map(s=>({id:s.id,profile:s.profile||null}));if(t.length===0)return;const o=n.value?c.value.has(V(n.value)):!1;w.value=!0;try{const s=await Kt(t);if(s.deleted>0){for(const r of t)D.removePinned(r.id);await N(),(o||f.value&&!A(f.value))&&(f.value=null,n.value=null,await K(!0)),h.success(i("chat.batchDeleteSuccess",{count:s.deleted})),s.failed>0&&h.warning(i("chat.batchDeletePartial",{failed:s.failed}))}else h.error(i("chat.batchDeleteFailed"))}catch{h.error(i("chat.batchDeleteFailed"))}finally{w.value=!1,L.value=!1,x.value=!1,c.value.clear()}}function xt(){return bt(),!1}return(e,t)=>(d(),y("div",He,[a("div",{class:ae(["session-backdrop",{active:m.value}]),onClick:t[0]||(t[0]=o=>m.value=!1)},null,2),a("aside",{class:ae(["session-list",{collapsed:!m.value}])},[m.value?(d(),y("div",Ie,[P(ns,{active:"history","primary-label":u(i)("chat.newChat"),"hide-mode-switch":"",onPrimary:it},null,8,["primary-label"]),a("div",De,[a("span",Le,k(u(i)("chat.hermesHistory")),1),a("div",Ne,[a("button",{class:"session-close-btn",onClick:t[1]||(t[1]=o=>m.value=!1)},[...t[6]||(t[6]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])]),x.value?b("",!0):(d(),H(u(I),{key:0,quaternary:"",size:"tiny",disabled:_.value.length===0,title:u(i)("chat.toggleBatchMode"),onClick:ge},{icon:S(()=>[...t[7]||(t[7]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("path",{d:"M9 11l3 3L22 4"}),a("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})],-1)])]),_:1},8,["disabled","title"])),x.value?(d(),H(u(I),{key:1,quaternary:"",size:"tiny",disabled:!pt.value||w.value,title:me.value?u(i)("common.cancel"):u(i)("chat.selectAll"),onClick:ft},{icon:S(()=>[...t[8]||(t[8]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("path",{d:"M9 11l3 3L22 4"}),a("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})],-1)])]),_:1},8,["disabled","title"])):b("",!0),x.value&&we.value>0?(d(),H(u(It),{key:2,show:L.value,"onUpdate:show":t[2]||(t[2]=o=>L.value=o),"positive-button-props":{loading:w.value,disabled:w.value},"negative-button-props":{disabled:w.value},onPositiveClick:xt},{trigger:S(()=>[P(u(I),{quaternary:"",size:"tiny",type:"error",loading:w.value,disabled:w.value},{icon:S(()=>[...t[9]||(t[9]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("polyline",{points:"3 6 5 6 21 6"}),a("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])]),_:1},8,["loading","disabled"])]),default:S(()=>[oe(" "+k(u(i)("chat.confirmBatchDelete",{count:we.value})),1)]),_:1},8,["show","positive-button-props","negative-button-props"])):b("",!0),x.value?(d(),H(u(I),{key:3,quaternary:"",size:"tiny",disabled:w.value,onClick:ge},{icon:S(()=>[...t[10]||(t[10]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[a("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])]),_:1},8,["disabled"])):b("",!0)])])])):b("",!0),m.value?(d(),y("div",Oe,[j.value&&_.value.length===0?(d(),y("div",$e,k(u(i)("common.loading")),1)):_.value.length===0?(d(),y("div",Ve,k(u(i)("chat.noSessions")),1)):b("",!0),te.value.length>0?(d(),y(q,{key:2},[a("div",qe,[a("span",Fe,k(u(i)("chat.pinned")),1),a("span",ze,k(te.value.length),1)]),(d(!0),y(q,null,se(te.value,o=>(d(),H(Te,{key:`pinned-${o.id}`,session:o,active:o.id===f.value,pinned:!0,"can-delete":!0,streaming:!1,selectable:x.value,selected:_e(o),"show-profile":!0,onSelect:s=>x.value?W(o):U(o.id,o.profile),onContextmenu:s=>xe(s,o.id),onDelete:s=>Me(o.id,o.profile),onToggleSelect:s=>W(o)},null,8,["session","active","selectable","selected","onSelect","onContextmenu","onDelete","onToggleSelect"]))),128))],64)):b("",!0),(d(!0),y(q,null,se(G.value,o=>(d(),y(q,{key:o.source},[a("div",{class:"session-group-header",onClick:s=>ht(o.source)},[(d(),y("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:ae(["group-chevron",{collapsed:p.value.has(o.source)}])},[...t[11]||(t[11]=[a("polyline",{points:"9 18 15 12 9 6"},null,-1)])],2)),a("span",Re,k(o.label),1),a("span",Je,k(o.sessions.length),1)],8,Ee),p.value.has(o.source)?b("",!0):(d(!0),y(q,{key:0},se(o.sessions,s=>(d(),H(Te,{key:s.id,session:s,active:s.id===f.value,pinned:!1,"can-delete":!0,streaming:!1,selectable:x.value,selected:_e(s),"show-profile":!0,onSelect:r=>x.value?W(s):U(s.id,s.profile),onContextmenu:r=>xe(r,s.id),onDelete:r=>Me(s.id,s.profile),onToggleSelect:r=>W(s)},null,8,["session","active","selectable","selected","onSelect","onContextmenu","onDelete","onToggleSelect"]))),128))],64))),128))])):b("",!0),m.value?(d(),H(cs,{key:2})):b("",!0)],2),P(u(Tt),{placement:"bottom-start",trigger:"manual",x:ue.value,y:ce.value,options:lt.value,show:J.value,onSelect:kt,onClickoutside:St},null,8,["x","y","options","show"]),a("div",Ue,[a("header",Ke,[a("div",We,[P(u(I),{class:"history-sidebar-toggle",quaternary:"",size:"small",onClick:t[3]||(t[3]=o=>m.value=!m.value),circle:""},{icon:S(()=>[...t[12]||(t[12]=[a("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[a("rect",{x:"3",y:"3",width:"7",height:"7"}),a("rect",{x:"14",y:"3",width:"7",height:"7"}),a("rect",{x:"3",y:"14",width:"7",height:"7"}),a("rect",{x:"14",y:"14",width:"7",height:"7"})],-1)])]),_:1}),a("span",Ge,k(gt.value),1),ke.value?(d(),y("span",Ye,k(u(Ae)(ke.value)),1)):b("",!0),n.value?.workspace?(d(),y("span",{key:1,class:"workspace-badge",title:n.value.workspace},"📁 "+k(n.value.workspace.split("/").pop()||n.value.workspace),9,je)):b("",!0)]),a("div",Xe,[P(u(Ce),{trigger:"hover"},{trigger:S(()=>[P(u(I),{quaternary:"",size:"small",onClick:t[4]||(t[4]=o=>R.value=!R.value),circle:""},{icon:S(()=>[...t[13]||(t[13]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[a("path",{d:"M3 12h18M3 6h18M3 18h18"})],-1)])]),_:1})]),default:S(()=>[oe(" "+k(u(i)("chat.outlineTitle")),1)]),_:1}),P(u(Ce),{trigger:"hover"},{trigger:S(()=>[P(u(I),{quaternary:"",size:"small",onClick:t[5]||(t[5]=o=>be()),circle:""},{icon:S(()=>[...t[14]||(t[14]=[a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[a("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)])]),_:1})]),default:S(()=>[oe(" "+k(u(i)("chat.copySessionId")),1)]),_:1})])]),a("div",Qe,[a("div",Ze,[P(rs,{ref_key:"historyMessageListRef",ref:re,session:n.value,"load-older":dt},null,8,["session"])]),R.value&&n.value?(d(),H(as,{key:0,messages:n.value.messages||[],onNavigate:at},null,8,["messages"])):b("",!0)])])]))}})})),ds=ne((()=>{})),vs,fs=ne((()=>{et(),et(),ds(),Vt(),vs=qt(tt,[["__scopeId","data-v-ec25e11e"]])}));fs();export{vs as default};
|