ai-helper-agent 2.4.0 → 2.4.2
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/assets/{agent-store-Ce3f4Ya3.js → agent-store-Cqyodrcc.js} +1 -1
- package/dist/assets/background.js +1 -1
- package/dist/assets/{chat-export-BNCkL6fS.js → chat-export-CYBHjKQ4.js} +1 -1
- package/dist/assets/content.js +12 -12
- package/dist/assets/{i18n-ouMgDZ2t.js → i18n-D9_2eWuQ.js} +2 -2
- package/dist/assets/{model-profiles-6dzdrSS4.js → model-profiles-DfZDoMBc.js} +1 -1
- package/dist/assets/options-BuHUzyz4.css +1 -0
- package/dist/assets/options.js +43 -36
- package/dist/assets/{page-snapshot-renderer-j72q92KH.js → page-snapshot-renderer-DiB8_xZB.js} +1 -1
- package/dist/assets/{session-store-CmGs_rhh.js → session-store-CEnfKdIz.js} +3 -3
- package/dist/assets/side_panel.js +14 -14
- package/dist/assets/{utils-9i9g8vW8.js → utils-DP0OkHUf.js} +1 -1
- package/dist/assets/{version-t8HzLv3V.js → version-8JfKpCto.js} +1 -1
- package/dist/manifest.json +1 -1
- package/dist/offscreen/offscreen.js +2 -2
- package/dist/options.html +4 -4
- package/dist/side_panel.html +6 -6
- package/package.json +1 -1
- package/dist/assets/options-Cp1UMkjK.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-store-
|
|
2
|
-
import{o as e,r as t}from"./chunk-CMxvf4Kt.js";import{a as n,c as r,i,l as a,n as o,r as s,s as c}from"./i18n-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-store-Cqyodrcc.js","assets/chunk-CMxvf4Kt.js","assets/session-store-CEnfKdIz.js","assets/i18n-D9_2eWuQ.js","assets/pdf-DnVqBaAN.js","assets/__vite-browser-external-CM3Eme-n.js","assets/lib-33nIefF6.js","assets/jszip.min-Bm_16osY.js","assets/dist-DhUTa_WT.js","assets/chat-export-CYBHjKQ4.js","assets/dist-LQPh1k0y.js","assets/utils-DP0OkHUf.js","assets/model-profiles-DfZDoMBc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e,r as t}from"./chunk-CMxvf4Kt.js";import{a as n,c as r,i,l as a,n as o,r as s,s as c}from"./i18n-D9_2eWuQ.js";import{A as l,C as u,E as d,F as f,G as p,I as m,N as h,P as g,R as _,S as v,T as y,W as b,b as x,c as S,d as C,i as w,k as T,r as E,u as D,w as O,y as k,z as A}from"./model-profiles-DfZDoMBc.js";import{C as ee,F as te,G as ne,H as re,M as ie,O as j,R as ae,S as oe,T as se,U as ce,W as le,X as ue,a as de,b as fe,c as pe,d as M,f as me,g as N,h as he,i as P,k as ge,l as _e,m as F,n as ve,o as ye,p as I,s as be,t as xe,u as Se,w as Ce,x as we,y as Te}from"./session-store-CEnfKdIz.js";import{a as Ee,i as De,n as Oe,o as ke,r as Ae,t as je}from"./version-8JfKpCto.js";import{a as Me,c as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re}from"./agent-store-Cqyodrcc.js";import{C as L,S as ze,T as Be,_ as Ve,a as He,b as Ue,c as R,d as We,f as Ge,g as Ke,h as qe,i as Je,l as Ye,m as Xe,n as Ze,o as Qe,p as z,r as $e,s as B,t as et,u as tt,v as nt,w as rt,x as it,y as at}from"./utils-DP0OkHUf.js";var ot=he.map(e=>e.id),st=[...new Set([...p,`mcp`,`knowledge`])],ct=[{labelKey:`presetMode.preciseLabel`,tipKey:`presetMode.preciseTip`,temp:.2,topP:1},{labelKey:`presetMode.generalLabel`,tipKey:`presetMode.generalTip`,temp:.45,topP:.9},{labelKey:`presetMode.divergentLabel`,tipKey:`presetMode.divergentTip`,temp:.65,topP:.9},{labelKey:`presetMode.creativeLabel`,tipKey:`presetMode.creativeTip`,temp:.9,topP:.9}];n(`zh`,{contextUsage:{compactionInjection:`[上下文摘要|压缩了{count}条历史]`}}),n(`en`,{contextUsage:{compactionInjection:`[Context Summary | {count} messages compacted]`}});var lt=2e3,ut=.7,dt=1e3;function ft(e,{isolateChat:t=!0,maxMemoryMessages:n=null,compaction:r=null,historyBudget:i=1/0,currentMessage:a=null}={}){let o=a||{role:`user`,content:``};if(!t)return{messages:[o],keptHistory:[],compactionApplied:!1,trimmedCount:0,historySummaryText:null};let s=Array.isArray(e)?e:[],c=!1,u=-1;r&&r.summary&&r.upToMessageId&&(u=s.findIndex(e=>e.messageId===r.upToMessageId),c=u>=0);let f=s,p=s.map((e,t)=>t);n&&n>0&&s.length>n&&(f=s.slice(s.length-n),p=p.slice(s.length-n));let m=[];for(let e=0;e<f.length;e++)c&&p[e]<=u||m.push(f[e]);let h=[],g=y([o]);for(let e=m.length-1;e>=0;e--){let t=m[e],n=y([{...t,content:_(t.content)}]);if(g+n<=i)h.unshift(t),g+=n;else break}let v=null,b=m.length-h.length;if(b>0){let e=l(m.slice(0,b));e&&(v=d(e)>dt?e.substring(0,dt*4)+`
|
|
3
3
|
...[历史摘要已截断]`:e)}return{messages:[...h,o],keptHistory:h,compactionApplied:c,trimmedCount:b,historySummaryText:v}}function pt(e,t){return!t||!t.summary?e:`${e}\n\n${r(`contextUsage.compactionInjection`,{count:t.compressedCount||0})}\n${t.summary}`}function mt(e,t,n,r){return t?.compactionApplied&&n?.summary?e[0]={...e[0],content:pt(e[0].content,n)}:n?.summary&&r?.warn(`[SidePanel] contextCompaction invalid (upToMessageId not found), ignored this send`),e}function ht({model:e,customModelMap:t=null,systemPromptText:n=``,toolCount:r=0,history:i=[],inputText:a=``,maxMemoryMessages:o=null,compaction:s=null,isolateChat:c=!0,userConfiguredWindow:l=0}={}){let f=h(e,l,t),p=f-d(n)-v-lt,m=Math.floor(Math.max(p,0)*ut),g={role:`user`,content:a},_=c?s:null,b=ft(i,{isolateChat:c,maxMemoryMessages:o,compaction:_,historyBudget:m,currentMessage:g}),x=d(b.compactionApplied?pt(n,_):n),S=r*200,C=y(b.keptHistory),w=a&&a.trim()?y([g]):0,T=x+S+C+w,E=u(T,f);return{usedTokens:T,contextWindow:f,ratio:f>0?T/f:0,level:E.level,breakdown:{system:x,tools:S,history:C,input:w,outputReserve:v,safetyMargin:lt,selectedCount:b.keptHistory.length,totalCount:i.length,trimmedCount:b.trimmedCount,compactionApplied:b.compactionApplied,compactionInvalid:!!(_&&_.summary&&!b.compactionApplied),historyBudget:m}}}function gt(e,{maxMemoryMessages:t=null,compaction:n=null}={}){let r=ft(e,{isolateChat:!0,maxMemoryMessages:t,compaction:n,historyBudget:1/0,currentMessage:null}),i=[],a=!!(r.compactionApplied&&n?.summary);a&&i.push({role:`user`,content:`【已有摘要】\n${n.summary}`});for(let e of r.keptHistory){let t=_(e.content);i.push({role:e.role,content:typeof t==`string`?t:JSON.stringify(t??``)||``})}return{material:i,includedCount:r.keptHistory.length,hasOldSummary:a}}function _t(e){if(!e||!e.trim()||e.trim()==`/`)return;let t=e.trim(),n=F.inputHistory.indexOf(t);n!==-1&&F.inputHistory.splice(n,1),F.inputHistory.push(t),F.inputHistory.length>20&&F.inputHistory.shift(),vt()}function vt(){try{chrome.storage.local.set({inputHistory:F.inputHistory}),a.debug(`[SidePanel] input history saved,count:`,F.inputHistory.length)}catch(e){a.error(`[SidePanel] saveinput history failed:`,e)}}var yt=[`workspace`,`bookmark`,`toc`,`search`,`schedule`],bt=`.workspace-panel.expanded, .bookmark-panel.expanded, .message-toc-panel.expanded, .search-panel.expanded, .schedule-panel.open`,xt=null,St=null;function Ct(){if(xt)return xt;xt=document.createElement(`div`),xt.className=`side-rail`,xt.id=`sideRail`,xt.innerHTML=yt.map(e=>`<div class="side-rail-slot" data-slot="${e}"></div>`).join(``),document.body.appendChild(xt),Tt();let e=document.getElementById(`chatContainer`);return e&&typeof ResizeObserver<`u`&&new ResizeObserver(Tt).observe(e),window.addEventListener(`resize`,Tt),xt}function wt(e){return(xt||Ct()).querySelector(`.side-rail-slot[data-slot="${e}"]`)}function Tt(){if(!xt)return;let e=document.getElementById(`chatContainer`);if(!e)return;let t=e.getBoundingClientRect(),n=window.innerHeight;xt.style.top=`${Math.max(0,Math.round(t.top))}px`,xt.style.bottom=`${Math.max(0,Math.round(n-t.bottom))}px`,Et()}function Et(){St&&clearTimeout(St),St=setTimeout(()=>{St=null,document.querySelectorAll(bt).forEach(Je)},120)}n(`zh`,{messageToc:{toggleTitle:`显示目录(H{count}个标题)`,title:`目录`,headingCount:`{count} 个`}}),n(`en`,{messageToc:{toggleTitle:`Show table of contents (H{count} headings)`,title:`Contents`,headingCount:`{count}`}});function Dt(){document.addEventListener(`mouseover`,Ot,!0),document.addEventListener(`mouseout`,kt,!0),a.debug(`[SidePanel] messagedirectory featureinitializing`)}function Ot(e){if(!(e.target instanceof Element))return;if(e.target.closest(`.message-toc-container`)){F.isMouseOverToc=!0;return}let t=e.target.closest(`.message.assistant`),n=e.target.closest(`.workspace-preview-markdown`);if(!t&&!n)return;let r=t||n,i=r.querySelectorAll(`.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6`);if(i.length===0){jt();return}At(r,i)}function kt(e){if(!(e.target instanceof Element))return;if(e.target.closest(`.message-toc-container`)){F.isMouseOverToc=!1,F.tocHideTimer&&=(clearTimeout(F.tocHideTimer),null);return}let t=e.target.closest(`.message.assistant`),n=e.target.closest(`.workspace-preview-markdown`);if(!t&&!n)return;let r=e.relatedTarget;r&&(r.closest(`.message-toc-container`)||r.closest(`.message.assistant`)||r.closest(`.workspace-preview-markdown`))||F.isMouseOverToc||(F.tocHideTimer&&clearTimeout(F.tocHideTimer),F.tocHideTimer=setTimeout(()=>{F.isMouseOverToc||jt(),F.tocHideTimer=null},800))}function At(e,t){let n=Array.from(t);F.messageTocContainer&&jt(),n.forEach((e,t)=>{e.id||=`toc-heading-${Date.now()}-${t}`});let i=document.createElement(`div`);i.className=`message-toc-container`,i.dataset.headingsCount=n.length;let a=0,o=n.map(e=>{let t=parseInt(e.tagName.charAt(1)),n=e.textContent.trim(),r=n.length>30?n.substring(0,30)+`...`:n,i=`H${t}`;return a++,`
|
|
4
4
|
<li class="message-toc-item level-${t}"
|
|
5
5
|
data-target="${e.id}"
|
|
@@ -24,7 +24,7 @@ import{o as e,r as t}from"./chunk-CMxvf4Kt.js";import{a as n,c as r,i,l as a,n a
|
|
|
24
24
|
</ul>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
|
-
`,wt(`toc`).appendChild(i),F.messageTocContainer=i;let s=i.querySelector(`.message-toc-toggle`),c=i.querySelector(`.message-toc-panel`);s.addEventListener(`mouseenter`,()=>{c.classList.add(`expanded`),Je(c)}),s.addEventListener(`click`,()=>{c.classList.toggle(`expanded`)?Je(c):Ue(c)}),c.addEventListener(`mouseenter`,()=>{c.classList.add(`expanded`)}),i.querySelectorAll(`.message-toc-item`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.dataset.target,n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),n.classList.add(`toc-highlight`),setTimeout(()=>{n.classList.remove(`toc-highlight`)},1500))})})}function jt(){F.tocHideTimer&&=(clearTimeout(F.tocHideTimer),null),F.messageTocContainer&&=(F.messageTocContainer.remove(),null)}var Mt=`completedSessionIds`;async function Nt(){try{let e=(await chrome.storage.local.get([Mt]))[Mt]||[];F.completedSessionIds=new Set(e)}catch(e){a.warn(`[SessionManager] restore completedSessionIds failed:`,e)}}async function Pt(){try{await chrome.storage.local.set({[Mt]:Array.from(F.completedSessionIds)})}catch(e){a.warn(`[SessionManager] persist completedSessionIds failed:`,e)}}async function Ft(e){e&&e!==F.activeSessionId&&(F.completedSessionIds.has(e)||(F.completedSessionIds.add(e),await Pt(),document.dispatchEvent(new CustomEvent(`generating-state-changed`))))}async function It(e){e&&F.completedSessionIds.has(e)&&(F.completedSessionIds.delete(e),await Pt(),document.dispatchEvent(new CustomEvent(`generating-state-changed`)))}async function Lt(){return pe()}async function Rt(){return M()}async function zt(){return P()}async function Bt(e){return me(e)}async function Vt(e){let t=await de(e);return F.completedSessionIds.has(e)&&(F.completedSessionIds.delete(e),await Pt()),t}async function Ht(e,t){return _e(e,t)}async function Ut(e){return Se(e)}async function Wt(){return ve()}async function Gt(e){return be(e)}async function Kt(e,t){return xe(e,t)}async function qt(e,t=null){return ye(e,t)}n(`zh`,{toolPanel:{agentRestrictedBanner:`当前 Agent 限制了可用工具,部分工具已禁用`,noMatch:`没有匹配的工具`,enabledCount:`已启用 {enabled}/{total} 个工具`,toolsEnabled:`工具已启用`,allToolsDisabled:`所有工具已禁用`,toggleBtnEnabled:`禁用所有工具`,toggleBtnDisabled:`启用所有工具`,mcpServiceToolCount:`{count} 个工具`,mcpServiceExpand:`展开/收起工具列表`,mcpExcludedByAgent:`已被当前助手排除,可在助手编辑中调整`,categorySelectAllHint:`对该分类下可见项全选/取消全选`,stateOn:`已开启`,stateOff:`已关闭`,stateLine:`{name}:{state}`}}),n(`en`,{toolPanel:{agentRestrictedBanner:`Current agent has restricted available tools, some tools are disabled`,noMatch:`No matching tools`,enabledCount:`{enabled}/{total} tools enabled`,toolsEnabled:`Tools enabled`,allToolsDisabled:`All tools disabled`,toggleBtnEnabled:`Disable all tools`,toggleBtnDisabled:`Enable all tools`,mcpServiceToolCount:`{count} tools`,mcpServiceExpand:`Show/hide tool list`,mcpExcludedByAgent:`Excluded by current assistant; adjust in assistant editor`,categorySelectAllHint:`Select/deselect all visible items in this category`,stateOn:`On`,stateOff:`Off`,stateLine:`{name}: {state}`}});var Jt=[],Yt=[];function Xt(e){if(!e)return``;let t=`tool.${e.id}`,n=r(t);return n===t?e.description||``:n}function Zt(e){if(!e)return``;let t=e.description||``;if(t.startsWith(`[MCP:`)){let e=t.indexOf(`]`);e!==-1&&(t=t.slice(e+1).trim())}return t===(e.name||``)?``:t}async function Qt(){try{let e=await chrome.runtime.sendMessage({type:`GET_MCP_TOOLS`});if(e?.success&&e.tools)return Jt=e.tools,Jt}catch{}try{return Jt=(await chrome.storage.local.get([`mcpTools`])).mcpTools||[],Jt}catch{return Jt=[],[]}}async function $t(){try{Yt=(await chrome.storage.local.get([`ragTools`])).ragTools||[]}catch{Yt=[]}return Yt}async function en(){let e=`agentMcpClosedServers_${F.activeAgentId||`default`}`;try{F.mcpClosedServers=(await chrome.storage.local.get([e]))[e]||[]}catch{F.mcpClosedServers=[]}try{let{getAgent:e}=await I(async()=>{let{getAgent:e}=await import(`./agent-store-
|
|
27
|
+
`,wt(`toc`).appendChild(i),F.messageTocContainer=i;let s=i.querySelector(`.message-toc-toggle`),c=i.querySelector(`.message-toc-panel`);s.addEventListener(`mouseenter`,()=>{c.classList.add(`expanded`),Je(c)}),s.addEventListener(`click`,()=>{c.classList.toggle(`expanded`)?Je(c):Ue(c)}),c.addEventListener(`mouseenter`,()=>{c.classList.add(`expanded`)}),i.querySelectorAll(`.message-toc-item`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.dataset.target,n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),n.classList.add(`toc-highlight`),setTimeout(()=>{n.classList.remove(`toc-highlight`)},1500))})})}function jt(){F.tocHideTimer&&=(clearTimeout(F.tocHideTimer),null),F.messageTocContainer&&=(F.messageTocContainer.remove(),null)}var Mt=`completedSessionIds`;async function Nt(){try{let e=(await chrome.storage.local.get([Mt]))[Mt]||[];F.completedSessionIds=new Set(e)}catch(e){a.warn(`[SessionManager] restore completedSessionIds failed:`,e)}}async function Pt(){try{await chrome.storage.local.set({[Mt]:Array.from(F.completedSessionIds)})}catch(e){a.warn(`[SessionManager] persist completedSessionIds failed:`,e)}}async function Ft(e){e&&e!==F.activeSessionId&&(F.completedSessionIds.has(e)||(F.completedSessionIds.add(e),await Pt(),document.dispatchEvent(new CustomEvent(`generating-state-changed`))))}async function It(e){e&&F.completedSessionIds.has(e)&&(F.completedSessionIds.delete(e),await Pt(),document.dispatchEvent(new CustomEvent(`generating-state-changed`)))}async function Lt(){return pe()}async function Rt(){return M()}async function zt(){return P()}async function Bt(e){return me(e)}async function Vt(e){let t=await de(e);return F.completedSessionIds.has(e)&&(F.completedSessionIds.delete(e),await Pt()),t}async function Ht(e,t){return _e(e,t)}async function Ut(e){return Se(e)}async function Wt(){return ve()}async function Gt(e){return be(e)}async function Kt(e,t){return xe(e,t)}async function qt(e,t=null){return ye(e,t)}n(`zh`,{toolPanel:{agentRestrictedBanner:`当前 Agent 限制了可用工具,部分工具已禁用`,noMatch:`没有匹配的工具`,enabledCount:`已启用 {enabled}/{total} 个工具`,toolsEnabled:`工具已启用`,allToolsDisabled:`所有工具已禁用`,toggleBtnEnabled:`禁用所有工具`,toggleBtnDisabled:`启用所有工具`,mcpServiceToolCount:`{count} 个工具`,mcpServiceExpand:`展开/收起工具列表`,mcpExcludedByAgent:`已被当前助手排除,可在助手编辑中调整`,categorySelectAllHint:`对该分类下可见项全选/取消全选`,stateOn:`已开启`,stateOff:`已关闭`,stateLine:`{name}:{state}`}}),n(`en`,{toolPanel:{agentRestrictedBanner:`Current agent has restricted available tools, some tools are disabled`,noMatch:`No matching tools`,enabledCount:`{enabled}/{total} tools enabled`,toolsEnabled:`Tools enabled`,allToolsDisabled:`All tools disabled`,toggleBtnEnabled:`Disable all tools`,toggleBtnDisabled:`Enable all tools`,mcpServiceToolCount:`{count} tools`,mcpServiceExpand:`Show/hide tool list`,mcpExcludedByAgent:`Excluded by current assistant; adjust in assistant editor`,categorySelectAllHint:`Select/deselect all visible items in this category`,stateOn:`On`,stateOff:`Off`,stateLine:`{name}: {state}`}});var Jt=[],Yt=[];function Xt(e){if(!e)return``;let t=`tool.${e.id}`,n=r(t);return n===t?e.description||``:n}function Zt(e){if(!e)return``;let t=e.description||``;if(t.startsWith(`[MCP:`)){let e=t.indexOf(`]`);e!==-1&&(t=t.slice(e+1).trim())}return t===(e.name||``)?``:t}async function Qt(){try{let e=await chrome.runtime.sendMessage({type:`GET_MCP_TOOLS`});if(e?.success&&e.tools)return Jt=e.tools,Jt}catch{}try{return Jt=(await chrome.storage.local.get([`mcpTools`])).mcpTools||[],Jt}catch{return Jt=[],[]}}async function $t(){try{Yt=(await chrome.storage.local.get([`ragTools`])).ragTools||[]}catch{Yt=[]}return Yt}async function en(){let e=`agentMcpClosedServers_${F.activeAgentId||`default`}`;try{F.mcpClosedServers=(await chrome.storage.local.get([e]))[e]||[]}catch{F.mcpClosedServers=[]}try{let{getAgent:e}=await I(async()=>{let{getAgent:e}=await import(`./agent-store-Cqyodrcc.js`).then(e=>e.t);return{getAgent:e}},__vite__mapDeps([0,1,2,3])),t=F.activeAgentId?await e(F.activeAgentId):null;F.activeAgentMcpExcludedServerIds=t?t.mcpExcludedServerIds??null:null}catch{}}var tn=!1,nn=!0;chrome.storage.local.get([`enableToolPreselect`,`toolConfirmationEnabled`],e=>{tn=e.enableToolPreselect===!0,nn=e.toolConfirmationEnabled!==!1,On()}),chrome.storage.onChanged.addListener((e,t)=>{if(t!==`local`)return;let n=!1;e.mcpTools&&(Jt=e.mcpTools.newValue||[],a.debug(`[SidePanel] MCP toolcache updated:`,Jt.length,``),n=!0),e.ragTools&&(Yt=e.ragTools.newValue||[],a.debug(`[SidePanel] RAG toolcache updated:`,Yt.length),n=!0),e.mcpEnabled&&(rn=e.mcpEnabled.newValue===!0,a.debug(`[SidePanel] MCP globaltoggle changed:`,rn),n=!0),e.skillsEnabled&&(an=e.skillsEnabled.newValue!==!1,a.debug(`[SidePanel] Skill global toggle changed:`,an),n=!0);let r=!1;e.enableToolPreselect&&(tn=e.enableToolPreselect.newValue===!0,r=!0),e.toolConfirmationEnabled&&(nn=e.toolConfirmationEnabled.newValue!==!1,r=!0),r&&On(),n&&(document.getElementById(`toolsPopupOverlay`)?.classList.contains(`show`)&&(Cn(),wn(),hn()),Dn())}),Qt().then(()=>Dn()),$t().then(()=>Dn());var rn=!1,an=!0;chrome.storage.local.get([`mcpEnabled`,`skillsEnabled`],e=>{rn=e.mcpEnabled===!0,an=e.skillsEnabled!==!1,Dn()});function on(){let e=[...b,...Yt],t=F.activeAgentToolIds,n=e;if(t!=null){let r=new Set(t);n=e.filter(e=>r.has(e.id))}return an||(n=n.filter(e=>e.id!==`agent_skill`)),F.agentPlatform?.connected!==!0&&(n=n.filter(e=>!e.id.startsWith(`agent_`)&&!e.id.startsWith(`knowledge_`))),n}function sn(){if(!rn||F.agentPlatform?.connected!==!0)return[];let e=new Map;return Jt.forEach(t=>{let n=t.serverId||`unknown`;e.has(n)||e.set(n,{serverId:n,serverName:t.serverName||n,tools:[],toolCount:0});let r=e.get(n);r.tools.push(t),r.toolCount++}),Array.from(e.values())}function cn(e){return Array.isArray(F.mcpClosedServers)&&F.mcpClosedServers.includes(e)}function ln(e){return Array.isArray(F.activeAgentMcpExcludedServerIds)&&F.activeAgentMcpExcludedServerIds.includes(e)}function un(e){return!cn(e)&&!ln(e)}function dn(){if(F.currentCategory!==`all`&&F.currentCategory!==`mcp`)return[];let e=sn();if(F.currentSearch){let t=F.currentSearch;e=e.filter(e=>(e.serverName||``).toLowerCase().includes(t)||(e.serverId||``).toLowerCase().includes(t)||e.tools.some(e=>(e.name||``).toLowerCase().includes(t)||Xt(e).toLowerCase().includes(t)))}return e}function fn(e,t){Array.isArray(F.mcpClosedServers)||(F.mcpClosedServers=[]);let n=F.mcpClosedServers.indexOf(e);t?n>-1&&F.mcpClosedServers.splice(n,1):n===-1&&F.mcpClosedServers.push(e)}async function pn(){let e=document.getElementById(`toolsPopupOverlay`);if(!e)return;F.currentCategory=`all`,F.currentSearch=``;let t=document.getElementById(`toolsSearchInput`);t&&(t.value=``),await Qt(),await $t(),await en(),Cn(),wn(),chrome.storage.local.get([`enableToolPreselect`,`toolConfirmationEnabled`],e=>{let t=document.getElementById(`toolsPreselectToggle`);t&&(t.checked=e.enableToolPreselect===void 0?!1:e.enableToolPreselect);let n=document.getElementById(`toolConfirmToggle`);n&&(n.checked=e.toolConfirmationEnabled===void 0?!0:e.toolConfirmationEnabled)}),document.querySelectorAll(`.category-btn`).forEach(e=>{e.classList.remove(`active`),e.classList.contains(`category-all`)?(e.classList.add(`active`),e.style.background=`linear-gradient(135deg, var(--brand-500) 0%, var(--brand-accent) 100%)`,e.style.color=`var(--text-on-brand)`,e.style.borderColor=`transparent`):(e.style.background=`var(--bg-surface)`,e.style.color=`var(--text-secondary)`,e.style.borderColor=`var(--border-subtle)`)}),hn(),e.classList.add(`show`),a.debug(`[SidePanel] opentool popup`)}function mn(){let e=document.getElementById(`toolsPopupOverlay`);e&&(document.querySelectorAll(`.category-btn`).forEach(e=>{e.classList.remove(`active`),e.style.background=``,e.style.color=``,e.style.borderColor=``}),e.classList.remove(`show`),a.debug(`[SidePanel] closetool popup`))}function hn(){let e=document.getElementById(`toolsPopupList`);if(!e)return;e.innerHTML=``;let t=on();if(F.activeAgentToolIds!==null&&F.activeAgentToolIds!==void 0){let t=document.createElement(`div`);t.className=`popup-tool-agent-banner`,t.innerHTML=`<span>${r(`toolPanel.agentRestrictedBanner`)}</span>`,e.appendChild(t)}let n={};t.forEach(e=>{if(F.currentCategory!==`all`&&e.category!==F.currentCategory)return;if(F.currentSearch){let t=e.name.toLowerCase().includes(F.currentSearch),n=Xt(e).toLowerCase().includes(F.currentSearch);if(!t&&!n)return}let t=e.category||`other`;n[t]||(n[t]=[]),n[t].push(e)});let i=dn();if(st.forEach(a=>{let o=a===`mcp`,s=n[a]||[],c=o?i:[];if(o?c.length===0:s.length===0)return;let l;if(o)l=`${c.filter(e=>un(e.serverId)).length}/${c.length}`;else{let e=t.filter(e=>e.category===a);l=`${e.filter(e=>F.enabledTools.includes(e.id)).length}/${e.length}`}let u=document.createElement(`div`);u.className=`popup-tool-category-group`,u.dataset.category=a;let d=document.createElement(`div`);d.className=`popup-tool-category`,d.dataset.category=a;let f=F.collapsedCategories[a]||!1;d.innerHTML=`
|
|
28
28
|
<span class="category-expand-icon">${f?`▶`:`▼`}</span>
|
|
29
29
|
<span class="category-name">${r(`toolCategory.`+a)}</span>
|
|
30
30
|
<span class="category-count">${l}</span>
|
|
@@ -783,7 +783,7 @@ Ctrl/Cmd+click to copy rich-text table`,downloadExcel:`Download Excel`,exportTab
|
|
|
783
783
|
</button>
|
|
784
784
|
</div>
|
|
785
785
|
</div>
|
|
786
|
-
`}).join(``)}function Au(e,t){if(!t)return e;let n=R(e),r=t.split(/[&|]/).map(e=>e.trim()).filter(Boolean);if(r.length===0)return n;let i=r.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)),a=RegExp(`(${i.join(`|`)})`,`gi`);return n.replace(a,`<mark class="bookmark-highlight-match">$1</mark>`)}async function ju(e,t){if(!(!e||!t)){if(F.activeSessionId!==e)try{let n=F.activeSessionId;if(await Bt(e)===!1||F.activeSessionId!==e){await Su(e,t),Ou(),L(r(`bookmark.sessionNotExistToast`),`warning`);return}document.dispatchEvent(new CustomEvent(`session-switched`,{detail:{sessionId:e,previousSessionId:n,skipScrollRestore:!0}}));try{let{renderSessionTabs:e}=await I(async()=>{let{renderSessionTabs:e}=await Promise.resolve().then(()=>so);return{renderSessionTabs:e}},void 0);e()}catch(e){a.warn(`[BookmarkPanel] refreshsessionTab failed:`,e)}}catch(e){a.error(`[BookmarkPanel] switchsession failed:`,e);return}setTimeout(()=>{let n=document.getElementById(`chatContainer`);if(!n)return;let i=n.querySelector(`.message[data-message-id="${t}"]`);i?(i.scrollIntoView({behavior:`instant`,block:`nearest`}),i.classList.add(`bookmark-highlight`),setTimeout(()=>{i.classList.remove(`bookmark-highlight`)},2e3)):Su(e,t).then(()=>{Ou(),L(r(`bookmark.messageNotExistToast`),`warning`)})},500)}}function Mu(){let e=document.getElementById(`bookmarkPanelContainer`),t=F.bookmarks.length;e&&(e.style.display=t>0?``:`none`)}function Nu(){let e=document.getElementById(`chatContainer`);e&&e.querySelectorAll(`.message.assistant`).forEach(e=>{let t=e.querySelector(`.bookmark-btn`);if(!t)return;let n=e.dataset.messageId,r=F.activeSessionId;Pu(t,r,n)})}function Pu(e,t,n){bu(t,n)?(e.classList.add(`bookmarked`),e.title=r(`bookmark.removeBookmarkTitle`),e.querySelector(`svg`).setAttribute(`fill`,`currentColor`)):(e.classList.remove(`bookmarked`),e.title=r(`bookmark.addBookmarkTitle`),e.querySelector(`svg`).setAttribute(`fill`,`none`))}var Fu=t({createDir:()=>vd,deleteFs:()=>gd,downloadFile:()=>od,downloadFileStream:()=>fd,downloadFileStreamWithProgress:()=>pd,downloadFiles:()=>sd,downloadFilesStream:()=>md,downloadFilesStreamWithProgress:()=>hd,formatFileSize:()=>Ru,formatTime:()=>zu,getAgentConfig:()=>Yu,getAgentStatusDetail:()=>$u,getFileIcon:()=>Lu,getFileInfo:()=>bd,getHomeDir:()=>Zu,getMimeType:()=>Uu,getPreviewType:()=>Vu,getWorkspaceRoot:()=>Xu,isImageFile:()=>Hu,listDirectory:()=>rd,moveFs:()=>yd,readFileContent:()=>id,removeAllowedPath:()=>td,renameFs:()=>_d,resetWorkspaceRoot:()=>Qu,searchFilesRemote:()=>ud,supportsPreview:()=>Bu,switchWorkspace:()=>ed,writeFileContent:()=>ad});n(`zh`,{workspaceMgr:{agentNotPairedDetail:`Agent 未配对,请先在设置中完成配对`,agentNotPaired:`Agent 未配对`,requestFailed:`请求失败: {message}`,downloadFailed:`下载失败`,cancelled:`已取消`}}),n(`en`,{workspaceMgr:{agentNotPairedDetail:`Agent not paired. Please complete pairing in Settings first.`,agentNotPaired:`Agent not paired`,requestFailed:`Request failed: {message}`,downloadFailed:`Download failed`,cancelled:`Cancelled`}});var Iu={txt:`📄`,md:`📝`,json:`📋`,js:`📜`,mjs:`📜`,ts:`📘`,jsx:`⚛️`,tsx:`⚛️`,html:`🌐`,htm:`🌐`,css:`🎨`,scss:`🎨`,less:`🎨`,xml:`📰`,yaml:`📰`,yml:`📰`,py:`🐍`,java:`☕`,c:`⚙️`,cpp:`⚙️`,h:`⚙️`,go:`🔹`,rs:`🦀`,rb:`💎`,php:`🐘`,sql:`🗄️`,sh:`💻`,bash:`💻`,zsh:`💻`,cfg:`⚙️`,ini:`⚙️`,toml:`⚙️`,conf:`⚙️`,log:`📊`,csv:`📊`,tsv:`📊`,env:`🔒`,vue:`💚`,svelte:`🧡`,astro:`🚀`,rtf:`📄`,svg:`🖼️`,png:`🖼️`,jpg:`🖼️`,jpeg:`🖼️`,gif:`🖼️`,webp:`🖼️`,bmp:`🖼️`,ico:`🖼️`,pdf:`📕`,doc:`📘`,docx:`📘`,xls:`📗`,xlsx:`📗`,ppt:`📙`,pptx:`📙`,zip:`📦`,gz:`📦`,tar:`📦`,rar:`📦`,"7z":`📦`,mp3:`🎵`,wav:`🎵`,mp4:`🎬`,webm:`🎬`,avi:`🎬`};function Lu(e,t){return t===`directory`?`📁`:Iu[(e.split(`.`).pop()||``).toLowerCase()]||`📄`}function Ru(e){if(e===0)return`0 B`;if(e==null)return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=1024,r=Math.floor(Math.log(e)/Math.log(n));return`${(e/n**r).toFixed(r===0?0:1)} ${t[r]}`}function zu(e){return e?new Date(e).toLocaleString(`zh-CN`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):`—`}function Bu(e){let t=(e.split(`.`).pop()||``).toLowerCase();return new Set(`txt.md.json.js.mjs.ts.jsx.tsx.html.htm.css.scss.less.xml.yaml.yml.py.java.c.cpp.h.go.rs.rb.php.sql.sh.bash.zsh.cfg.ini.toml.conf.log.csv.tsv.env.vue.svelte.astro.rtf.svg.pdf.docx.pptx.xlsx.xls.png.jpg.jpeg.gif.webp.bmp.ico.mp4.webm.ogg.m4v.mov.mp3.wav.m4a.aac.flac.opus`.split(`.`)).has(t)}function Vu(e){let t=(e.split(`.`).pop()||``).toLowerCase();return t===`pdf`?`pdf`:t===`docx`?`docx`:t===`xlsx`||t===`xls`?`xlsx`:t===`pptx`?`pptx`:new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`]).has(t)?`image`:new Set([`mp4`,`webm`,`ogg`,`m4v`,`mov`]).has(t)?`video`:new Set([`mp3`,`wav`,`m4a`,`aac`,`flac`,`opus`]).has(t)?`audio`:`text`}function Hu(e){let t=(e.split(`.`).pop()||``).toLowerCase();return new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`svg`]).has(t)}function Uu(e){return{txt:`text/plain`,md:`text/markdown`,json:`application/json`,js:`application/javascript`,html:`text/html`,css:`text/css`,xml:`application/xml`,yaml:`text/yaml`,yml:`text/yaml`,csv:`text/csv`,svg:`image/svg+xml`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`,pdf:`application/pdf`,pptx:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,mp4:`video/mp4`,webm:`video/webm`,ogg:`video/ogg`,m4v:`video/x-m4v`,mov:`video/quicktime`,mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`,aac:`audio/aac`,flac:`audio/flac`,opus:`audio/ogg`}[(e.split(`.`).pop()||``).toLowerCase()]||`text/plain`}var Wu=null,Gu=null,Ku=null;function qu(e){if(e instanceof TypeError)return!0;let t=String(e&&e.message||``).toLowerCase();return t.includes(`failed to fetch`)||t.includes(`load failed`)||t.includes(`networkerror`)}function Ju(e,t){let n=t&&t.message;qu(t)?a.debug(`[WorkspaceManager] ${e} skipped (agent unreachable):`,n):a.warn(`[WorkspaceManager] ${e} failed:`,n)}async function Yu(){if(Ku&&Ku.url&&Ku.token)return Ku;try{let e=await chrome.storage.local.get([`pairedAgents`,`activeAgentId`]),t=e.pairedAgents||[],n=e.activeAgentId;if(!n||t.length===0)return null;let r=t.find(e=>e.id===n)||t[0];return r?(Ku={url:r.url,token:r.token},Ku):null}catch(e){return a.warn(`[WorkspaceManager] getAgentconfiguration failed:`,e.message),null}}async function Xu(){if(Wu)return Wu;let e=await Yu();if(!e)return null;try{let t=await fetch(`${e.url}/api/status/detail`,{headers:{Authorization:`Bearer ${e.token}`}});if(t.ok){let e=await t.json();if(e.success&&e.workdir)return Wu=e.workdir,Wu}}catch(e){Ju(`get workingdirectory`,e)}return null}async function Zu(){if(Gu)return Gu;let e=await Yu();if(!e)return null;try{let t=await fetch(`${e.url}/api/status/detail`,{headers:{Authorization:`Bearer ${e.token}`}});if(t.ok){let e=await t.json();if(e.success&&e.homeDir)return Gu=e.homeDir,Gu}}catch(e){Ju(`get homedir`,e)}return null}function Qu(){Wu=null,Gu=null,Ku=null}async function $u(){let e=await Yu();if(!e)return null;try{let t=await fetch(`${e.url}/api/status/detail`,{headers:{Authorization:`Bearer ${e.token}`}});if(t.ok){let e=await t.json();if(e.success)return e}}catch(e){Ju(`get statusdetailcase`,e)}return null}async function ed(e){let t=await nd(`/api/config/workdir`,{workdir:e});return t.success&&Qu(),t}async function td(e){return nd(`/api/config/allowed-paths/remove`,{path:e})}async function nd(e,t={}){let n=await Yu();if(!n)return{success:!1,error:r(`workspaceMgr.agentNotPairedDetail`)};try{return await(await fetch(`${n.url}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n.token}`},body:JSON.stringify(t)})).json()}catch(e){return{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function rd(e){return nd(`/api/fs/list`,{path:e||`.`})}async function id(e){return nd(`/api/fs/read`,{path:e})}async function ad(e,t){return nd(`/api/fs/write`,{path:e,content:t})}async function od(e){return nd(`/api/fs/download`,{path:e})}async function sd(e){return nd(`/api/fs/download-multi`,{paths:e})}function cd(e){return(e||``).replace(/\\/g,`/`).replace(/\/+/g,`/`)}function ld(e){return e?!!(e.startsWith(`/`)||/^[a-zA-Z]:[\\/]/.test(e)||/^(\\\\|\/\/)[^\\/]+[\\/]/.test(e)):!1}async function ud(e,t,n=200){let r=await nd(`/api/fs/search_files`,{path:e,pattern:`*${t}*`,recursive:!0,maxResults:n});return r.success?(r.results||[]).map(t=>{let n=cd(ld(t.path)?t.path:`${e}/${t.path}`),r=n.substring(0,n.lastIndexOf(`/`));return{name:t.name,type:t.type||`file`,size:t.size,mtime:t.mtime,fullPath:n,matchPath:r}}):[]}function dd(e,t){if(!e)return t;let n=e.match(/filename\*=UTF-8''(.+?)(?:;|$)/)||e.match(/filename="(.+?)"/);return n?decodeURIComponent(n[1]):t}async function fd(e){let t=await Yu();if(!t)return{success:!1,error:r(`workspaceMgr.agentNotPairedDetail`)};try{let n=await fetch(`${t.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t.token}`},body:JSON.stringify({path:e})});return n.ok?{success:!0,blob:await n.blob(),name:dd(n.headers.get(`Content-Disposition`),e.split(/[\\/]/).pop()),mimeType:n.headers.get(`Content-Type`)}:{success:!1,error:(await n.json().catch(()=>({error:n.statusText}))).error||r(`workspaceMgr.downloadFailed`)}}catch(e){return{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function pd(e,t,n){let i=await Yu();if(!i)return{success:!1,error:r(`workspaceMgr.agentNotPaired`)};try{let a=await fetch(`${i.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i.token}`},body:JSON.stringify({path:e}),signal:n});if(!a.ok)return{success:!1,error:(await a.json().catch(()=>({error:a.statusText}))).error||r(`workspaceMgr.downloadFailed`)};let o=parseInt(a.headers.get(`Content-Length`)||`0`,10),s=a.body.getReader();n&&n.addEventListener(`abort`,()=>{try{s.cancel()}catch{}});let c=[],l=0;for(;;){let{done:e,value:n}=await s.read();if(e)break;c.push(n),l+=n.length,t&&o>0&&t({loaded:l,total:o,percent:Math.round(l/o*100)})}return{success:!0,blob:new Blob(c),name:dd(a.headers.get(`Content-Disposition`),e.split(/[\\/]/).pop()),mimeType:a.headers.get(`Content-Type`)}}catch(e){return e.name===`AbortError`?{success:!1,error:r(`workspaceMgr.cancelled`),aborted:!0}:{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function md(e){let t=await Yu();if(!t)return{success:!1,error:r(`workspaceMgr.agentNotPairedDetail`)};try{let n=await fetch(`${t.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t.token}`},body:JSON.stringify({paths:e})});return n.ok?{success:!0,blob:await n.blob(),name:dd(n.headers.get(`Content-Disposition`),`workspace.zip`),mimeType:n.headers.get(`Content-Type`)}:{success:!1,error:(await n.json().catch(()=>({error:n.statusText}))).error||r(`workspaceMgr.downloadFailed`)}}catch(e){return{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function hd(e,t,n){let i=await Yu();if(!i)return{success:!1,error:r(`workspaceMgr.agentNotPaired`)};try{let a=await fetch(`${i.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i.token}`},body:JSON.stringify({paths:e}),signal:n});if(!a.ok)return{success:!1,error:(await a.json().catch(()=>({error:a.statusText}))).error||r(`workspaceMgr.downloadFailed`)};let o=parseInt(a.headers.get(`Content-Length`)||`0`,10),s=a.body.getReader();n&&n.addEventListener(`abort`,()=>{try{s.cancel()}catch{}});let c=[],l=0;for(;;){let{done:e,value:n}=await s.read();if(e)break;c.push(n),l+=n.length,t&&o>0&&t({loaded:l,total:o,percent:Math.round(l/o*100)})}return{success:!0,blob:new Blob(c),name:dd(a.headers.get(`Content-Disposition`),`workspace.zip`),mimeType:a.headers.get(`Content-Type`)}}catch(e){return e.name===`AbortError`?{success:!1,error:r(`workspaceMgr.cancelled`),aborted:!0}:{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function gd(e){return nd(`/api/fs/delete`,{path:e})}async function _d(e,t){return nd(`/api/fs/rename`,{path:e,newName:t})}async function vd(e){return nd(`/api/fs/mkdir`,{path:e})}async function yd(e,t){return nd(`/api/fs/move`,{path:e,destDir:t})}async function bd(e){return nd(`/api/fs/stat`,{path:e})}n(`zh`,{imageHelper:{uploadToAgentTitle:`上传文件到Agent工作目录,大模型通过工具直接操作`,uploadAndExtractTitle:`上传文件并提取文本内容(支持PDF/Word/Excel/文本等)`,clickToEnlarge:`点击查看大图`,removeImage:`移除图片`,enableImageInputFirst:`请先开启图片输入功能`,screenshotSuccess:`截图成功`,screenshotFailed:`截图失败,请重试`,noActiveTab:`无法获取当前标签页`,cropFailed:`裁剪失败,请重试`,regionScreenshotFailed:`区域截图失败,请确保页面已加载且未被浏览器限制`,imageLoadFailed:`图片加载失败`,screenshotProcessFailed:`截图处理失败,请重试`}}),n(`en`,{imageHelper:{uploadToAgentTitle:`Upload files to Agent workspace; the model operates on them directly via tools`,uploadAndExtractTitle:`Upload files and extract text content (supports PDF/Word/Excel/text, etc.)`,clickToEnlarge:`Click to enlarge`,removeImage:`Remove image`,enableImageInputFirst:`Please enable image input first`,screenshotSuccess:`Screenshot captured`,screenshotFailed:`Screenshot failed, please retry`,noActiveTab:`Unable to get the current tab`,cropFailed:`Cropping failed, please retry`,regionScreenshotFailed:`Region screenshot failed. Make sure the page is loaded and not restricted by the browser.`,imageLoadFailed:`Image load failed`,screenshotProcessFailed:`Screenshot processing failed, please retry`}});function xd(){let e=document.getElementById(`imagePreviewBar`),t=document.getElementById(`screenshotBtn`);e&&(e.style.display=F.attachedImages.length>0?``:`none`),t&&(F.enableImageInput?t.style.removeProperty(`display`):t.style.display=`none`),Sd(),F.enableImageInput||(F.attachedImages=[]),wd()}function Sd(){let e=document.getElementById(`userInput`);e&&e.style.removeProperty(`padding-right`)}function Cd(){let e=document.getElementById(`fileAttachBtn`),t=document.getElementById(`fileInput`);e&&(e.style.display=F.enableFileInput?``:`none`),t&&(F.agentPlatform?.connected?(t.accept=`*`,e&&(e.title=r(`imageHelper.uploadToAgentTitle`))):(t.accept=`.pdf,.docx,.xlsx,.xls,.txt,.md,.json,.js,.jsx,.ts,.tsx,.html,.css,.scss,.less,.xml,.yaml,.yml,.py,.java,.c,.cpp,.h,.go,.rs,.rb,.php,.sql,.sh,.bash,.zsh,.cfg,.ini,.toml,.conf,.log,.csv,.tsv,.env,.vue,.svelte,.astro,.rtf`,e&&(e.title=r(`imageHelper.uploadAndExtractTitle`)))),Sd(),F.enableFileInput||gu()}function wd(){let e=document.getElementById(`imagePreviewBar`);if(e){if(e.innerHTML=``,F.attachedImages.length===0){e.style.display=`none`;return}e.style.display=``,F.attachedImages.forEach((t,n)=>{let i=document.createElement(`div`);i.className=`image-preview-item`;let a=document.createElement(`img`);a.src=t.dataUrl||t.compressedUrl||t.originalUrl,a.className=`image-preview-thumb`,a.title=r(`imageHelper.clickToEnlarge`),a.style.cursor=`zoom-in`,a.addEventListener(`click`,()=>{Tl(t.originalUrl||t.dataUrl||t.compressedUrl,a)});let o=document.createElement(`button`);o.className=`image-preview-remove`,o.innerHTML=`×`,o.title=r(`imageHelper.removeImage`),o.addEventListener(`click`,e=>{e.stopPropagation(),F.attachedImages.splice(n,1),wd()}),i.appendChild(a),i.appendChild(o),e.appendChild(i)})}}async function Td(){if(!F.enableImageInput){L(r(`imageHelper.enableImageInputFirst`));return}try{let e=await chrome.runtime.sendMessage({type:`CAPTURE_TAB`});e?.dataUrl&&(Nl(await(await fetch(e.dataUrl)).blob()),L(r(`imageHelper.screenshotSuccess`)))}catch(e){a.error(`[SidePanel] full page screenshot failed:`,e),L(r(`imageHelper.screenshotFailed`))}}async function Ed(){let e=await Ke();if(!e){L(r(`imageHelper.noActiveTab`));return}try{let t=await chrome.tabs.sendMessage(e,{type:`START_REGION_SELECTION`});if(!t)return;a.debug(`[SidePanel] regionselectresult:`,t);let n=await chrome.runtime.sendMessage({type:`CAPTURE_TAB`});if(!n?.dataUrl){L(r(`imageHelper.screenshotFailed`));return}let i=await Dd(n.dataUrl,t);if(!i){L(r(`imageHelper.cropFailed`));return}Nl(await(await fetch(i)).blob())}catch(e){a.error(`[SidePanel] region screenshot failed:`,e),L(r(`imageHelper.regionScreenshotFailed`))}}function Dd(e,t){return new Promise((n,i)=>{let a=new Image;a.onload=()=>{let e=document.createElement(`canvas`),r=window.devicePixelRatio||1,i=t.x*r,o=t.y*r,s=t.width*r,c=t.height*r;e.width=s,e.height=c,e.getContext(`2d`,{willReadFrequently:!0}).drawImage(a,i,o,s,c,0,0,s,c),n(e.toDataURL(`image/jpeg`,.85))},a.onerror=()=>i(Error(r(`imageHelper.imageLoadFailed`))),a.src=e})}async function Od(e,t,n){if(!F.enableImageInput){L(r(`imageHelper.enableImageInputFirst`));return}try{let i=e;t===`region`&&n&&(i=await Dd(e,n)),Nl(await(await fetch(i)).blob()),L(r(`imageHelper.screenshotSuccess`))}catch(e){a.error(`[SidePanel] pageshortcutscreenshotprocessing failed:`,e),L(r(`imageHelper.screenshotProcessFailed`))}}var kd=t({attachFilesForQuestion:()=>Ah,closePreview:()=>ym,closeWorkspacePanel:()=>sh,closeWorkspacePreview:()=>oh,initWorkspacePanel:()=>Qd,locateFileInWorkspace:()=>ih,openWorkspacePanel:()=>bf,previewArtifactFile:()=>ah,refreshWorkspacePanel:()=>Zm,resetAndRefreshWorkspace:()=>Qm,resolveWorkspaceAbsolutePath:()=>ch,updateWorkspacePanelVisibility:()=>$m});n(`zh`,{workspace:{workDir:`工作目录`,closePanel:`关闭面板`,embedMode:`嵌入模式`,floatMode:`浮窗模式`,openPanel:`打开工作目录面板`,narrowViewportHint:`视口过窄,已切回浮窗模式`,switchWorkdir:`切换工作目录`,backToParent:`返回上级目录`,uploadToCurrent:`上传文件到当前目录`,newFolder:`新建文件夹`,askSelectedFiles:`基于选中的文件进行问答`,downloadSelected:`下载选中的文件/目录(多选打包为ZIP)`,deleteSelected:`删除选中的文件`,clearSearch:`清除`,search:`搜索`,searchPlaceholder:`搜索...`,selectAllToggle:`全选/取消全选`,colName:`文件名`,colSize:`大小`,colTime:`修改时间`,noMatch:`未找到匹配的文件`,dirEmpty:`此目录为空`,noWorkspace:`无法获取工作目录,请确认 Agent 已连接`,loadDirFailed:`加载目录失败`,refreshFailed:`无法刷新,请确认 Agent 已连接`,agentNotConnected:`Agent 未连接`,agentNotConnectedUpload:`Agent 未连接,无法上传`,unsupportedFileType:`不支持的文件类型`,unknownError:`未知错误`,copiedFileName:`已复制文件名: {name}`,copiedPath:`已复制路径: {path}`,copyFailed:`复制失败`,copiedToClipboard:`已复制到剪贴板`,copyFailedManual:`复制失败,请手动选择复制`,getContentFailed:`获取内容失败`,codeCopiedToClipboard:`代码已复制到剪贴板`,copyUnsupportedType:`此文件类型不支持复制文本内容`,copiedToClipboardShort:`已复制到剪贴板`,clickToCopy:`点击复制`,preview:`预览`,previewBtn:`预览`,details:`详情`,download:`下载`,downloadFile:`下载文件`,rename:`重命名`,askFile:`基于文件问答`,delete:`删除`,copyAll:`复制`,copyAllTitle:`复制全部内容`,toggleRenderPreview:`切换渲染预览`,openInBrowser:`在浏览器中打开`,openInBrowserBtn:`在浏览器中打开`,fullscreenPreview:`全屏预览`,exitFullscreen:`退出全屏`,enterEditMode:`进入编辑模式`,edit:`编辑`,save:`保存`,saveChanges:`保存修改 (Ctrl+S)`,cancelChanges:`取消修改 (Esc)`,closePreview:`关闭预览`,close:`关闭`,confirm:`确定`,cancel:`取消`,switchToSourcePreview:`切换为源码预览`,switchToRenderPreview:`切换为渲染预览`,markdownRendered:`Markdown 渲染`,lineCount:`{count} 行`,linesModified:`{count} 行 · 已修改`,truncatedHint:`(仅显示前 {shown} 行,共 {total} 行,请下载查看完整内容)`,fileTooLargeNoPreview:`文件过大 ({size}),不支持预览,请直接下载`,fileTooLargeOpenInBrowser:`文件过大 ({size}),无法内置预览,请点击上方「在浏览器中打开」按钮查看`,previewFailed:`预览失败: {error}`,openFailed:`打开失败: {error}`,documentEmpty:`(文档为空)`,pptxEmptyOrFailed:`PPTX 文件为空或解析失败`,pageCount:`{count} 页`,prevPage:`上一页`,nextPage:`下一页`,zoomOut:`缩小`,zoomIn:`放大`,fitPage:`适应页面`,originalSize:`原始大小`,imageLoadFailed:`图片加载失败`,parsingExcel:`正在解析 Excel 文件...`,loadingData:`正在加载数据...`,requestFailed:`请求失败: {error}`,parseFailed:`解析失败: {error}`,noSheetsInWorkbook:`工作簿中没有工作表`,sheetNotFound:`未找到工作表数据`,emptySheet:`(空工作表)`,xlsxTruncatedHint:`仅显示前 {shown} 行,共 {total} 行,请下载查看完整内容`,unsupportedMediaHint:`⚠ 浏览器不支持播放此格式({ext}),请下载后使用本地播放器查看。`,uploading:`上传中...`,downloadInProgress:`下载中`,uploadInProgress:`上传中`,cancelUpload:`取消上传`,downloadCanceled:`下载已取消`,downloadFailed:`下载失败`,downloadFailedWithError:`下载失败: {error}`,savingToLocal:`正在由浏览器保存至本地...`,savedToLocal:`已保存至本地`,downloaded:`已下载: {name}`,downloadedCount:`已下载 {count} 个文件`,downloadedZip:`已下载 {count} 个文件(ZIP 压缩包)`,fileCount:`{count} 个文件`,uploadCanceled:`已取消上传`,uploadSuccessCount:`成功 {count}`,uploadSkippedCount:`跳过 {count}`,uploadFailedCount:`失败 {count}`,uploadComplete:`上传完成`,uploadCompleteWithStats:`上传完成 · {stats}`,uploadedFiles:`成功上传 {count} 个文件`,filesSkipped:`{count} 个文件已存在,跳过上传`,filesUploadFailed:`{count} 个文件上传失败`,uploadFailed:`上传失败`,uploadFailedWithStatus:`上传失败 ({status})`,parseResponseFailed:`解析响应失败`,networkError:`网络错误`,cannotMoveToSubdir:`不能将目录移动到其子目录中`,moving:`移动中...`,movedToDir:`"{name}" 已移动到目标目录`,movedToTarget:`"{name}" 已移动到 "{target}"`,moveFailed:`移动失败: {error}`,searching:`搜索中...`,confirmDeleteDir:`确定要删除目录 "{name}" 及其所有内容吗?
|
|
786
|
+
`}).join(``)}function Au(e,t){if(!t)return e;let n=R(e),r=t.split(/[&|]/).map(e=>e.trim()).filter(Boolean);if(r.length===0)return n;let i=r.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)),a=RegExp(`(${i.join(`|`)})`,`gi`);return n.replace(a,`<mark class="bookmark-highlight-match">$1</mark>`)}async function ju(e,t){if(!(!e||!t)){if(F.activeSessionId!==e)try{let n=F.activeSessionId;if(await Bt(e)===!1||F.activeSessionId!==e){await Su(e,t),Ou(),L(r(`bookmark.sessionNotExistToast`),`warning`);return}document.dispatchEvent(new CustomEvent(`session-switched`,{detail:{sessionId:e,previousSessionId:n,skipScrollRestore:!0}}));try{let{renderSessionTabs:e}=await I(async()=>{let{renderSessionTabs:e}=await Promise.resolve().then(()=>so);return{renderSessionTabs:e}},void 0);e()}catch(e){a.warn(`[BookmarkPanel] refreshsessionTab failed:`,e)}}catch(e){a.error(`[BookmarkPanel] switchsession failed:`,e);return}setTimeout(()=>{let n=document.getElementById(`chatContainer`);if(!n)return;let i=n.querySelector(`.message[data-message-id="${t}"]`);i?(i.scrollIntoView({behavior:`instant`,block:`nearest`}),i.classList.add(`bookmark-highlight`),setTimeout(()=>{i.classList.remove(`bookmark-highlight`)},2e3)):Su(e,t).then(()=>{Ou(),L(r(`bookmark.messageNotExistToast`),`warning`)})},500)}}function Mu(){let e=document.getElementById(`bookmarkPanelContainer`),t=F.bookmarks.length;e&&(e.style.display=t>0?``:`none`)}function Nu(){let e=document.getElementById(`chatContainer`);e&&e.querySelectorAll(`.message.assistant`).forEach(e=>{let t=e.querySelector(`.bookmark-btn`);if(!t)return;let n=e.dataset.messageId,r=F.activeSessionId;Pu(t,r,n)})}function Pu(e,t,n){bu(t,n)?(e.classList.add(`bookmarked`),e.title=r(`bookmark.removeBookmarkTitle`),e.querySelector(`svg`).setAttribute(`fill`,`currentColor`)):(e.classList.remove(`bookmarked`),e.title=r(`bookmark.addBookmarkTitle`),e.querySelector(`svg`).setAttribute(`fill`,`none`))}var Fu=t({createDir:()=>vd,deleteFs:()=>gd,downloadFile:()=>od,downloadFileStream:()=>fd,downloadFileStreamWithProgress:()=>pd,downloadFiles:()=>sd,downloadFilesStream:()=>md,downloadFilesStreamWithProgress:()=>hd,formatFileSize:()=>Ru,formatTime:()=>zu,getAgentConfig:()=>Yu,getAgentStatusDetail:()=>$u,getFileIcon:()=>Lu,getFileInfo:()=>bd,getHomeDir:()=>Zu,getMimeType:()=>Uu,getPreviewType:()=>Vu,getWorkspaceRoot:()=>Xu,isImageFile:()=>Hu,listDirectory:()=>rd,moveFs:()=>yd,readFileContent:()=>id,removeAllowedPath:()=>td,renameFs:()=>_d,resetWorkspaceRoot:()=>Qu,searchFilesRemote:()=>ud,supportsPreview:()=>Bu,switchWorkspace:()=>ed,writeFileContent:()=>ad});n(`zh`,{workspaceMgr:{agentNotPairedDetail:`Agent 未配对,请先在设置中完成配对`,agentNotPaired:`Agent 未配对`,requestFailed:`请求失败: {message}`,downloadFailed:`下载失败`,cancelled:`已取消`}}),n(`en`,{workspaceMgr:{agentNotPairedDetail:`Agent not paired. Please complete pairing in Settings first.`,agentNotPaired:`Agent not paired`,requestFailed:`Request failed: {message}`,downloadFailed:`Download failed`,cancelled:`Cancelled`}});var Iu={txt:`📄`,md:`📝`,json:`📋`,js:`📜`,mjs:`📜`,ts:`📘`,jsx:`⚛️`,tsx:`⚛️`,html:`🌐`,htm:`🌐`,css:`🎨`,scss:`🎨`,less:`🎨`,xml:`📰`,yaml:`📰`,yml:`📰`,py:`🐍`,java:`☕`,c:`⚙️`,cpp:`⚙️`,h:`⚙️`,go:`🔹`,rs:`🦀`,rb:`💎`,php:`🐘`,sql:`🗄️`,sh:`💻`,bash:`💻`,zsh:`💻`,cfg:`⚙️`,ini:`⚙️`,toml:`⚙️`,conf:`⚙️`,log:`📊`,csv:`📊`,tsv:`📊`,env:`🔒`,vue:`💚`,svelte:`🧡`,astro:`🚀`,rtf:`📄`,svg:`🖼️`,png:`🖼️`,jpg:`🖼️`,jpeg:`🖼️`,gif:`🖼️`,webp:`🖼️`,bmp:`🖼️`,ico:`🖼️`,pdf:`📕`,doc:`📘`,docx:`📘`,xls:`📗`,xlsx:`📗`,ppt:`📙`,pptx:`📙`,zip:`📦`,gz:`📦`,tar:`📦`,rar:`📦`,"7z":`📦`,mp3:`🎵`,wav:`🎵`,mp4:`🎬`,webm:`🎬`,avi:`🎬`};function Lu(e,t){return t===`directory`?`📁`:Iu[(e.split(`.`).pop()||``).toLowerCase()]||`📄`}function Ru(e){if(e===0)return`0 B`;if(e==null)return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=1024,r=Math.floor(Math.log(e)/Math.log(n));return`${(e/n**r).toFixed(r===0?0:1)} ${t[r]}`}function zu(e){return e?new Date(e).toLocaleString(`zh-CN`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):`—`}function Bu(e){let t=(e.split(`.`).pop()||``).toLowerCase();return new Set(`txt.md.json.js.mjs.ts.jsx.tsx.html.htm.css.scss.less.xml.yaml.yml.py.java.c.cpp.h.go.rs.rb.php.sql.sh.bash.zsh.cfg.ini.toml.conf.log.csv.tsv.env.vue.svelte.astro.rtf.svg.pdf.docx.pptx.xlsx.xls.png.jpg.jpeg.gif.webp.bmp.ico.mp4.webm.ogg.m4v.mov.mp3.wav.m4a.aac.flac.opus`.split(`.`)).has(t)}function Vu(e){let t=(e.split(`.`).pop()||``).toLowerCase();return t===`pdf`?`pdf`:t===`docx`?`docx`:t===`xlsx`||t===`xls`?`xlsx`:t===`pptx`?`pptx`:new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`]).has(t)?`image`:new Set([`mp4`,`webm`,`ogg`,`m4v`,`mov`]).has(t)?`video`:new Set([`mp3`,`wav`,`m4a`,`aac`,`flac`,`opus`]).has(t)?`audio`:`text`}function Hu(e){let t=(e.split(`.`).pop()||``).toLowerCase();return new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`svg`]).has(t)}function Uu(e){return{txt:`text/plain`,md:`text/markdown`,json:`application/json`,js:`application/javascript`,html:`text/html`,css:`text/css`,xml:`application/xml`,yaml:`text/yaml`,yml:`text/yaml`,csv:`text/csv`,svg:`image/svg+xml`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`,pdf:`application/pdf`,pptx:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,mp4:`video/mp4`,webm:`video/webm`,ogg:`video/ogg`,m4v:`video/x-m4v`,mov:`video/quicktime`,mp3:`audio/mpeg`,wav:`audio/wav`,m4a:`audio/mp4`,aac:`audio/aac`,flac:`audio/flac`,opus:`audio/ogg`}[(e.split(`.`).pop()||``).toLowerCase()]||`text/plain`}var Wu=null,Gu=null,Ku=null;function qu(e){if(e instanceof TypeError)return!0;let t=String(e&&e.message||``).toLowerCase();return t.includes(`failed to fetch`)||t.includes(`load failed`)||t.includes(`networkerror`)}function Ju(e,t){let n=t&&t.message;qu(t)?a.debug(`[WorkspaceManager] ${e} skipped (agent unreachable):`,n):a.warn(`[WorkspaceManager] ${e} failed:`,n)}async function Yu(){if(Ku&&Ku.url&&Ku.token)return Ku;try{let e=await chrome.storage.local.get([`pairedAgents`,`activeAgentId`]),t=e.pairedAgents||[],n=e.activeAgentId;if(!n||t.length===0)return null;let r=t.find(e=>e.id===n)||t[0];return r?(Ku={url:r.url,token:x(r.token)},Ku):null}catch(e){return a.warn(`[WorkspaceManager] getAgentconfiguration failed:`,e.message),null}}async function Xu(){if(Wu)return Wu;let e=await Yu();if(!e)return null;try{let t=await fetch(`${e.url}/api/status/detail`,{headers:{Authorization:`Bearer ${e.token}`}});if(t.ok){let e=await t.json();if(e.success&&e.workdir)return Wu=e.workdir,Wu}}catch(e){Ju(`get workingdirectory`,e)}return null}async function Zu(){if(Gu)return Gu;let e=await Yu();if(!e)return null;try{let t=await fetch(`${e.url}/api/status/detail`,{headers:{Authorization:`Bearer ${e.token}`}});if(t.ok){let e=await t.json();if(e.success&&e.homeDir)return Gu=e.homeDir,Gu}}catch(e){Ju(`get homedir`,e)}return null}function Qu(){Wu=null,Gu=null,Ku=null}async function $u(){let e=await Yu();if(!e)return null;try{let t=await fetch(`${e.url}/api/status/detail`,{headers:{Authorization:`Bearer ${e.token}`}});if(t.ok){let e=await t.json();if(e.success)return e}}catch(e){Ju(`get statusdetailcase`,e)}return null}async function ed(e){let t=await nd(`/api/config/workdir`,{workdir:e});return t.success&&Qu(),t}async function td(e){return nd(`/api/config/allowed-paths/remove`,{path:e})}async function nd(e,t={}){let n=await Yu();if(!n)return{success:!1,error:r(`workspaceMgr.agentNotPairedDetail`)};try{return await(await fetch(`${n.url}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n.token}`},body:JSON.stringify(t)})).json()}catch(e){return{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function rd(e){return nd(`/api/fs/list`,{path:e||`.`})}async function id(e){return nd(`/api/fs/read`,{path:e})}async function ad(e,t){return nd(`/api/fs/write`,{path:e,content:t})}async function od(e){return nd(`/api/fs/download`,{path:e})}async function sd(e){return nd(`/api/fs/download-multi`,{paths:e})}function cd(e){return(e||``).replace(/\\/g,`/`).replace(/\/+/g,`/`)}function ld(e){return e?!!(e.startsWith(`/`)||/^[a-zA-Z]:[\\/]/.test(e)||/^(\\\\|\/\/)[^\\/]+[\\/]/.test(e)):!1}async function ud(e,t,n=200){let r=await nd(`/api/fs/search_files`,{path:e,pattern:`*${t}*`,recursive:!0,maxResults:n});return r.success?(r.results||[]).map(t=>{let n=cd(ld(t.path)?t.path:`${e}/${t.path}`),r=n.substring(0,n.lastIndexOf(`/`));return{name:t.name,type:t.type||`file`,size:t.size,mtime:t.mtime,fullPath:n,matchPath:r}}):[]}function dd(e,t){if(!e)return t;let n=e.match(/filename\*=UTF-8''(.+?)(?:;|$)/)||e.match(/filename="(.+?)"/);return n?decodeURIComponent(n[1]):t}async function fd(e){let t=await Yu();if(!t)return{success:!1,error:r(`workspaceMgr.agentNotPairedDetail`)};try{let n=await fetch(`${t.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t.token}`},body:JSON.stringify({path:e})});return n.ok?{success:!0,blob:await n.blob(),name:dd(n.headers.get(`Content-Disposition`),e.split(/[\\/]/).pop()),mimeType:n.headers.get(`Content-Type`)}:{success:!1,error:(await n.json().catch(()=>({error:n.statusText}))).error||r(`workspaceMgr.downloadFailed`)}}catch(e){return{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function pd(e,t,n){let i=await Yu();if(!i)return{success:!1,error:r(`workspaceMgr.agentNotPaired`)};try{let a=await fetch(`${i.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i.token}`},body:JSON.stringify({path:e}),signal:n});if(!a.ok)return{success:!1,error:(await a.json().catch(()=>({error:a.statusText}))).error||r(`workspaceMgr.downloadFailed`)};let o=parseInt(a.headers.get(`Content-Length`)||`0`,10),s=a.body.getReader();n&&n.addEventListener(`abort`,()=>{try{s.cancel()}catch{}});let c=[],l=0;for(;;){let{done:e,value:n}=await s.read();if(e)break;c.push(n),l+=n.length,t&&o>0&&t({loaded:l,total:o,percent:Math.round(l/o*100)})}return{success:!0,blob:new Blob(c),name:dd(a.headers.get(`Content-Disposition`),e.split(/[\\/]/).pop()),mimeType:a.headers.get(`Content-Type`)}}catch(e){return e.name===`AbortError`?{success:!1,error:r(`workspaceMgr.cancelled`),aborted:!0}:{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function md(e){let t=await Yu();if(!t)return{success:!1,error:r(`workspaceMgr.agentNotPairedDetail`)};try{let n=await fetch(`${t.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t.token}`},body:JSON.stringify({paths:e})});return n.ok?{success:!0,blob:await n.blob(),name:dd(n.headers.get(`Content-Disposition`),`workspace.zip`),mimeType:n.headers.get(`Content-Type`)}:{success:!1,error:(await n.json().catch(()=>({error:n.statusText}))).error||r(`workspaceMgr.downloadFailed`)}}catch(e){return{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function hd(e,t,n){let i=await Yu();if(!i)return{success:!1,error:r(`workspaceMgr.agentNotPaired`)};try{let a=await fetch(`${i.url}/api/fs/download-stream`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i.token}`},body:JSON.stringify({paths:e}),signal:n});if(!a.ok)return{success:!1,error:(await a.json().catch(()=>({error:a.statusText}))).error||r(`workspaceMgr.downloadFailed`)};let o=parseInt(a.headers.get(`Content-Length`)||`0`,10),s=a.body.getReader();n&&n.addEventListener(`abort`,()=>{try{s.cancel()}catch{}});let c=[],l=0;for(;;){let{done:e,value:n}=await s.read();if(e)break;c.push(n),l+=n.length,t&&o>0&&t({loaded:l,total:o,percent:Math.round(l/o*100)})}return{success:!0,blob:new Blob(c),name:dd(a.headers.get(`Content-Disposition`),`workspace.zip`),mimeType:a.headers.get(`Content-Type`)}}catch(e){return e.name===`AbortError`?{success:!1,error:r(`workspaceMgr.cancelled`),aborted:!0}:{success:!1,error:r(`workspaceMgr.requestFailed`,{message:e.message})}}}async function gd(e){return nd(`/api/fs/delete`,{path:e})}async function _d(e,t){return nd(`/api/fs/rename`,{path:e,newName:t})}async function vd(e){return nd(`/api/fs/mkdir`,{path:e})}async function yd(e,t){return nd(`/api/fs/move`,{path:e,destDir:t})}async function bd(e){return nd(`/api/fs/stat`,{path:e})}n(`zh`,{imageHelper:{uploadToAgentTitle:`上传文件到Agent工作目录,大模型通过工具直接操作`,uploadAndExtractTitle:`上传文件并提取文本内容(支持PDF/Word/Excel/文本等)`,clickToEnlarge:`点击查看大图`,removeImage:`移除图片`,enableImageInputFirst:`请先开启图片输入功能`,screenshotSuccess:`截图成功`,screenshotFailed:`截图失败,请重试`,noActiveTab:`无法获取当前标签页`,cropFailed:`裁剪失败,请重试`,regionScreenshotFailed:`区域截图失败,请确保页面已加载且未被浏览器限制`,imageLoadFailed:`图片加载失败`,screenshotProcessFailed:`截图处理失败,请重试`}}),n(`en`,{imageHelper:{uploadToAgentTitle:`Upload files to Agent workspace; the model operates on them directly via tools`,uploadAndExtractTitle:`Upload files and extract text content (supports PDF/Word/Excel/text, etc.)`,clickToEnlarge:`Click to enlarge`,removeImage:`Remove image`,enableImageInputFirst:`Please enable image input first`,screenshotSuccess:`Screenshot captured`,screenshotFailed:`Screenshot failed, please retry`,noActiveTab:`Unable to get the current tab`,cropFailed:`Cropping failed, please retry`,regionScreenshotFailed:`Region screenshot failed. Make sure the page is loaded and not restricted by the browser.`,imageLoadFailed:`Image load failed`,screenshotProcessFailed:`Screenshot processing failed, please retry`}});function xd(){let e=document.getElementById(`imagePreviewBar`),t=document.getElementById(`screenshotBtn`);e&&(e.style.display=F.attachedImages.length>0?``:`none`),t&&(F.enableImageInput?t.style.removeProperty(`display`):t.style.display=`none`),Sd(),F.enableImageInput||(F.attachedImages=[]),wd()}function Sd(){let e=document.getElementById(`userInput`);e&&e.style.removeProperty(`padding-right`)}function Cd(){let e=document.getElementById(`fileAttachBtn`),t=document.getElementById(`fileInput`);e&&(e.style.display=F.enableFileInput?``:`none`),t&&(F.agentPlatform?.connected?(t.accept=`*`,e&&(e.title=r(`imageHelper.uploadToAgentTitle`))):(t.accept=`.pdf,.docx,.xlsx,.xls,.txt,.md,.json,.js,.jsx,.ts,.tsx,.html,.css,.scss,.less,.xml,.yaml,.yml,.py,.java,.c,.cpp,.h,.go,.rs,.rb,.php,.sql,.sh,.bash,.zsh,.cfg,.ini,.toml,.conf,.log,.csv,.tsv,.env,.vue,.svelte,.astro,.rtf`,e&&(e.title=r(`imageHelper.uploadAndExtractTitle`)))),Sd(),F.enableFileInput||gu()}function wd(){let e=document.getElementById(`imagePreviewBar`);if(e){if(e.innerHTML=``,F.attachedImages.length===0){e.style.display=`none`;return}e.style.display=``,F.attachedImages.forEach((t,n)=>{let i=document.createElement(`div`);i.className=`image-preview-item`;let a=document.createElement(`img`);a.src=t.dataUrl||t.compressedUrl||t.originalUrl,a.className=`image-preview-thumb`,a.title=r(`imageHelper.clickToEnlarge`),a.style.cursor=`zoom-in`,a.addEventListener(`click`,()=>{Tl(t.originalUrl||t.dataUrl||t.compressedUrl,a)});let o=document.createElement(`button`);o.className=`image-preview-remove`,o.innerHTML=`×`,o.title=r(`imageHelper.removeImage`),o.addEventListener(`click`,e=>{e.stopPropagation(),F.attachedImages.splice(n,1),wd()}),i.appendChild(a),i.appendChild(o),e.appendChild(i)})}}async function Td(){if(!F.enableImageInput){L(r(`imageHelper.enableImageInputFirst`));return}try{let e=await chrome.runtime.sendMessage({type:`CAPTURE_TAB`});e?.dataUrl&&(Nl(await(await fetch(e.dataUrl)).blob()),L(r(`imageHelper.screenshotSuccess`)))}catch(e){a.error(`[SidePanel] full page screenshot failed:`,e),L(r(`imageHelper.screenshotFailed`))}}async function Ed(){let e=await Ke();if(!e){L(r(`imageHelper.noActiveTab`));return}try{let t=await chrome.tabs.sendMessage(e,{type:`START_REGION_SELECTION`});if(!t)return;a.debug(`[SidePanel] regionselectresult:`,t);let n=await chrome.runtime.sendMessage({type:`CAPTURE_TAB`});if(!n?.dataUrl){L(r(`imageHelper.screenshotFailed`));return}let i=await Dd(n.dataUrl,t);if(!i){L(r(`imageHelper.cropFailed`));return}Nl(await(await fetch(i)).blob())}catch(e){a.error(`[SidePanel] region screenshot failed:`,e),L(r(`imageHelper.regionScreenshotFailed`))}}function Dd(e,t){return new Promise((n,i)=>{let a=new Image;a.onload=()=>{let e=document.createElement(`canvas`),r=window.devicePixelRatio||1,i=t.x*r,o=t.y*r,s=t.width*r,c=t.height*r;e.width=s,e.height=c,e.getContext(`2d`,{willReadFrequently:!0}).drawImage(a,i,o,s,c,0,0,s,c),n(e.toDataURL(`image/jpeg`,.85))},a.onerror=()=>i(Error(r(`imageHelper.imageLoadFailed`))),a.src=e})}async function Od(e,t,n){if(!F.enableImageInput){L(r(`imageHelper.enableImageInputFirst`));return}try{let i=e;t===`region`&&n&&(i=await Dd(e,n)),Nl(await(await fetch(i)).blob()),L(r(`imageHelper.screenshotSuccess`))}catch(e){a.error(`[SidePanel] pageshortcutscreenshotprocessing failed:`,e),L(r(`imageHelper.screenshotProcessFailed`))}}var kd=t({attachFilesForQuestion:()=>Ah,closePreview:()=>ym,closeWorkspacePanel:()=>sh,closeWorkspacePreview:()=>oh,initWorkspacePanel:()=>Qd,locateFileInWorkspace:()=>ih,openWorkspacePanel:()=>bf,previewArtifactFile:()=>ah,refreshWorkspacePanel:()=>Zm,resetAndRefreshWorkspace:()=>Qm,resolveWorkspaceAbsolutePath:()=>ch,updateWorkspacePanelVisibility:()=>$m});n(`zh`,{workspace:{workDir:`工作目录`,closePanel:`关闭面板`,embedMode:`嵌入模式`,floatMode:`浮窗模式`,openPanel:`打开工作目录面板`,narrowViewportHint:`视口过窄,已切回浮窗模式`,switchWorkdir:`切换工作目录`,backToParent:`返回上级目录`,uploadToCurrent:`上传文件到当前目录`,newFolder:`新建文件夹`,askSelectedFiles:`基于选中的文件进行问答`,downloadSelected:`下载选中的文件/目录(多选打包为ZIP)`,deleteSelected:`删除选中的文件`,clearSearch:`清除`,search:`搜索`,searchPlaceholder:`搜索...`,selectAllToggle:`全选/取消全选`,colName:`文件名`,colSize:`大小`,colTime:`修改时间`,noMatch:`未找到匹配的文件`,dirEmpty:`此目录为空`,noWorkspace:`无法获取工作目录,请确认 Agent 已连接`,loadDirFailed:`加载目录失败`,refreshFailed:`无法刷新,请确认 Agent 已连接`,agentNotConnected:`Agent 未连接`,agentNotConnectedUpload:`Agent 未连接,无法上传`,unsupportedFileType:`不支持的文件类型`,unknownError:`未知错误`,copiedFileName:`已复制文件名: {name}`,copiedPath:`已复制路径: {path}`,copyFailed:`复制失败`,copiedToClipboard:`已复制到剪贴板`,copyFailedManual:`复制失败,请手动选择复制`,getContentFailed:`获取内容失败`,codeCopiedToClipboard:`代码已复制到剪贴板`,copyUnsupportedType:`此文件类型不支持复制文本内容`,copiedToClipboardShort:`已复制到剪贴板`,clickToCopy:`点击复制`,preview:`预览`,previewBtn:`预览`,details:`详情`,download:`下载`,downloadFile:`下载文件`,rename:`重命名`,askFile:`基于文件问答`,delete:`删除`,copyAll:`复制`,copyAllTitle:`复制全部内容`,toggleRenderPreview:`切换渲染预览`,openInBrowser:`在浏览器中打开`,openInBrowserBtn:`在浏览器中打开`,fullscreenPreview:`全屏预览`,exitFullscreen:`退出全屏`,enterEditMode:`进入编辑模式`,edit:`编辑`,save:`保存`,saveChanges:`保存修改 (Ctrl+S)`,cancelChanges:`取消修改 (Esc)`,closePreview:`关闭预览`,close:`关闭`,confirm:`确定`,cancel:`取消`,switchToSourcePreview:`切换为源码预览`,switchToRenderPreview:`切换为渲染预览`,markdownRendered:`Markdown 渲染`,lineCount:`{count} 行`,linesModified:`{count} 行 · 已修改`,truncatedHint:`(仅显示前 {shown} 行,共 {total} 行,请下载查看完整内容)`,fileTooLargeNoPreview:`文件过大 ({size}),不支持预览,请直接下载`,fileTooLargeOpenInBrowser:`文件过大 ({size}),无法内置预览,请点击上方「在浏览器中打开」按钮查看`,previewFailed:`预览失败: {error}`,openFailed:`打开失败: {error}`,documentEmpty:`(文档为空)`,pptxEmptyOrFailed:`PPTX 文件为空或解析失败`,pageCount:`{count} 页`,prevPage:`上一页`,nextPage:`下一页`,zoomOut:`缩小`,zoomIn:`放大`,fitPage:`适应页面`,originalSize:`原始大小`,imageLoadFailed:`图片加载失败`,parsingExcel:`正在解析 Excel 文件...`,loadingData:`正在加载数据...`,requestFailed:`请求失败: {error}`,parseFailed:`解析失败: {error}`,noSheetsInWorkbook:`工作簿中没有工作表`,sheetNotFound:`未找到工作表数据`,emptySheet:`(空工作表)`,xlsxTruncatedHint:`仅显示前 {shown} 行,共 {total} 行,请下载查看完整内容`,unsupportedMediaHint:`⚠ 浏览器不支持播放此格式({ext}),请下载后使用本地播放器查看。`,uploading:`上传中...`,downloadInProgress:`下载中`,uploadInProgress:`上传中`,cancelUpload:`取消上传`,downloadCanceled:`下载已取消`,downloadFailed:`下载失败`,downloadFailedWithError:`下载失败: {error}`,savingToLocal:`正在由浏览器保存至本地...`,savedToLocal:`已保存至本地`,downloaded:`已下载: {name}`,downloadedCount:`已下载 {count} 个文件`,downloadedZip:`已下载 {count} 个文件(ZIP 压缩包)`,fileCount:`{count} 个文件`,uploadCanceled:`已取消上传`,uploadSuccessCount:`成功 {count}`,uploadSkippedCount:`跳过 {count}`,uploadFailedCount:`失败 {count}`,uploadComplete:`上传完成`,uploadCompleteWithStats:`上传完成 · {stats}`,uploadedFiles:`成功上传 {count} 个文件`,filesSkipped:`{count} 个文件已存在,跳过上传`,filesUploadFailed:`{count} 个文件上传失败`,uploadFailed:`上传失败`,uploadFailedWithStatus:`上传失败 ({status})`,parseResponseFailed:`解析响应失败`,networkError:`网络错误`,cannotMoveToSubdir:`不能将目录移动到其子目录中`,moving:`移动中...`,movedToDir:`"{name}" 已移动到目标目录`,movedToTarget:`"{name}" 已移动到 "{target}"`,moveFailed:`移动失败: {error}`,searching:`搜索中...`,confirmDeleteDir:`确定要删除目录 "{name}" 及其所有内容吗?
|
|
787
787
|
|
|
788
788
|
路径: {path}
|
|
789
789
|
类型: 目录
|
|
@@ -1129,7 +1129,7 @@ After removal, the AI will no longer be able to access this directory. You can s
|
|
|
1129
1129
|
<source src="${c}" type="${X(o)}">
|
|
1130
1130
|
</audio>
|
|
1131
1131
|
<div id="mediaUnsupportedHint" style="display:none;">${u}</div>
|
|
1132
|
-
</div>`;let d=i.querySelector(`video, audio`),f=i.querySelector(`#mediaUnsupportedHint`);if(d){let e=()=>{d.style.display=`none`,f&&(f.style.display=`block`)};d.addEventListener(`error`,e),i.querySelectorAll(`source`).forEach(t=>t.addEventListener(`error`,e))}}var Jp=!1;function Yp(e,t){let n=e.getBoundingClientRect();t.style.top=n.bottom+4+`px`;let r=n.right-160;t.style.left=Math.max(4,r)+`px`,t.style.right=`auto`}function Xp(e,t){Yp(e,t),t.classList.add(`show`)}function Zp(){let e=document.getElementById(`workspacePreviewExportMenu`),t=document.getElementById(`workspacePreviewExportBtn`),n=document.getElementById(`workspacePreviewExportDropdown`);if(!e||!t||!n)return;document.body.appendChild(n),t.addEventListener(`click`,e=>{e.stopPropagation(),n.classList.contains(`show`)?n.classList.remove(`show`):Xp(t,n)});let r=null,i=null;e.addEventListener(`mouseenter`,()=>{i&&=(clearTimeout(i),null),r=setTimeout(()=>{Xp(t,n)},200)}),e.addEventListener(`mouseleave`,()=>{r&&=(clearTimeout(r),null),i=setTimeout(()=>{!e.matches(`:hover`)&&!n.matches(`:hover`)&&n.classList.remove(`show`)},300)}),n.addEventListener(`mouseenter`,()=>{i&&=(clearTimeout(i),null)}),n.addEventListener(`mouseleave`,()=>{i=setTimeout(()=>{!e.matches(`:hover`)&&!n.matches(`:hover`)&&n.classList.remove(`show`)},200)}),n.querySelectorAll(`.ws-export-dropdown-item`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation();let r=e.dataset.exportType;n.classList.remove(`show`),$p(r)})}),document.addEventListener(`click`,t=>{!e.contains(t.target)&&!n.contains(t.target)&&n.classList.remove(`show`)});let a=()=>{n.classList.contains(`show`)&&Yp(t,n)};document.getElementById(`workspacePreviewContent`)?.addEventListener(`scroll`,a),window.addEventListener(`resize`,a)}function Qp(){return document.getElementById(`workspacePreviewArea`).dataset.markdownText||``}async function $p(e){if(Jp)return;Jp=!0;let t=document.getElementById(`workspacePreviewExportBtn`);document.getElementById(`workspacePreviewExportMenu`);let n=document.getElementById(`workspacePreviewExportDropdown`),i=document.getElementById(`workspacePreviewArea`).dataset.previewName||`export`,o=t.innerHTML;t.innerHTML=`<svg viewBox="0 0 24 24" fill="none" style="animation: spin 0.8s linear infinite; width: 14px; height: 14px; flex-shrink: 0;"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-dasharray="31.4" stroke-dashoffset="10" opacity="0.25"/><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-dasharray="31.4" stroke-dashoffset="10"/></svg>`,t.disabled=!0,t.style.opacity=`0.6`;try{switch(e){case`docx`:await nm(i);break;case`pdf`:await im(i);break;case`image`:await am(i);break;case`md`:om(i);break}}catch(e){a.error(`[WorkspacePanel] export failed:`,e),L(r(`chatExport.exportFailed`,{message:e.message}),`error`)}finally{Jp=!1,t.innerHTML=o,t.disabled=!1,t.style.opacity=`1`,n.classList.remove(`show`)}}async function em(e){if(typeof mermaid>`u`)return;let{renderMermaidInContainer:t,convertSvgsToImages:n}=await I(async()=>{let{renderMermaidInContainer:e,convertSvgsToImages:t}=await import(`./chat-export-
|
|
1132
|
+
</div>`;let d=i.querySelector(`video, audio`),f=i.querySelector(`#mediaUnsupportedHint`);if(d){let e=()=>{d.style.display=`none`,f&&(f.style.display=`block`)};d.addEventListener(`error`,e),i.querySelectorAll(`source`).forEach(t=>t.addEventListener(`error`,e))}}var Jp=!1;function Yp(e,t){let n=e.getBoundingClientRect();t.style.top=n.bottom+4+`px`;let r=n.right-160;t.style.left=Math.max(4,r)+`px`,t.style.right=`auto`}function Xp(e,t){Yp(e,t),t.classList.add(`show`)}function Zp(){let e=document.getElementById(`workspacePreviewExportMenu`),t=document.getElementById(`workspacePreviewExportBtn`),n=document.getElementById(`workspacePreviewExportDropdown`);if(!e||!t||!n)return;document.body.appendChild(n),t.addEventListener(`click`,e=>{e.stopPropagation(),n.classList.contains(`show`)?n.classList.remove(`show`):Xp(t,n)});let r=null,i=null;e.addEventListener(`mouseenter`,()=>{i&&=(clearTimeout(i),null),r=setTimeout(()=>{Xp(t,n)},200)}),e.addEventListener(`mouseleave`,()=>{r&&=(clearTimeout(r),null),i=setTimeout(()=>{!e.matches(`:hover`)&&!n.matches(`:hover`)&&n.classList.remove(`show`)},300)}),n.addEventListener(`mouseenter`,()=>{i&&=(clearTimeout(i),null)}),n.addEventListener(`mouseleave`,()=>{i=setTimeout(()=>{!e.matches(`:hover`)&&!n.matches(`:hover`)&&n.classList.remove(`show`)},200)}),n.querySelectorAll(`.ws-export-dropdown-item`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation();let r=e.dataset.exportType;n.classList.remove(`show`),$p(r)})}),document.addEventListener(`click`,t=>{!e.contains(t.target)&&!n.contains(t.target)&&n.classList.remove(`show`)});let a=()=>{n.classList.contains(`show`)&&Yp(t,n)};document.getElementById(`workspacePreviewContent`)?.addEventListener(`scroll`,a),window.addEventListener(`resize`,a)}function Qp(){return document.getElementById(`workspacePreviewArea`).dataset.markdownText||``}async function $p(e){if(Jp)return;Jp=!0;let t=document.getElementById(`workspacePreviewExportBtn`);document.getElementById(`workspacePreviewExportMenu`);let n=document.getElementById(`workspacePreviewExportDropdown`),i=document.getElementById(`workspacePreviewArea`).dataset.previewName||`export`,o=t.innerHTML;t.innerHTML=`<svg viewBox="0 0 24 24" fill="none" style="animation: spin 0.8s linear infinite; width: 14px; height: 14px; flex-shrink: 0;"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-dasharray="31.4" stroke-dashoffset="10" opacity="0.25"/><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-dasharray="31.4" stroke-dashoffset="10"/></svg>`,t.disabled=!0,t.style.opacity=`0.6`;try{switch(e){case`docx`:await nm(i);break;case`pdf`:await im(i);break;case`image`:await am(i);break;case`md`:om(i);break}}catch(e){a.error(`[WorkspacePanel] export failed:`,e),L(r(`chatExport.exportFailed`,{message:e.message}),`error`)}finally{Jp=!1,t.innerHTML=o,t.disabled=!1,t.style.opacity=`1`,n.classList.remove(`show`)}}async function em(e){if(typeof mermaid>`u`)return;let{renderMermaidInContainer:t,convertSvgsToImages:n}=await I(async()=>{let{renderMermaidInContainer:e,convertSvgsToImages:t}=await import(`./chat-export-CYBHjKQ4.js`);return{renderMermaidInContainer:e,convertSvgsToImages:t}},__vite__mapDeps([9,10,1,3,11,2,12,0]));await t(e),await n(e)}async function tm(e){if(typeof mermaid>`u`||!/```mermaid/i.test(e))return e;let{renderMermaidInContainer:t,convertSvgsToImages:n}=await I(async()=>{let{renderMermaidInContainer:e,convertSvgsToImages:t}=await import(`./chat-export-CYBHjKQ4.js`);return{renderMermaidInContainer:e,convertSvgsToImages:t}},__vite__mapDeps([9,10,1,3,11,2,12,0]));try{let r=Ca(e),i=document.createElement(`div`);i.style.cssText=`position:fixed;left:-9999px;top:-9999px;`,i.innerHTML=r,document.body.appendChild(i),await t(i),await n(i);let a=i.querySelectorAll(`.mermaid`),o=[];for(let e of a){let t=e.querySelector(`img`);t&&t.src&&t.src.startsWith(`data:`)?o.push(t.src):o.push(null)}if(document.body.removeChild(i),o.length===0)return e;let s=0;return e.replace(/```\s*mermaid\s*[\r\n]+([\s\S]*?)```/gi,e=>{let t=o[s];return s++,t?``:e})}catch(t){return a.warn(`[WorkspacePanel] Mermaid pre-render failed:`,t.message),e}}async function nm(e){let{Document:t,Packer:n,Paragraph:i,TextRun:a,HeadingLevel:o,Table:s,TableRow:c,TableCell:l,AlignmentType:u,WidthType:d,BorderStyle:f,ImageRun:p,ExternalHyperlink:m,convertInchesToTwip:h}=await I(async()=>{let{Document:e,Packer:t,Paragraph:n,TextRun:r,HeadingLevel:i,Table:a,TableRow:o,TableCell:s,AlignmentType:c,WidthType:l,BorderStyle:u,ImageRun:d,ExternalHyperlink:f,convertInchesToTwip:p}=await import(`./dist-LQPh1k0y.js`);return{Document:e,Packer:t,Paragraph:n,TextRun:r,HeadingLevel:i,Table:a,TableRow:o,TableCell:s,AlignmentType:c,WidthType:l,BorderStyle:u,ImageRun:d,ExternalHyperlink:f,convertInchesToTwip:p}},__vite__mapDeps([10,1])),g=Qp();if(!g){L(r(`chatExport.noContent`),`error`);return}g=await tm(g);let _=await rm(g),v=new t({styles:{default:{document:{run:{font:`Calibri`,size:22}},heading1:{run:{size:40,bold:!0,color:`333333`},paragraph:{spacing:{before:320,after:160}}},heading2:{run:{size:30,bold:!0,color:`333333`},paragraph:{spacing:{before:280,after:120}}},heading3:{run:{size:26,bold:!0,color:`333333`},paragraph:{spacing:{before:240,after:100}}}}},sections:[{properties:{page:{margin:{top:h(1),right:h(1),bottom:h(1),left:h(1)}}},children:_}]}),y=await n.toBlob(v),b=`word-${new Date().getTime()}.docx`;sm(y,b),L(r(`workspace.downloaded`,{name:b}),`success`)}async function rm(e){let{Document:t,Packer:n,Paragraph:r,TextRun:i,HeadingLevel:a,Table:o,TableRow:s,TableCell:c,AlignmentType:l,WidthType:u,BorderStyle:d,ImageRun:f,ExternalHyperlink:p,convertInchesToTwip:m}=await I(async()=>{let{Document:e,Packer:t,Paragraph:n,TextRun:r,HeadingLevel:i,Table:a,TableRow:o,TableCell:s,AlignmentType:c,WidthType:l,BorderStyle:u,ImageRun:d,ExternalHyperlink:f,convertInchesToTwip:p}=await import(`./dist-LQPh1k0y.js`);return{Document:e,Packer:t,Paragraph:n,TextRun:r,HeadingLevel:i,Table:a,TableRow:o,TableCell:s,AlignmentType:c,WidthType:l,BorderStyle:u,ImageRun:d,ExternalHyperlink:f,convertInchesToTwip:p}},__vite__mapDeps([10,1])),{createTextRuns:h}=await I(async()=>{let{createTextRuns:e}=await import(`./chat-export-CYBHjKQ4.js`);return{createTextRuns:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));if(!e||!e.trim())return[new r({children:[new i({text:``})]})];let g=[],_=e,v=[];_=_.replace(/```(\w*)\n([\s\S]*?)```/g,(e,t,n)=>{let r=v.length;return v.push({lang:t||``,code:n.trimEnd()}),`\n\n%%CODEBLOCK_${r}%%\n\n`});let y=[];_=_.replace(/<table[\s\S]*?<\/table>/gi,e=>{let t=y.length;return y.push(e),`\n\n%%HTMLTABLE_${t}%%\n\n`});let b=[];_=_.replace(/(?:^\|.+\|\s*$\n)+^\|[\s\-:|]+\|\s*$\n(?:^\|.+\|\s*$\n?)+/gm,e=>{let t=b.length;return b.push(e),`\n\n%%MDTABLE_${t}%%\n\n`});let x=_.split(/\n{2,}/).filter(e=>e.trim());function S(e){if(!e)return[];let t=/(\*\*(.+?)\*\*|(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)|__(.+?)__|(?<!_)_(?!_)(.+?)(?<!_)_(?!_)|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)|!\[([^\]]*)\]\(([^)]+)\))/,n=[],r=e;for(;r.length>0;){let e=r.match(t);if(!e){n.push(...h(r));break}let a=e.index;a>0&&n.push(...h(r.slice(0,a)));let o=e[1];if(e[2]!==void 0)n.push(...h(e[2],{bold:!0}));else if(e[3]!==void 0)n.push(...h(e[3],{italics:!0}));else if(e[4]!==void 0)n.push(...h(e[4],{bold:!0}));else if(e[5]!==void 0)n.push(...h(e[5],{italics:!0}));else if(e[6]!==void 0)n.push(new i({text:e[6],font:`Consolas`,size:20}));else if(e[7]!==void 0)n.push(new p({children:[new i({text:e[7],style:`Hyperlink`})],link:e[8]}));else if(e[9]!==void 0){let t=e[10];if(t.startsWith(`data:`))try{let[e,r]=t.split(`,`),i=e.match(/data:(image\/(\w+))/);if(i&&r){let e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);n.push(new f({data:t,transformation:{width:400,height:300},type:i[2]}))}}catch{n.push(new i({text:`[Image]`,italics:!0,color:`999999`}))}else n.push(new i({text:`[Image: `+(e[9]||t)+`]`,italics:!0,color:`999999`}))}r=r.slice(a+o.length)}return n}function C(e){let t=new DOMParser().parseFromString(e,`text/html`),n=[];return t.querySelectorAll(`tr`).forEach(e=>{let t=[];e.querySelectorAll(`th, td`).forEach(e=>t.push(e.textContent.trim())),t.length>0&&n.push(t)}),n}function w(e){let t=e.trim().split(`
|
|
1133
1133
|
`),n=[];for(let e of t){if(/^[\s\|:\-]+$/.test(e.replace(/\|/g,``)))continue;let t=Ta(e).slice(1,-1).map(e=>e.trim());t.length>0&&n.push(t)}return n}function T(e){if(e.length===0)return new r({children:[]});let t=Math.max(...e.map(e=>e.length));return new o({rows:e.map((e,n)=>{let i=[];for(let a=0;a<t;a++){let o=e[a]||``;i.push(new c({children:[new r({children:S(o),spacing:{before:40,after:40}})],shading:n===0?{fill:`F2F2F2`}:void 0,width:{size:100/t,type:u.PERCENTAGE}}))}return new s({children:i})}),width:{size:100,type:u.PERCENTAGE},borders:{top:{style:d.SINGLE,size:1,color:`DDDDDD`},bottom:{style:d.SINGLE,size:1,color:`DDDDDD`},left:{style:d.SINGLE,size:1,color:`DDDDDD`},right:{style:d.SINGLE,size:1,color:`DDDDDD`},insideHorizontal:{style:d.SINGLE,size:1,color:`DDDDDD`},insideVertical:{style:d.SINGLE,size:1,color:`DDDDDD`}}})}for(let e of x){let t=e.trim(),n=t.match(/^%%CODEBLOCK_(\d+)%%$/);if(n){let{lang:e,code:t}=v[parseInt(n[1])],a=e?`${e} code`:`code`;g.push(new r({children:[new i({text:a,bold:!0,font:`Consolas`,size:18})]}));let o=t.split(`
|
|
1134
1134
|
`);for(let e of o)g.push(new r({children:[new i({text:e||` `,font:`Consolas`,size:18})],spacing:{before:0,after:0,line:240},shading:{fill:`F5F5F5`}}));g.push(new r({children:[new i({text:``})]}));continue}let o=t.match(/^%%HTMLTABLE_(\d+)%%$/);if(o){let e=C(y[parseInt(o[1])]);e.length>0&&(g.push(T(e)),g.push(new r({children:[new i({text:``})]})));continue}let s=t.match(/^%%MDTABLE_(\d+)%%$/);if(s){let e=w(b[parseInt(s[1])]);g.push(T(e)),g.push(new r({children:[new i({text:``})]}));continue}let c=t.match(/^(#{1,6})\s+(.+)/);if(c){let e={1:a.HEADING_1,2:a.HEADING_2,3:a.HEADING_3,4:a.HEADING_4,5:a.HEADING_5,6:a.HEADING_6};g.push(new r({children:S(c[2]),heading:e[c[1].length]||a.HEADING_1,border:{bottom:{style:d.SINGLE,size:6,color:`EAECEF`}}}));let n=t.slice(c[0].length).replace(/^\n+/,``).trim();n&&g.push(new r({children:S(n),spacing:{before:60,after:60}}));continue}if(/^(---|\*\*\*|___)\s*$/.test(t)){g.push(new r({children:[],border:{bottom:{style:d.SINGLE,size:6,color:`CCCCCC`}},spacing:{before:200,after:200}}));continue}if(/^[\-\*\+]\s+/.test(t)){let t=e.split(/\n(?=[\-\*\+]\s+)/);for(let e of t)g.push(new r({children:S(e.replace(/^[\-\*\+]\s+/,``)),bullet:{level:0},spacing:{before:40,after:40}}));continue}if(/^\d+\.\s+/.test(t)){let t=e.split(/\n(?=\d+\.\s+)/);for(let e of t)g.push(new r({children:S(e.replace(/^\d+\.\s+/,``)),numbering:{reference:`default`,level:0},spacing:{before:40,after:40}}));continue}if(t.startsWith(`>`)){let t=e.split(`
|
|
1135
1135
|
`).map(e=>e.replace(/^>\s?/,``)).join(`
|
|
@@ -1575,7 +1575,7 @@ After removal, the AI will no longer be able to access this directory. You can s
|
|
|
1575
1575
|
... (点击展开查看完整输出)`,execResult:`执行结果`,statusFailed:`失败`,statusCompleted:`完成`,preselectFiltered:`从 {total} 个工具中筛选出 <strong>{count}</strong> 个:`,preselectSkippedAll:`跳过筛选({reason}),使用全部工具`,preselectSkippedCount:`跳过筛选({reason}),工具总数 {count}`,preselectDirectAnswer:`模型直接回答:`,toolPreselect:`工具预筛选`,toolsAfterFilter:`筛选后工具数:<strong>{count}</strong>`,listSeparator:`、`,totalNodes:`总节点`,successLabel:`成功`,failedLabel:`失败`,tokenLabel:`Token`,tokenUsageTitle:`Token 消耗: {total} (Prompt: {prompt}, Completion: {completion})`,thinkingProcess:`思考过程`,copyMarkdown:`复制 Markdown 内容 (Ctrl/Cmd + 点击复制富文本)`,copy:`复制`,quoteTitle:`引用该内容问答`,quote:`引用`,export:`导出`,exportWord:`导出 Word`,exportPdf:`导出 PDF`,exportImage:`导出图片`,exportMarkdown:`导出 Markdown`,executionLog:`执行日志`,reflectionRoundsTag:` ({count}轮)`,qualityAssessmentTitle:`AI 质量评估: {score}/10{rounds}
|
|
1576
1576
|
点击查看评估详情`,reflectionFailedTitle:`反思评估失败(点击查看执行日志)`,reflectionFailedBadge:`⚠️ 反思失败`,prototypeOpenedLocal:`已在本地浏览器打开,点击可在面板内查看`,viewUiPrototype:`查看 UI 原型`,bookmarkMessage:`收藏消息`,removeBookmark:`取消收藏`,forkSession:`从此处分叉会话(仅复制到此条消息)`,deleteMessage:`删除消息`,stopping:`停止中...`,taskStopped:`任务已被用户停止`,cancelled:`已取消`}}),n(`en`,{chatStream:{thinking:`Thinking...`,outputting:`Outputting...`,stopGenerating:`Stop generating`,thinkingResult:`Thinking result`,toolActionOperate:`Operate`,toolActionUpload:`Upload`,toolActionDownload:`Download`,toolActionRequest:`Request`,toolActionInteract:`Interact`,toolActionFill:`Fill`,toolActionDispatch:`Dispatch`,toolActionPreview:`Preview`,toolActionRead:`Read`,toolActionWrite:`Write`,terminateCommand:`Terminate command`,abortWaiting:`Abort waiting (skip current tool wait, does not terminate the actual process)`,executing:`Executing...`,terminating:`Terminating...`,copyCode:`Copy code`,truncatedTitle:`Original result too large, truncated for display`,truncatedNote:`(output too long, truncated)`,noOutput:`(no output)`,execFailed:`Execution failed`,clickToExpand:`
|
|
1577
1577
|
... (click to expand and view full output)`,execResult:`Execution result`,statusFailed:`Failed`,statusCompleted:`Completed`,preselectFiltered:`Filtered <strong>{count}</strong> of {total} tools: `,preselectSkippedAll:`Skipped filtering ({reason}), using all tools`,preselectSkippedCount:`Skipped filtering ({reason}), total tools: {count}`,preselectDirectAnswer:`Model direct answer: `,toolPreselect:`Tool Pre-filter`,toolsAfterFilter:`Tools after filtering: <strong>{count}</strong>`,listSeparator:`, `,totalNodes:`Total nodes`,successLabel:`Success`,failedLabel:`Failed`,tokenLabel:`Token`,tokenUsageTitle:`Token usage: {total} (Prompt: {prompt}, Completion: {completion})`,thinkingProcess:`Thinking process`,copyMarkdown:`Copy Markdown content (Ctrl/Cmd + click to copy rich text)`,copy:`Copy`,quoteTitle:`Quote this content for Q&A`,quote:`Quote`,export:`Export`,exportWord:`Export Word`,exportPdf:`Export PDF`,exportImage:`Export Image`,exportMarkdown:`Export Markdown`,executionLog:`Execution log`,reflectionRoundsTag:` ({count} rounds)`,qualityAssessmentTitle:`AI quality assessment: {score}/10{rounds}
|
|
1578
|
-
Click to view assessment details`,reflectionFailedTitle:`Reflection assessment failed (click to view execution log)`,reflectionFailedBadge:`⚠️ Reflection failed`,prototypeOpenedLocal:`Already opened in local browser, click to view in panel`,viewUiPrototype:`View UI prototype`,bookmarkMessage:`Bookmark message`,removeBookmark:`Remove bookmark`,forkSession:`Fork session from here (copy up to this message only)`,deleteMessage:`Delete message`,stopping:`Stopping...`,taskStopped:`Task stopped by user`,cancelled:`Cancelled`}});var R_=new Map,z_=!1,B_=!1,V_=!1,H_=!1;function U_(){let e=document.getElementById(`scrollToBottomBtn`),t=document.getElementById(`scrollToBottomBadge`);if(!e)return;let n=document.getElementById(`chatContainer`);if(!n)return;let r=n.scrollHeight-n.scrollTop-n.clientHeight<80;r?(e.classList.remove(`visible`),H_=!1):e.classList.add(`visible`),t&&(H_&&!r?(t.classList.add(`active`),F.isGenerating?t.classList.add(`pulsing`):t.classList.remove(`pulsing`)):t.classList.remove(`active`,`pulsing`))}function W_(){if(V_)return;let e=document.getElementById(`chatContainer`);e&&(V_=!0,e.addEventListener(`scroll`,()=>{if(z_)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;B_=!t,t?H_=!1:F.isGenerating&&(H_=!0),U_()},{passive:!0}),document.addEventListener(`generating-state-changed`,()=>{F.isGenerating&&(H_=!0),requestAnimationFrame(()=>U_())}))}function G_(e,t={}){if(!e)return;W_();let{force:n=!1,smooth:r=!1}=t;if(!n&&B_){H_=!0,U_();return}if(z_=!0,r){e.scrollTo({top:e.scrollHeight,behavior:`smooth`}),requestAnimationFrame(()=>{z_=!1});return}e.scrollTop=e.scrollHeight,requestAnimationFrame(()=>{B_||(e.scrollTop=e.scrollHeight),requestAnimationFrame(()=>{z_=!1})})}function K_(e){if(!e||!e.isConnected)return;let t=document.getElementById(`chatContainer`);t&&G_(t)}function q_(){B_=!1,H_=!1,F.isGenerating&&(H_=!0),U_()}function J_(){W_();let e=document.getElementById(`scrollToBottomBtn`);if(!e||e.dataset.bound)return;e.dataset.bound=`1`;let t=localStorage.getItem(`scrollBtnPosition`)||`center`;e.classList.add(`pos-${t}`);let n=!1,r=0,i=0,a=!1,o=0,s=!1;function c(){let t=document.getElementById(`chatContainer`);if(!t)return;let n=t.clientWidth,r={left:n/6,center:n/2,right:n*5/6},i=`center`,a=1/0;for(let[e,t]of Object.entries(r)){let n=Math.abs(o-t);n<a&&(a=n,i=e)}e.classList.remove(`pos-left`,`pos-center`,`pos-right`),e.classList.add(`pos-${i}`),e.style.left=``,e.style.marginLeft=``,e.style.right=``,localStorage.setItem(`scrollBtnPosition`,i)}function l(){let t=document.getElementById(`chatContainer`),n=e.getBoundingClientRect(),a=t?t.getBoundingClientRect():null,o=a?n.left-a.left+n.width/2:r;e.classList.remove(`pos-left`,`pos-center`,`pos-right`),e.style.left=`${o}px`,e.style.marginLeft=`0`,e.style.right=`auto`,e.classList.add(`dragging`),i=o,s=!0}function u(e){e.type===`mousedown`&&e.button!==0||(e.preventDefault(),n=!0,a=!1,s=!1,r=e.touches?e.touches[0].clientX:e.clientX)}function d(t){if(!n)return;let c=t.touches?t.touches[0].clientX:t.clientX;if(!s){if(Math.abs(c-r)<=3)return;a=!0,l()}let u=document.getElementById(`chatContainer`);if(!u)return;let d=u.getBoundingClientRect(),f=i+(c-r),p=e.offsetWidth/2;f=Math.max(p,Math.min(d.width-p,f)),o=f,e.style.left=`${f}px`}function f(){if(n){if(n=!1,a)e.classList.remove(`dragging`),c();else{s&&(e.classList.remove(`dragging`),e.style.left=``,e.style.marginLeft=``,e.style.right=``);let t=document.getElementById(`chatContainer`);t&&(B_=!1,H_=!1,U_(),G_(t,{force:!0,smooth:!0}))}a=!1,s=!1}}e.addEventListener(`mousedown`,u),e.addEventListener(`touchstart`,u,{passive:!1}),document.addEventListener(`mousemove`,d),document.addEventListener(`touchmove`,d,{passive:!1}),document.addEventListener(`mouseup`,f),document.addEventListener(`touchend`,f),U_()}function Y_(){W_();let e=document.getElementById(`chatContainer`);e&&(e.scrollHeight-e.scrollTop-e.clientHeight<80||(H_=!0),U_())}function X_(e,t){let n=e.querySelector(`.thinking-process-content`);if(!n)return;e.dataset.activeFilter=t,e.querySelectorAll(`.thinking-process-stat[data-filter]`).forEach(e=>{e.classList.toggle(`active`,e.dataset.filter===t)});let r=e=>t===`all`||e===t;n.querySelectorAll(`.tool-call-item`).forEach(e=>{e.classList.contains(`preselect-card`)||(e.style.display=r(e.dataset.status)?``:`none`)}),n.querySelectorAll(`.thinking-badge`).forEach(e=>{let t=r(e.dataset.status||`success`);e.style.display=t?``:`none`;let n=e.nextElementSibling;n&&n.classList.contains(`thinking-content`)&&(n.style.display=t?``:`none`)}),n.querySelectorAll(`.thinking-content`).forEach(e=>{let t=e.previousElementSibling;t&&t.classList.contains(`thinking-badge`)||(e.style.display=r(`success`)?``:`none`)})}function Z_(e){if(!e||e._filterBound)return;e._filterBound=!0;let t=[``,`success`,`failed`];e.querySelectorAll(`.thinking-process-stat`).forEach((e,n)=>{t[n]&&(e.dataset.filter=t[n],e.classList.add(`filterable`))}),e.querySelectorAll(`.token-stat`).forEach(e=>{e.style.cursor=`pointer`}),e.addEventListener(`click`,t=>{if(t.ctrlKey||t.metaKey)return;let n=t.target.closest(`.thinking-process-stat`),r=e.closest(`.thinking-process`);if(r){if(n&&n.classList.contains(`token-stat`)){let e=r.closest(`.message`);if(e)try{let t=e.dataset.executionLog,r=Ze(t?JSON.parse(t):[]);r&&rt(r,n)}catch{}return}n&&n.dataset.filter?X_(r,r.dataset.activeFilter===n.dataset.filter?`all`:n.dataset.filter):r.classList.toggle(`collapsed`)}});let n=e.closest(`.thinking-process`);n&&X_(n,n.dataset.activeFilter||`all`)}async function Q_(){try{let{getAllAgents:e}=await I(async()=>{let{getAllAgents:e}=await import(`./agent-store-
|
|
1578
|
+
Click to view assessment details`,reflectionFailedTitle:`Reflection assessment failed (click to view execution log)`,reflectionFailedBadge:`⚠️ Reflection failed`,prototypeOpenedLocal:`Already opened in local browser, click to view in panel`,viewUiPrototype:`View UI prototype`,bookmarkMessage:`Bookmark message`,removeBookmark:`Remove bookmark`,forkSession:`Fork session from here (copy up to this message only)`,deleteMessage:`Delete message`,stopping:`Stopping...`,taskStopped:`Task stopped by user`,cancelled:`Cancelled`}});var R_=new Map,z_=!1,B_=!1,V_=!1,H_=!1;function U_(){let e=document.getElementById(`scrollToBottomBtn`),t=document.getElementById(`scrollToBottomBadge`);if(!e)return;let n=document.getElementById(`chatContainer`);if(!n)return;let r=n.scrollHeight-n.scrollTop-n.clientHeight<80;r?(e.classList.remove(`visible`),H_=!1):e.classList.add(`visible`),t&&(H_&&!r?(t.classList.add(`active`),F.isGenerating?t.classList.add(`pulsing`):t.classList.remove(`pulsing`)):t.classList.remove(`active`,`pulsing`))}function W_(){if(V_)return;let e=document.getElementById(`chatContainer`);e&&(V_=!0,e.addEventListener(`scroll`,()=>{if(z_)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;B_=!t,t?H_=!1:F.isGenerating&&(H_=!0),U_()},{passive:!0}),document.addEventListener(`generating-state-changed`,()=>{F.isGenerating&&(H_=!0),requestAnimationFrame(()=>U_())}))}function G_(e,t={}){if(!e)return;W_();let{force:n=!1,smooth:r=!1}=t;if(!n&&B_){H_=!0,U_();return}if(z_=!0,r){e.scrollTo({top:e.scrollHeight,behavior:`smooth`}),requestAnimationFrame(()=>{z_=!1});return}e.scrollTop=e.scrollHeight,requestAnimationFrame(()=>{B_||(e.scrollTop=e.scrollHeight),requestAnimationFrame(()=>{z_=!1})})}function K_(e){if(!e||!e.isConnected)return;let t=document.getElementById(`chatContainer`);t&&G_(t)}function q_(){B_=!1,H_=!1,F.isGenerating&&(H_=!0),U_()}function J_(){W_();let e=document.getElementById(`scrollToBottomBtn`);if(!e||e.dataset.bound)return;e.dataset.bound=`1`;let t=localStorage.getItem(`scrollBtnPosition`)||`center`;e.classList.add(`pos-${t}`);let n=!1,r=0,i=0,a=!1,o=0,s=!1;function c(){let t=document.getElementById(`chatContainer`);if(!t)return;let n=t.clientWidth,r={left:n/6,center:n/2,right:n*5/6},i=`center`,a=1/0;for(let[e,t]of Object.entries(r)){let n=Math.abs(o-t);n<a&&(a=n,i=e)}e.classList.remove(`pos-left`,`pos-center`,`pos-right`),e.classList.add(`pos-${i}`),e.style.left=``,e.style.marginLeft=``,e.style.right=``,localStorage.setItem(`scrollBtnPosition`,i)}function l(){let t=document.getElementById(`chatContainer`),n=e.getBoundingClientRect(),a=t?t.getBoundingClientRect():null,o=a?n.left-a.left+n.width/2:r;e.classList.remove(`pos-left`,`pos-center`,`pos-right`),e.style.left=`${o}px`,e.style.marginLeft=`0`,e.style.right=`auto`,e.classList.add(`dragging`),i=o,s=!0}function u(e){e.type===`mousedown`&&e.button!==0||(e.preventDefault(),n=!0,a=!1,s=!1,r=e.touches?e.touches[0].clientX:e.clientX)}function d(t){if(!n)return;let c=t.touches?t.touches[0].clientX:t.clientX;if(!s){if(Math.abs(c-r)<=3)return;a=!0,l()}let u=document.getElementById(`chatContainer`);if(!u)return;let d=u.getBoundingClientRect(),f=i+(c-r),p=e.offsetWidth/2;f=Math.max(p,Math.min(d.width-p,f)),o=f,e.style.left=`${f}px`}function f(){if(n){if(n=!1,a)e.classList.remove(`dragging`),c();else{s&&(e.classList.remove(`dragging`),e.style.left=``,e.style.marginLeft=``,e.style.right=``);let t=document.getElementById(`chatContainer`);t&&(B_=!1,H_=!1,U_(),G_(t,{force:!0,smooth:!0}))}a=!1,s=!1}}e.addEventListener(`mousedown`,u),e.addEventListener(`touchstart`,u,{passive:!1}),document.addEventListener(`mousemove`,d),document.addEventListener(`touchmove`,d,{passive:!1}),document.addEventListener(`mouseup`,f),document.addEventListener(`touchend`,f),U_()}function Y_(){W_();let e=document.getElementById(`chatContainer`);e&&(e.scrollHeight-e.scrollTop-e.clientHeight<80||(H_=!0),U_())}function X_(e,t){let n=e.querySelector(`.thinking-process-content`);if(!n)return;e.dataset.activeFilter=t,e.querySelectorAll(`.thinking-process-stat[data-filter]`).forEach(e=>{e.classList.toggle(`active`,e.dataset.filter===t)});let r=e=>t===`all`||e===t;n.querySelectorAll(`.tool-call-item`).forEach(e=>{e.classList.contains(`preselect-card`)||(e.style.display=r(e.dataset.status)?``:`none`)}),n.querySelectorAll(`.thinking-badge`).forEach(e=>{let t=r(e.dataset.status||`success`);e.style.display=t?``:`none`;let n=e.nextElementSibling;n&&n.classList.contains(`thinking-content`)&&(n.style.display=t?``:`none`)}),n.querySelectorAll(`.thinking-content`).forEach(e=>{let t=e.previousElementSibling;t&&t.classList.contains(`thinking-badge`)||(e.style.display=r(`success`)?``:`none`)})}function Z_(e){if(!e||e._filterBound)return;e._filterBound=!0;let t=[``,`success`,`failed`];e.querySelectorAll(`.thinking-process-stat`).forEach((e,n)=>{t[n]&&(e.dataset.filter=t[n],e.classList.add(`filterable`))}),e.querySelectorAll(`.token-stat`).forEach(e=>{e.style.cursor=`pointer`}),e.addEventListener(`click`,t=>{if(t.ctrlKey||t.metaKey)return;let n=t.target.closest(`.thinking-process-stat`),r=e.closest(`.thinking-process`);if(r){if(n&&n.classList.contains(`token-stat`)){let e=r.closest(`.message`);if(e)try{let t=e.dataset.executionLog,r=Ze(t?JSON.parse(t):[]);r&&rt(r,n)}catch{}return}n&&n.dataset.filter?X_(r,r.dataset.activeFilter===n.dataset.filter?`all`:n.dataset.filter):r.classList.toggle(`collapsed`)}});let n=e.closest(`.thinking-process`);n&&X_(n,n.dataset.activeFilter||`all`)}async function Q_(){try{let{getAllAgents:e}=await I(async()=>{let{getAllAgents:e}=await import(`./agent-store-Cqyodrcc.js`).then(e=>e.t);return{getAllAgents:e}},__vite__mapDeps([0,1,2,3])),t=await e();R_.clear();for(let e of t)R_.set(e.id,e.name||e.id)}catch{}}function $_(e){return R_.get(e)||e}var ev=new Map,tv=new Map,nv=null,rv=0,iv=0;function av(e){return t=>t===void 0?ev.get(e)||null:(ev.set(e,t),t)}function ov(e){ev.delete(e),tv.delete(e)}function sv(e,t){tv.set(e,t)}function cv(){return nv}function lv(e){nv=e}function uv(e){rv=e}function dv(e){iv=e}function fv(e){}function pv(e){let t=document.getElementById(`chatContainer`),n=document.createElement(`div`);n.className=`message-wrapper assistant streaming`;let i=`msg_`+Date.now().toString(36)+`_`+Math.random().toString(36).substring(2,8);n.dataset.messageId=i,n.dataset.sessionId=e||``,n.innerHTML=`
|
|
1579
1579
|
<div class="message-content">
|
|
1580
1580
|
<div class="stream-content"></div>
|
|
1581
1581
|
<div class="thinking-indicator">
|
|
@@ -1729,7 +1729,7 @@ Click to view assessment details`,reflectionFailedTitle:`Reflection assessment f
|
|
|
1729
1729
|
<svg class="thinking-process-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1730
1730
|
<polyline points="6 9 12 15 18 9"/>
|
|
1731
1731
|
</svg>
|
|
1732
|
-
`,d){let e=p.querySelector(`.token-stat`);e&&(e.style.cursor=`pointer`,e.addEventListener(`click`,t=>{t.stopPropagation(),rt(d,e)}))}let g=document.createElement(`div`);g.className=`thinking-process-body`;let _=document.createElement(`div`);for(_.className=`thinking-process-content`,g.appendChild(_);l.firstChild;)_.appendChild(l.firstChild);let v=_.querySelectorAll(`.thinking-content`),y=e.trim();if(v.length>0){let e=v[v.length-1],t=e.textContent.trim();if(!s||s&&t===y){let t=e.previousElementSibling;for(;t;){if(t.classList.contains(`thinking-badge`)){t.remove();break}t=t.previousElementSibling}e.remove()}}if(_.children.length>0&&_.textContent.trim()){f.appendChild(p),f.appendChild(g);let t=document.createElement(`div`);t.className=`final-answer`,e&&e.trim()&&(t.innerHTML=Na(e));let n=c.querySelector(`.thinking-indicator`);n&&n.remove(),c.appendChild(f),c.appendChild(t),Z_(p)}else{let t=c.querySelector(`.thinking-indicator`);t&&t.remove(),e&&e.trim()&&(l.innerHTML=Na(e))}}else e&&e.trim()&&(l.innerHTML=Na(e))}e.classList.add(`assistant`,`message`),e.dataset.rawContent=typeof t==`string`?Sa(t):JSON.stringify(t),e.dataset.textContent_=Sa(Ev(t)),e.dataset.executionLog=JSON.stringify(n);let f=document.createElement(`div`);f.className=`message-footer`;let p=document.createElement(`button`);p.className=`copy-btn`,p.title=r(`chatStream.copyMarkdown`),p.innerHTML=[`<svg viewBox="0 0 16 16" fill="currentColor">`,`<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25z"/>`,`</svg>`,`<span>`+r(`chatStream.copy`)+`</span>`].join(``),p.addEventListener(`click`,t=>{t.stopPropagation(),x_(e,p,t)}),f.appendChild(p);let m=document.createElement(`button`);m.className=`quote-btn`,m.title=r(`chatStream.quoteTitle`),m.innerHTML=[`<svg t="1781246498458" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9645" width="14" height="14"><path d="M156.09136 606.57001a457.596822 457.596822 0 0 1 221.680239-392.516385 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z m406.752731 0a457.596822 457.596822 0 0 1 221.680239-392.007944 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z" fill="#8a8a8a" p-id="9646"></path></svg>`,`<span>`+r(`chatStream.quote`)+`</span>`].join(``),m.addEventListener(`click`,t=>{t.stopPropagation(),k_(e)}),f.appendChild(m);let h=document.createElement(`div`);h.className=`export-menu-container`;let g=document.createElement(`button`);g.className=`export-trigger-btn`,g.innerHTML=`<svg t="1781245244396" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5115" width="14" height="14"><path d="M496.213333 739.84c2.133333 2.133333 4.693333 3.84 7.68 5.12 0.853333 0.426667 2.133333 0.426667 2.986667 0.853333 1.706667 0.426667 2.986667 0.853333 4.693333 0.853334 5.546667 0 11.093333-2.133333 14.933334-6.4l256-256c8.533333-8.533333 8.533333-21.76 0-30.293334s-21.76-8.533333-30.293334 0L533.333333 674.133333V128c0-11.946667-9.386667-21.333333-21.333333-21.333333s-21.333333 9.386667-21.333333 21.333333v545.706667l-219.306667-219.306667c-8.533333-8.533333-21.76-8.533333-30.293333 0s-8.533333 21.76 0 30.293333l255.146666 255.146667zM768 874.666667H256c-11.946667 0-21.333333 9.386667-21.333333 21.333333s9.386667 21.333333 21.333333 21.333333h512c11.946667 0 21.333333-9.386667 21.333333-21.333333s-9.386667-21.333333-21.333333-21.333333z" fill="#8a8a8a" p-id="5116"></path></svg><span>`+r(`chatStream.export`)+`</span><svg class="dropdown-arrow" width="8" height="6" viewBox="0 0 8 6" fill="currentColor"><path d="M0 0l4 6 4-6z"/></svg>`;let _=document.createElement(`div`);_.className=`export-dropdown`,_.innerHTML=[`<button class="export-dropdown-item export-docx-item" type="button">`,`<svg t="1781245550030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6544" width="32" height="32"><path d="M747.936 901.171H276.819c-72.2 0-130.953-55.224-130.953-123.078V244.721c0-67.854 58.752-123.078 130.953-123.078h383.525c6.597 0 12.937 2.505 17.795 6.954l192.363 178.046c5.317 4.96 8.386 11.914 8.386 19.227v452.223c0 67.854-58.752 123.078-130.952 123.078zM276.819 174.004c-43.31 0-78.592 31.703-78.592 70.717v533.372c0 39.015 35.282 70.718 78.592 70.718h471.117c43.31 0 78.592-31.703 78.592-70.718V337.324l-176.461-163.32H276.819z" fill="#8a8a8a" p-id="6545"></path><path d="M830.567 331.546H669.446c-14.471 0-26.18-11.71-26.18-26.181V156.209c0-14.471 11.709-26.18 26.18-26.18s26.181 11.709 26.181 26.18v122.976h134.94c14.471 0 26.181 11.709 26.181 26.18s-11.711 26.181-26.181 26.181z" fill="#8a8a8a" p-id="6546"></path><path d="M730.214 428.749l-92.04 343.616h-53.179L511.363 498.29l-75.677 274.074h-53.179l-92.04-343.616h49.088l69.542 255.667 69.541-255.667h63.406l69.541 255.667 69.541-255.667h49.088z" fill="#8a8a8a" p-id="6547"></path></svg>`,`<span>`+r(`chatStream.exportWord`)+`</span>`,`</button>`,`<button class="export-dropdown-item export-pdf-item" type="button">`,`<svg t="1781245863206" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8152" width="32" height="32"><path d="M582.4 864H170.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V170.666667c0-6.4 4.266667-10.666667 10.666667-10.666667h309.333333V320c0 40.533333 34.133333 74.666667 74.666667 74.666667h160v38.4c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V298.666667c0-8.533333-4.266667-17.066667-8.533334-23.466667l-170.666666-170.666667c-6.4-6.4-14.933333-8.533333-23.466667-8.533333H170.666667C130.133333 96 96 130.133333 96 170.666667v682.666666c0 40.533333 34.133333 74.666667 74.666667 74.666667h411.733333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z m132.266667-550.4v17.066667H554.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V160h19.2l151.466667 153.6z" fill="#8a8a8a" p-id="8153"></path><path d="M332.8 533.333333c-12.8 0-19.2 2.133333-25.6 6.4-6.4 4.266667-8.533333 12.8-8.533333 23.466667v206.933333c0 6.4 2.133333 12.8 6.4 19.2 4.266667 4.266667 10.666667 8.533333 21.333333 8.533334s17.066667-4.266667 21.333333-8.533334c4.266667-4.266667 6.4-10.666667 6.4-19.2v-64h32c57.6 0 89.6-29.866667 89.6-87.466666 0-27.733333-8.533333-51.2-23.466666-64-14.933333-14.933333-36.266667-21.333333-66.133334-21.333334h-53.333333z m87.466667 85.333334c0 12.8-2.133333 23.466667-8.533334 27.733333-4.266667 4.266667-14.933333 8.533333-27.733333 8.533333h-32v-70.4H384c12.8 0 21.333333 2.133333 27.733333 8.533334 6.4 4.266667 8.533333 12.8 8.533334 25.6zM667.733333 571.733333c-8.533333-12.8-21.333333-21.333333-34.133333-29.866666-14.933333-4.266667-32-8.533333-51.2-8.533334h-61.866667c-8.533333 0-17.066667 0-23.466666 8.533334-2.133333 4.266667-4.266667 10.666667-4.266667 19.2V768c0 8.533333 2.133333 14.933333 4.266667 19.2 6.4 8.533333 14.933333 8.533333 23.466666 8.533333h64c19.2 0 34.133333-4.266667 49.066667-10.666666 12.8-6.4 25.6-17.066667 34.133333-29.866667 8.533333-12.8 14.933333-25.6 19.2-42.666667 4.266667-14.933333 6.4-32 6.4-49.066666 0-17.066667-2.133333-34.133333-6.4-49.066667-4.266667-14.933333-10.666667-29.866667-19.2-42.666667z m-42.666666 153.6c-8.533333 12.8-21.333333 19.2-38.4 19.2h-38.4v-160H576c21.333333 0 38.4 6.4 46.933333 19.2 10.666667 12.8 14.933333 34.133333 14.933334 59.733334 2.133333 27.733333-4.266667 46.933333-12.8 61.866666zM851.2 533.333333h-106.666667c-8.533333 0-17.066667 2.133333-21.333333 6.4-6.4 4.266667-8.533333 12.8-8.533333 21.333334v209.066666c0 6.4 2.133333 12.8 6.4 17.066667 4.266667 6.4 10.666667 8.533333 21.333333 8.533333 8.533333 0 17.066667-2.133333 21.333333-8.533333 2.133333-4.266667 6.4-8.533333 6.4-19.2v-85.333333h72.533334c12.8 0 23.466667-6.4 25.6-17.066667 2.133333-8.533333 2.133333-14.933333 0-17.066667-2.133333-4.266667-6.4-17.066667-25.6-17.066666H768v-49.066667h81.066667c8.533333 0 14.933333-2.133333 19.2-4.266667 4.266667-2.133333 8.533333-8.533333 8.533333-21.333333 2.133333-12.8-8.533333-23.466667-25.6-23.466667z" fill="#8a8a8a" p-id="8154"></path></svg>`,`<span>`+r(`chatStream.exportPdf`)+`</span>`,`</button>`,`<button class="export-dropdown-item export-image-item" type="button">`,`<svg t="1784207887308" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5993" width="32" height="32"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#8a8a8a" p-id="5994"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#8a8a8a" p-id="5995"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#8a8a8a" p-id="5996"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#8a8a8a" p-id="5997"></path></svg>`,`<span>`+r(`chatStream.exportImage`)+`</span>`,`</button>`,`<button class="export-dropdown-item export-md-item" type="button">`,`<svg t="1784038824502" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1666" width="32" height="32"><path d="M601.216 85.333333a42.666667 42.666667 0 0 1 30.485333 12.821334l209.450667 213.973333a42.666667 42.666667 0 0 1 12.181333 29.866667V853.333333a85.333333 85.333333 0 0 1-85.333333 85.333334H256a85.333333 85.333333 0 0 1-85.333333-85.333334V170.666667a85.333333 85.333333 0 0 1 85.333333-85.333334h345.216z m-35.584 64H256a21.333333 21.333333 0 0 0-21.333333 21.333334v682.666666a21.333333 21.333333 0 0 0 21.333333 21.333334h512a21.333333 21.333333 0 0 0 21.333333-21.333334V395.413333h-191.68a32 32 0 0 1-32-32L565.632 149.333333z m64 38.186667v143.893333h140.821333L629.632 187.52z" fill="#8a8a8a" p-id="1667"></path><path d="M384.341333 800l-3.072-0.106667a32 32 0 0 1-29.162666-34.624l21.973333-256c2.752-32.256 46.165333-40.490667 60.544-11.477333l77.290667 156.010667 78.805333-156.224c14.08-27.925333 55.082667-20.906667 60.074667 8.789333l0.384 3.050667 20.714666 256a32 32 0 0 1-63.786666 5.162666l-11.541334-142.549333-56.341333 111.722667c-11.413333 22.613333-42.88 23.381333-55.744 2.517333l-1.493333-2.730667-54.912-110.826666-12.181334 142.016a32 32 0 0 1-31.552 29.269333z" fill="#8a8a8a" p-id="1668"></path></svg>`,`<span>`+r(`chatStream.exportMarkdown`)+`</span>`,`</button>`].join(``);let v=_.querySelector(`.export-docx-item`);v.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToDocx:n}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToDocx:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,v,_)});let y=_.querySelector(`.export-md-item`);y.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToMarkdown:n}=await I(async()=>{let{exportAssistantMessageToMarkdown:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToMarkdown:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,y,_)});let b=_.querySelector(`.export-pdf-item`);b.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToPdf:n}=await I(async()=>{let{exportAssistantMessageToPdf:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToPdf:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,b,_)});let x=_.querySelector(`.export-image-item`);x.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToImage:n}=await I(async()=>{let{exportAssistantMessageToImage:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToImage:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,x,_)}),g.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==_&&e.classList.remove(`show`)}),_.classList.toggle(`show`)});let S=null;h.addEventListener(`mouseenter`,()=>{S=setTimeout(()=>{document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==_&&e.classList.remove(`show`)}),_.classList.add(`show`)},300)}),h.addEventListener(`mouseleave`,()=>{S&&=(clearTimeout(S),null),setTimeout(()=>{!h.matches(`:hover`)&&!_.matches(`:hover`)&&_.classList.remove(`show`)},100)}),h.appendChild(g),h.appendChild(_),f.appendChild(h);let C=document.createElement(`div`);C.className=`footer-right-actions`,C.style.marginLeft=`auto`,C.style.display=`flex`,C.style.alignItems=`center`,C.style.gap=`8px`;let w=Ze(n);if(w){let e=document.createElement(`span`);e.className=`token-usage-tag`,e.title=r(`chatStream.tokenUsageTitle`,{total:z(w.totalTokens),prompt:z(w.promptTokens),completion:z(w.completionTokens)}),e.innerHTML=`<span class="token-tag-icon">⬤</span><span class="token-tag-value">${z(w.totalTokens)}</span>`,e.style.cursor=`pointer`,e.addEventListener(`click`,t=>{t.stopPropagation(),rt(w,e)}),C.appendChild(e)}let T=ng(t),E=ag(n,t);if(T.length&&(e.dataset.declaredArtifacts=JSON.stringify(T)),Cg(E),E.length>0){let e=document.createElement(`button`);e.className=`artifacts-btn`,e.type=`button`,e.title=r(`artifacts.btnTitle`,{count:E.length}),e.innerHTML=`
|
|
1732
|
+
`,d){let e=p.querySelector(`.token-stat`);e&&(e.style.cursor=`pointer`,e.addEventListener(`click`,t=>{t.stopPropagation(),rt(d,e)}))}let g=document.createElement(`div`);g.className=`thinking-process-body`;let _=document.createElement(`div`);for(_.className=`thinking-process-content`,g.appendChild(_);l.firstChild;)_.appendChild(l.firstChild);let v=_.querySelectorAll(`.thinking-content`),y=e.trim();if(v.length>0){let e=v[v.length-1],t=e.textContent.trim();if(!s||s&&t===y){let t=e.previousElementSibling;for(;t;){if(t.classList.contains(`thinking-badge`)){t.remove();break}t=t.previousElementSibling}e.remove()}}if(_.children.length>0&&_.textContent.trim()){f.appendChild(p),f.appendChild(g);let t=document.createElement(`div`);t.className=`final-answer`,e&&e.trim()&&(t.innerHTML=Na(e));let n=c.querySelector(`.thinking-indicator`);n&&n.remove(),c.appendChild(f),c.appendChild(t),Z_(p)}else{let t=c.querySelector(`.thinking-indicator`);t&&t.remove(),e&&e.trim()&&(l.innerHTML=Na(e))}}else e&&e.trim()&&(l.innerHTML=Na(e))}e.classList.add(`assistant`,`message`),e.dataset.rawContent=typeof t==`string`?Sa(t):JSON.stringify(t),e.dataset.textContent_=Sa(Ev(t)),e.dataset.executionLog=JSON.stringify(n);let f=document.createElement(`div`);f.className=`message-footer`;let p=document.createElement(`button`);p.className=`copy-btn`,p.title=r(`chatStream.copyMarkdown`),p.innerHTML=[`<svg viewBox="0 0 16 16" fill="currentColor">`,`<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25z"/>`,`</svg>`,`<span>`+r(`chatStream.copy`)+`</span>`].join(``),p.addEventListener(`click`,t=>{t.stopPropagation(),x_(e,p,t)}),f.appendChild(p);let m=document.createElement(`button`);m.className=`quote-btn`,m.title=r(`chatStream.quoteTitle`),m.innerHTML=[`<svg t="1781246498458" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9645" width="14" height="14"><path d="M156.09136 606.57001a457.596822 457.596822 0 0 1 221.680239-392.516385 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z m406.752731 0a457.596822 457.596822 0 0 1 221.680239-392.007944 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z" fill="#8a8a8a" p-id="9646"></path></svg>`,`<span>`+r(`chatStream.quote`)+`</span>`].join(``),m.addEventListener(`click`,t=>{t.stopPropagation(),k_(e)}),f.appendChild(m);let h=document.createElement(`div`);h.className=`export-menu-container`;let g=document.createElement(`button`);g.className=`export-trigger-btn`,g.innerHTML=`<svg t="1781245244396" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5115" width="14" height="14"><path d="M496.213333 739.84c2.133333 2.133333 4.693333 3.84 7.68 5.12 0.853333 0.426667 2.133333 0.426667 2.986667 0.853333 1.706667 0.426667 2.986667 0.853333 4.693333 0.853334 5.546667 0 11.093333-2.133333 14.933334-6.4l256-256c8.533333-8.533333 8.533333-21.76 0-30.293334s-21.76-8.533333-30.293334 0L533.333333 674.133333V128c0-11.946667-9.386667-21.333333-21.333333-21.333333s-21.333333 9.386667-21.333333 21.333333v545.706667l-219.306667-219.306667c-8.533333-8.533333-21.76-8.533333-30.293333 0s-8.533333 21.76 0 30.293333l255.146666 255.146667zM768 874.666667H256c-11.946667 0-21.333333 9.386667-21.333333 21.333333s9.386667 21.333333 21.333333 21.333333h512c11.946667 0 21.333333-9.386667 21.333333-21.333333s-9.386667-21.333333-21.333333-21.333333z" fill="#8a8a8a" p-id="5116"></path></svg><span>`+r(`chatStream.export`)+`</span><svg class="dropdown-arrow" width="8" height="6" viewBox="0 0 8 6" fill="currentColor"><path d="M0 0l4 6 4-6z"/></svg>`;let _=document.createElement(`div`);_.className=`export-dropdown`,_.innerHTML=[`<button class="export-dropdown-item export-docx-item" type="button">`,`<svg t="1781245550030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6544" width="32" height="32"><path d="M747.936 901.171H276.819c-72.2 0-130.953-55.224-130.953-123.078V244.721c0-67.854 58.752-123.078 130.953-123.078h383.525c6.597 0 12.937 2.505 17.795 6.954l192.363 178.046c5.317 4.96 8.386 11.914 8.386 19.227v452.223c0 67.854-58.752 123.078-130.952 123.078zM276.819 174.004c-43.31 0-78.592 31.703-78.592 70.717v533.372c0 39.015 35.282 70.718 78.592 70.718h471.117c43.31 0 78.592-31.703 78.592-70.718V337.324l-176.461-163.32H276.819z" fill="#8a8a8a" p-id="6545"></path><path d="M830.567 331.546H669.446c-14.471 0-26.18-11.71-26.18-26.181V156.209c0-14.471 11.709-26.18 26.18-26.18s26.181 11.709 26.181 26.18v122.976h134.94c14.471 0 26.181 11.709 26.181 26.18s-11.711 26.181-26.181 26.181z" fill="#8a8a8a" p-id="6546"></path><path d="M730.214 428.749l-92.04 343.616h-53.179L511.363 498.29l-75.677 274.074h-53.179l-92.04-343.616h49.088l69.542 255.667 69.541-255.667h63.406l69.541 255.667 69.541-255.667h49.088z" fill="#8a8a8a" p-id="6547"></path></svg>`,`<span>`+r(`chatStream.exportWord`)+`</span>`,`</button>`,`<button class="export-dropdown-item export-pdf-item" type="button">`,`<svg t="1781245863206" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8152" width="32" height="32"><path d="M582.4 864H170.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V170.666667c0-6.4 4.266667-10.666667 10.666667-10.666667h309.333333V320c0 40.533333 34.133333 74.666667 74.666667 74.666667h160v38.4c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V298.666667c0-8.533333-4.266667-17.066667-8.533334-23.466667l-170.666666-170.666667c-6.4-6.4-14.933333-8.533333-23.466667-8.533333H170.666667C130.133333 96 96 130.133333 96 170.666667v682.666666c0 40.533333 34.133333 74.666667 74.666667 74.666667h411.733333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z m132.266667-550.4v17.066667H554.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V160h19.2l151.466667 153.6z" fill="#8a8a8a" p-id="8153"></path><path d="M332.8 533.333333c-12.8 0-19.2 2.133333-25.6 6.4-6.4 4.266667-8.533333 12.8-8.533333 23.466667v206.933333c0 6.4 2.133333 12.8 6.4 19.2 4.266667 4.266667 10.666667 8.533333 21.333333 8.533334s17.066667-4.266667 21.333333-8.533334c4.266667-4.266667 6.4-10.666667 6.4-19.2v-64h32c57.6 0 89.6-29.866667 89.6-87.466666 0-27.733333-8.533333-51.2-23.466666-64-14.933333-14.933333-36.266667-21.333333-66.133334-21.333334h-53.333333z m87.466667 85.333334c0 12.8-2.133333 23.466667-8.533334 27.733333-4.266667 4.266667-14.933333 8.533333-27.733333 8.533333h-32v-70.4H384c12.8 0 21.333333 2.133333 27.733333 8.533334 6.4 4.266667 8.533333 12.8 8.533334 25.6zM667.733333 571.733333c-8.533333-12.8-21.333333-21.333333-34.133333-29.866666-14.933333-4.266667-32-8.533333-51.2-8.533334h-61.866667c-8.533333 0-17.066667 0-23.466666 8.533334-2.133333 4.266667-4.266667 10.666667-4.266667 19.2V768c0 8.533333 2.133333 14.933333 4.266667 19.2 6.4 8.533333 14.933333 8.533333 23.466666 8.533333h64c19.2 0 34.133333-4.266667 49.066667-10.666666 12.8-6.4 25.6-17.066667 34.133333-29.866667 8.533333-12.8 14.933333-25.6 19.2-42.666667 4.266667-14.933333 6.4-32 6.4-49.066666 0-17.066667-2.133333-34.133333-6.4-49.066667-4.266667-14.933333-10.666667-29.866667-19.2-42.666667z m-42.666666 153.6c-8.533333 12.8-21.333333 19.2-38.4 19.2h-38.4v-160H576c21.333333 0 38.4 6.4 46.933333 19.2 10.666667 12.8 14.933333 34.133333 14.933334 59.733334 2.133333 27.733333-4.266667 46.933333-12.8 61.866666zM851.2 533.333333h-106.666667c-8.533333 0-17.066667 2.133333-21.333333 6.4-6.4 4.266667-8.533333 12.8-8.533333 21.333334v209.066666c0 6.4 2.133333 12.8 6.4 17.066667 4.266667 6.4 10.666667 8.533333 21.333333 8.533333 8.533333 0 17.066667-2.133333 21.333333-8.533333 2.133333-4.266667 6.4-8.533333 6.4-19.2v-85.333333h72.533334c12.8 0 23.466667-6.4 25.6-17.066667 2.133333-8.533333 2.133333-14.933333 0-17.066667-2.133333-4.266667-6.4-17.066667-25.6-17.066666H768v-49.066667h81.066667c8.533333 0 14.933333-2.133333 19.2-4.266667 4.266667-2.133333 8.533333-8.533333 8.533333-21.333333 2.133333-12.8-8.533333-23.466667-25.6-23.466667z" fill="#8a8a8a" p-id="8154"></path></svg>`,`<span>`+r(`chatStream.exportPdf`)+`</span>`,`</button>`,`<button class="export-dropdown-item export-image-item" type="button">`,`<svg t="1784207887308" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5993" width="32" height="32"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#8a8a8a" p-id="5994"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#8a8a8a" p-id="5995"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#8a8a8a" p-id="5996"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#8a8a8a" p-id="5997"></path></svg>`,`<span>`+r(`chatStream.exportImage`)+`</span>`,`</button>`,`<button class="export-dropdown-item export-md-item" type="button">`,`<svg t="1784038824502" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1666" width="32" height="32"><path d="M601.216 85.333333a42.666667 42.666667 0 0 1 30.485333 12.821334l209.450667 213.973333a42.666667 42.666667 0 0 1 12.181333 29.866667V853.333333a85.333333 85.333333 0 0 1-85.333333 85.333334H256a85.333333 85.333333 0 0 1-85.333333-85.333334V170.666667a85.333333 85.333333 0 0 1 85.333333-85.333334h345.216z m-35.584 64H256a21.333333 21.333333 0 0 0-21.333333 21.333334v682.666666a21.333333 21.333333 0 0 0 21.333333 21.333334h512a21.333333 21.333333 0 0 0 21.333333-21.333334V395.413333h-191.68a32 32 0 0 1-32-32L565.632 149.333333z m64 38.186667v143.893333h140.821333L629.632 187.52z" fill="#8a8a8a" p-id="1667"></path><path d="M384.341333 800l-3.072-0.106667a32 32 0 0 1-29.162666-34.624l21.973333-256c2.752-32.256 46.165333-40.490667 60.544-11.477333l77.290667 156.010667 78.805333-156.224c14.08-27.925333 55.082667-20.906667 60.074667 8.789333l0.384 3.050667 20.714666 256a32 32 0 0 1-63.786666 5.162666l-11.541334-142.549333-56.341333 111.722667c-11.413333 22.613333-42.88 23.381333-55.744 2.517333l-1.493333-2.730667-54.912-110.826666-12.181334 142.016a32 32 0 0 1-31.552 29.269333z" fill="#8a8a8a" p-id="1668"></path></svg>`,`<span>`+r(`chatStream.exportMarkdown`)+`</span>`,`</button>`].join(``);let v=_.querySelector(`.export-docx-item`);v.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToDocx:n}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToDocx:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,v,_)});let y=_.querySelector(`.export-md-item`);y.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToMarkdown:n}=await I(async()=>{let{exportAssistantMessageToMarkdown:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToMarkdown:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,y,_)});let b=_.querySelector(`.export-pdf-item`);b.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToPdf:n}=await I(async()=>{let{exportAssistantMessageToPdf:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToPdf:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,b,_)});let x=_.querySelector(`.export-image-item`);x.addEventListener(`click`,async t=>{t.stopPropagation();let{exportAssistantMessageToImage:n}=await I(async()=>{let{exportAssistantMessageToImage:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToImage:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(e,x,_)}),g.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==_&&e.classList.remove(`show`)}),_.classList.toggle(`show`)});let S=null;h.addEventListener(`mouseenter`,()=>{S=setTimeout(()=>{document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==_&&e.classList.remove(`show`)}),_.classList.add(`show`)},300)}),h.addEventListener(`mouseleave`,()=>{S&&=(clearTimeout(S),null),setTimeout(()=>{!h.matches(`:hover`)&&!_.matches(`:hover`)&&_.classList.remove(`show`)},100)}),h.appendChild(g),h.appendChild(_),f.appendChild(h);let C=document.createElement(`div`);C.className=`footer-right-actions`,C.style.marginLeft=`auto`,C.style.display=`flex`,C.style.alignItems=`center`,C.style.gap=`8px`;let w=Ze(n);if(w){let e=document.createElement(`span`);e.className=`token-usage-tag`,e.title=r(`chatStream.tokenUsageTitle`,{total:z(w.totalTokens),prompt:z(w.promptTokens),completion:z(w.completionTokens)}),e.innerHTML=`<span class="token-tag-icon">⬤</span><span class="token-tag-value">${z(w.totalTokens)}</span>`,e.style.cursor=`pointer`,e.addEventListener(`click`,t=>{t.stopPropagation(),rt(w,e)}),C.appendChild(e)}let T=ng(t),E=ag(n,t);if(T.length&&(e.dataset.declaredArtifacts=JSON.stringify(T)),Cg(E),E.length>0){let e=document.createElement(`button`);e.className=`artifacts-btn`,e.type=`button`,e.title=r(`artifacts.btnTitle`,{count:E.length}),e.innerHTML=`
|
|
1733
1733
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="14" height="14">
|
|
1734
1734
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
1735
1735
|
<polyline points="14 2 14 8 20 8"/>
|
|
@@ -1755,7 +1755,7 @@ Click to view assessment details`,reflectionFailedTitle:`Reflection assessment f
|
|
|
1755
1755
|
点击查看评估详情`,reflectionFailedTitle:`反思评估失败(点击查看执行日志)`,reflectionFailedBadge:`⚠️ 反思失败`,prototypeLocalOpened:`已在本地浏览器打开,点击可在面板内查看`,prototypeView:`查看 UI 原型`,bookmarkMessage:`收藏消息`,unbookmarkMessage:`取消收藏`,forkSession:`从此处分叉会话(仅复制到此条消息)`,deleteMessageTitle:`删除消息`,resumeTaskTitle:`从上次中断处继续执行任务`,resumeTaskBtn:`继续执行`,clickToEnlarge:`点击查看大图`,fileExtracting:` 提取中...`,fileFailed:` 失败`,fileExtractFailed:`提取失败`,copyMessageTitle:`复制消息内容`,editAndResend:`编辑后重新发送`,thinking:`思考中...`,stopTask:`停止任务`,viewExecutionLog:`查看执行日志`,preparing:`准备中...`,emptyModelReply:`模型未返回任何内容。若你发送了图片,请确认所选模型支持视觉识别(图片识别需选择支持多模态视觉的模型),或更换模型后重试。`,stopping:`停止中...`,retrying:`连接异常,正在重试 ({attempt}/{max})...`,copyCode:`复制代码`,aborting:`正在终止...`,terminateCommandTitle:`终止命令执行`,terminateCommandPrompt:`请选择终止方式:`,terminateWaitTitle:`终止等待`,terminateWaitDesc:`仅停止等待命令输出,后台进程继续运行。<br/>适用于挂起型服务(如 npm run dev)。`,terminateCommandBtnTitle:`终止命令`,terminateCommandBtnDesc:`直接终止后台命令进程,释放资源。`,confirmDeleteMessage:`确认删除消息`,deleteMessageWarning:`删除后消息将从对话历史中移除,且无法恢复。`,confirmDelete:`确认删除`,quotedContextLabel:`💬 已引用: {text}`,selectedContextLabel:`📌 已选中: {text}`,subtaskDone:`完成`,subtaskFailed:`失败`,subtaskPartial:`部分完成`,subtaskFailReason:`中断原因:{error}`,subtaskExecuting:`执行中...`,subtaskPending:`待执行`,subtaskDescLabel:`任务描述:`,subtaskResultLabel:`产出摘要:`,subtaskAllDone:`✓ 全部完成`,subtaskFilterEmpty:`当前过滤下无匹配节点`,subtaskFilterHint:`点击按此状态过滤节点,再点取消`,subtaskPartialFail:`✗ {success}/{total} 完成,{fail} 个节点失败`,unknownNode:`未知`,stopGeneration:`停止生成`,toolResultTitle:`执行结果`,reflectionInProgress:`质量评估中...`,cannotGetMessageContent:`无法获取消息内容`,editFailed:`编辑失败: {message}`,errTaskStopped:`任务已被用户停止`,errTaskReplaced:`任务已被新请求替代`,errSwRestarted:`后台服务异常重启,API 调用已中断`,errTimeout:`请求超时({seconds}秒)`,cancelBtn:`取消`}}),n(`en`,{chatMsg:{searchPrompt:`Search`,exportWord:`Export Word`,exportPdf:`Export PDF`,exportImage:`Export Image`,exportMarkdown:`Export Markdown`,executionLogTitle:`Execution Log`,revisedTag:`Revised`,roundsTag:` ({count} rounds)`,revisedSuffix:` (Revised)`,scoreBadgeTitle:`AI Quality Assessment: {score}/10{rounds}{revised}
|
|
1756
1756
|
Click to view assessment details`,reflectionFailedTitle:`Reflection assessment failed (click to view execution log)`,reflectionFailedBadge:`⚠️ Reflection Failed`,prototypeLocalOpened:`Opened in local browser, click to view in panel`,prototypeView:`View UI Prototype`,bookmarkMessage:`Bookmark message`,unbookmarkMessage:`Remove bookmark`,forkSession:`Fork session from here (copy up to this message only)`,deleteMessageTitle:`Delete message`,resumeTaskTitle:`Resume task from last interruption`,resumeTaskBtn:`Resume`,clickToEnlarge:`Click to view full size`,fileExtracting:` extracting...`,fileFailed:` failed`,fileExtractFailed:`Extraction failed`,copyMessageTitle:`Copy message content`,editAndResend:`Edit and resend`,thinking:`Thinking...`,stopTask:`Stop task`,viewExecutionLog:`View execution log`,preparing:`Preparing...`,emptyModelReply:`The model returned no content. If you sent an image, make sure the selected model supports vision (image recognition requires a multimodal vision model), or switch model and retry.`,stopping:`Stopping...`,retrying:`Connection unstable, retrying ({attempt}/{max})...`,copyCode:`Copy code`,aborting:`Aborting...`,terminateCommandTitle:`Terminate Command Execution`,terminateCommandPrompt:`Please select a termination method:`,terminateWaitTitle:`Stop Waiting`,terminateWaitDesc:`Only stop waiting for command output; the background process continues running.<br/>Suitable for hanging services (e.g. npm run dev).`,terminateCommandBtnTitle:`Terminate Command`,terminateCommandBtnDesc:`Directly terminate the background command process and release resources.`,confirmDeleteMessage:`Confirm Delete Message`,deleteMessageWarning:`After deletion, the message will be removed from the conversation history and cannot be recovered.`,confirmDelete:`Confirm Delete`,quotedContextLabel:`💬 Quoted: {text}`,selectedContextLabel:`📌 Selected: {text}`,subtaskDone:`Done`,subtaskFailed:`Failed`,subtaskPartial:`Partial`,subtaskFailReason:`Interrupted: {error}`,subtaskExecuting:`Executing...`,subtaskPending:`Pending`,subtaskDescLabel:`Description: `,subtaskResultLabel:`Output summary: `,subtaskAllDone:`✓ All done`,subtaskFilterEmpty:`No nodes match this filter`,subtaskFilterHint:`Click to filter nodes by this status, click again to clear`,subtaskPartialFail:`✗ {success}/{total} done, {fail} nodes failed`,unknownNode:`Unknown`,stopGeneration:`Stop generation`,toolResultTitle:`Execution Result`,reflectionInProgress:`Assessing quality...`,cannotGetMessageContent:`Cannot get message content`,editFailed:`Edit failed: {message}`,errTaskStopped:`Task stopped by user`,errTaskReplaced:`Task replaced by new request`,errSwRestarted:`Background service restarted unexpectedly, API call interrupted`,errTimeout:`Request timeout ({seconds}s)`,cancelBtn:`Cancel`}});var Cv=`pendingCallApiSessions`;function wv(){chrome.storage.session.set({[Cv]:[...F.pendingCallApiSessionIds]}).catch(()=>{})}async function Tv(){try{let e=await chrome.storage.session.get([Cv]);e[Cv]&&Array.isArray(e[Cv])&&(F.pendingCallApiSessionIds=new Set(e[Cv]))}catch{}}function Ev(e){if(Array.isArray(e))return e.filter(e=>e.type===`text`).map(e=>e.text).join(``);if(typeof e==`string`&&e.startsWith(`[`))try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>e.type===`text`).map(e=>e.text).join(``)}catch{}return e}function Dv(e){let t=Ev(e);F.quotedContextText=t;let n=document.getElementById(`selectionIndicator`),i=document.getElementById(`selectionText`),a=document.getElementById(`userInput`);if(n&&i&&a){let e;e=t.length>100?t.substring(0,100)+`...`:t.length>50?t.substring(0,50)+`...`:t,i.textContent=r(`chat.quotedPrefix`,{text:e}),n.classList.add(`show`)}}function Ov(){a.debug(`[SidePanel] clear selectedcontenttext `),F.selectedContextText=``,F.quotedContextText=``;let e=document.getElementById(`selectionIndicator`),t=document.getElementById(`userInput`);if(e&&(e.classList.remove(`show`),a.debug(`[SidePanel] hiddenselected contentprompt`)),typeof window.hideFloatingMenu==`function`&&window.hideFloatingMenu(),t&&t.value.startsWith(`[选中内容]`)){let e=t.value.split(`
|
|
1757
1757
|
`),n=e.findIndex(e=>e.startsWith(`[用户问题]`));n===-1?t.value=``:t.value=e.slice(n+1).join(`
|
|
1758
|
-
`).trim()}}var kv,Av=new Promise(e=>{kv=e});async function jv(){try{await Mv()}finally{kv()}}async function Mv(){let e=await Lt();if(e.activeSessionId&&e.list.length>0){F.activeSessionId=e.activeSessionId,F.sessions=e.list;let t=e.list.find(t=>t.id===e.activeSessionId);if(t){if(F.messageHistory=t.messageHistory||[],F.activeCompaction=t.contextCompaction||null,F.currentModel=t.model||F.currentModel,F.useTools=t.useTools===void 0?F.useTools:t.useTools,F.temperature=t.temperature===void 0?F.temperature:t.temperature,F.topP=t.topP===void 0?F.topP:t.topP,F.activeAgentId=t.agentId||null,F.activeAgentId&&F.activeAgentId!=="default"){try{let{getAgent:e}=await I(async()=>{let{getAgent:e}=await import(`./agent-store-
|
|
1758
|
+
`).trim()}}var kv,Av=new Promise(e=>{kv=e});async function jv(){try{await Mv()}finally{kv()}}async function Mv(){let e=await Lt();if(e.activeSessionId&&e.list.length>0){F.activeSessionId=e.activeSessionId,F.sessions=e.list;let t=e.list.find(t=>t.id===e.activeSessionId);if(t){if(F.messageHistory=t.messageHistory||[],F.activeCompaction=t.contextCompaction||null,F.currentModel=t.model||F.currentModel,F.useTools=t.useTools===void 0?F.useTools:t.useTools,F.temperature=t.temperature===void 0?F.temperature:t.temperature,F.topP=t.topP===void 0?F.topP:t.topP,F.activeAgentId=t.agentId||null,F.activeAgentId&&F.activeAgentId!=="default"){try{let{getAgent:e}=await I(async()=>{let{getAgent:e}=await import(`./agent-store-Cqyodrcc.js`).then(e=>e.t);return{getAgent:e}},__vite__mapDeps([0,1,2,3])),t=await e(F.activeAgentId);t&&(F.activeAgentMcpExcludedServerIds=t.mcpExcludedServerIds??null,t.model&&(F.currentModel=t.model),t.temperature!==null&&t.temperature!==void 0&&(F.temperature=t.temperature,F.topP=t.topP!==null&&t.topP!==void 0?t.topP:1),document.dispatchEvent(new CustomEvent(`agent-model-changed`)))}catch{}F.activeAgentMcpExcludedServerIds=null}else{F.activeAgentMcpExcludedServerIds=null;try{let e=await chrome.storage.local.get([`modelName`,`temperature`,`topP`]);e.modelName&&(F.currentModel=e.modelName),e.temperature!==void 0&&(F.temperature=e.temperature),e.topP!==void 0&&(F.topP=e.topP)}catch{}document.dispatchEvent(new CustomEvent(`agent-model-changed`))}let e=`agentMcpClosedServers_${F.activeAgentId||`default`}`;F.mcpClosedServers=(await chrome.storage.local.get([e]))[e]||[]}let n=document.getElementById(`chatContainer`);n&&n.querySelectorAll(`.message, .user-context-bubble`).forEach(e=>e.remove()),F.messageHistory.forEach(e=>{let t=e.wasRevised;if(!t&&e.executionLog)try{t=(typeof e.executionLog==`string`?JSON.parse(e.executionLog):e.executionLog).some(e=>e.nodeType===`reflection`&&e.reflectionType===`post`&&e.action?.decision===`revised`)}catch{}if(e.role===`user`&&e.contextBubbles&&Array.isArray(e.contextBubbles)&&e.contextBubbles.forEach(e=>{let t=``;switch(e.type){case`skill`:t=r(`contextBubble.bubbleSkill`,{name:e.name,desc:e.description?`:`+e.description:``});break;case`mcp`:t=r(`contextBubble.bubbleMcp`,{name:e.serverName});break;case`page`:t=r(`contextBubble.bubblePage`,{title:e.title,url:e.url});break;case`file`:t=`${e.name} (${ou(e.size||0)})`;break;case`knowledge`:{let t=Array.isArray(e.refs)?e.refs:[];t.length>0&&Bv(t,e.failed===!0);break}}t&&e.type!==`file`&&ty(e.type,t,!1)}),e.htmlContent)py(e.htmlContent,e.messageId,e.resumable);else{let n=(e.contextBubbles||[]).filter(e=>e.type===`file`).map(e=>({name:e.name,size:e.size||0,type:e.fileType||``}));iy(e.role,e.content,!1,e.executionLog||[],e.reflectionScore,t,null,e.messageId,n,e.resumable,e.timestamp??null)}}),sy(),ly(),oo();let i=document.querySelector(`.welcome-message`);i&&F.messageHistory.length>0&&i.remove(),ja(),Ga(),Ox(),e.activeSessionId===F.activeSessionId?po(e):po(),await F_();let a=`scrollPosition_`+(F.activeSessionId||`default`);chrome.storage.local.get([a],e=>{e[a]!==void 0&&setTimeout(()=>{let t=document.getElementById(`chatContainer`);t.scrollTop=e[a]},100)})}else{await zt();let e=await Lt();e.activeSessionId&&(F.activeSessionId=e.activeSessionId,F.sessions=e.list),po(e)}}function Nv(){try{Rt().catch(e=>{a.error(`[SidePanel] save currentsession failed:`,e)})}catch(e){a.error(`[SidePanel] save conversationhistory exception:`,e)}}async function Pv(){try{await Rt()}catch(e){a.error(`[SidePanel] save conversationhistory exception:`,e)}}function Fv(){F.messageHistory&&F.messageHistory.length>0&&Wt().then(()=>{F.messageHistory=[],F.activeCompaction=null;let e=document.getElementById(`chatContainer`);if(e){e.innerHTML=``;let t=document.createElement(`div`);t.className=`welcome-message`,t.innerHTML=`
|
|
1759
1759
|
<div class="icon-wrapper">
|
|
1760
1760
|
<div class="icon">💬</div>
|
|
1761
1761
|
</div>
|
|
@@ -1779,7 +1779,7 @@ Click to view assessment details`,reflectionFailedTitle:`Reflection assessment f
|
|
|
1779
1779
|
</div>
|
|
1780
1780
|
<div class="context-bubble-content">${l}</div>
|
|
1781
1781
|
</div>
|
|
1782
|
-
`;let u=o.querySelector(`.context-bubble-header`),d=o.querySelector(`.context-bubble-content`);return u.addEventListener(`click`,e=>{e.stopPropagation(),d.classList.toggle(`expanded`)}),e===`knowledge`&&o.querySelectorAll(`.kb-bubble-hit-text`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),e.classList.toggle(`expanded`)})}),a.appendChild(o),n&&(a.scrollTop=a.scrollHeight),o}function ny(e){let t=e,n;do n=t,t=t.replace(/^\[(?:已选技能|Selected skill): [^\]]+\]\n[\s\S]*?(?:请根据上述技能说明[\s\S]*?处理以下问题[::]|Please use the relevant tools[\s\S]*?handle the following problem[.:])\s*\n/,``).replace(/^\[(?:已选技能|Selected skill): [^\]]+\]\n(?:请|Please)[^\n]*(?:处理以下问题|handle the following problem)[^。\n]*。?\s*\n/,``);while(t!==n);return t}function ry(e){let t=e,n;do n=t,t=t.replace(/^\[(?:已选MCP服务|Selected MCP service):\s*[^\]]+\]\n(?:请使用「[^」]+」MCP服务来处理以下问题:|Please use the "[^"]+" MCP service to handle the following problem:)\s*\n/,``);while(t!==n);return t}function iy(e,t,n=!0,i=[],o=null,s=!1,c=null,l=null,u=[],d=!1,f=void 0){let p=document.getElementById(`chatContainer`),m=document.createElement(`div`);m.className=`message ${e}`;let h=f===void 0?new Date().toISOString():f||null;h&&(m.dataset.timestamp=h);let g=l||`msg_`+Date.now().toString(36)+`_`+Math.random().toString(36).substring(2,8);m.dataset.messageId=g;let _=Array.isArray(t)?t.filter(e=>e.type===`text`).map(e=>e.text).join(``):t,v=Array.isArray(t)&&t.some(e=>e.type===`image_url`);m.dataset.rawContent=Array.isArray(t)?JSON.stringify(t):Sa(t),m.dataset.textContent_=Sa(c||_);let y=_;if(m.dataset.executionLog=JSON.stringify(i),s&&(m.dataset.wasRevised=`true`),e===`assistant`){m.innerHTML=Na(t);let e=document.createElement(`div`);e.className=`message-footer`;let n=document.createElement(`button`);n.className=`copy-btn`,n.title=r(`chatStream.copyMarkdown`),n.innerHTML=[`<svg viewBox="0 0 16 16" fill="currentColor">`,`<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25z"/>`,`</svg>`,`<span>${r(`common.copy`)}</span>`].join(``),n.addEventListener(`click`,e=>{e.stopPropagation(),x_(m,n,e)}),e.appendChild(n);let c=document.createElement(`button`);c.className=`quote-btn`,c.title=r(`chat.quoteTitle`),c.innerHTML=[`<svg t="1781246498458" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9645" width="14" height="14"><path d="M156.09136 606.57001a457.596822 457.596822 0 0 1 221.680239-392.516385 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z m406.752731 0a457.596822 457.596822 0 0 1 221.680239-392.007944 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z" fill="#8a8a8a" p-id="9646"></path></svg>`,`<span>${r(`chat.quote`)}</span>`].join(``),c.addEventListener(`click`,e=>{e.stopPropagation(),k_(m)}),e.appendChild(c);let l=document.createElement(`div`);l.className=`export-menu-container`;let u=document.createElement(`button`);u.className=`export-trigger-btn`,u.innerHTML=`<svg t="1781245244396" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5115" width="14" height="14"><path d="M496.213333 739.84c2.133333 2.133333 4.693333 3.84 7.68 5.12 0.853333 0.426667 2.133333 0.426667 2.986667 0.853333 1.706667 0.426667 2.986667 0.853333 4.693333 0.853334 5.546667 0 11.093333-2.133333 14.933334-6.4l256-256c8.533333-8.533333 8.533333-21.76 0-30.293334s-21.76-8.533333-30.293334 0L533.333333 674.133333V128c0-11.946667-9.386667-21.333333-21.333333-21.333333s-21.333333 9.386667-21.333333 21.333333v545.706667l-219.306667-219.306667c-8.533333-8.533333-21.76-8.533333-30.293333 0s-8.533333 21.76 0 30.293333l255.146666 255.146667zM768 874.666667H256c-11.946667 0-21.333333 9.386667-21.333333 21.333333s9.386667 21.333333 21.333333 21.333333h512c11.946667 0 21.333333-9.386667 21.333333-21.333333s-9.386667-21.333333-21.333333-21.333333z" fill="#8a8a8a" p-id="5116"></path></svg><span>${r(`chat.export`)}</span><svg class="dropdown-arrow" width="8" height="6" viewBox="0 0 8 6" fill="currentColor"><path d="M0 0l4 6 4-6z"/></svg>`;let f=document.createElement(`div`);f.className=`export-dropdown`,f.innerHTML=[`<button class="export-dropdown-item export-docx-item" type="button">`,`<svg t="1781245550030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6544" width="32" height="32"><path d="M747.936 901.171H276.819c-72.2 0-130.953-55.224-130.953-123.078V244.721c0-67.854 58.752-123.078 130.953-123.078h383.525c6.597 0 12.937 2.505 17.795 6.954l192.363 178.046c5.317 4.96 8.386 11.914 8.386 19.227v452.223c0 67.854-58.752 123.078-130.952 123.078zM276.819 174.004c-43.31 0-78.592 31.703-78.592 70.717v533.372c0 39.015 35.282 70.718 78.592 70.718h471.117c43.31 0 78.592-31.703 78.592-70.718V337.324l-176.461-163.32H276.819z" fill="#8a8a8a" p-id="6545"></path><path d="M830.567 331.546H669.446c-14.471 0-26.18-11.71-26.18-26.181V156.209c0-14.471 11.709-26.18 26.18-26.18s26.181 11.709 26.181 26.18v122.976h134.94c14.471 0 26.181 11.709 26.181 26.18s-11.711 26.181-26.181 26.181z" fill="#8a8a8a" p-id="6546"></path><path d="M730.214 428.749l-92.04 343.616h-53.179L511.363 498.29l-75.677 274.074h-53.179l-92.04-343.616h49.088l69.542 255.667 69.541-255.667h63.406l69.541 255.667 69.541-255.667h49.088z" fill="#8a8a8a" p-id="6547"></path></svg>`,`<span>${r(`chatMsg.exportWord`)}</span>`,`</button>`,`<button class="export-dropdown-item export-pdf-item" type="button">`,`<svg t="1781245863206" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8152" width="32" height="32"><path d="M582.4 864H170.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V170.666667c0-6.4 4.266667-10.666667 10.666667-10.666667h309.333333V320c0 40.533333 34.133333 74.666667 74.666667 74.666667h160v38.4c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V298.666667c0-8.533333-4.266667-17.066667-8.533334-23.466667l-170.666666-170.666667c-6.4-6.4-14.933333-8.533333-23.466667-8.533333H170.666667C130.133333 96 96 130.133333 96 170.666667v682.666666c0 40.533333 34.133333 74.666667 74.666667 74.666667h411.733333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z m132.266667-550.4v17.066667H554.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V160h19.2l151.466667 153.6z" fill="#8a8a8a" p-id="8153"></path><path d="M332.8 533.333333c-12.8 0-19.2 2.133333-25.6 6.4-6.4 4.266667-8.533333 12.8-8.533333 23.466667v206.933333c0 6.4 2.133333 12.8 6.4 19.2 4.266667 4.266667 10.666667 8.533333 21.333333 8.533334s17.066667-4.266667 21.333333-8.533334c4.266667-4.266667 6.4-10.666667 6.4-19.2v-64h32c57.6 0 89.6-29.866667 89.6-87.466666 0-27.733333-8.533333-51.2-23.466666-64-14.933333-14.933333-36.266667-21.333333-66.133334-21.333334h-53.333333z m87.466667 85.333334c0 12.8-2.133333 23.466667-8.533334 27.733333-4.266667 4.266667-14.933333 8.533333-27.733333 8.533333h-32v-70.4H384c12.8 0 21.333333 2.133333 27.733333 8.533334 6.4 4.266667 8.533333 12.8 8.533334 25.6zM667.733333 571.733333c-8.533333-12.8-21.333333-21.333333-34.133333-29.866666-14.933333-4.266667-32-8.533333-51.2-8.533334h-61.866667c-8.533333 0-17.066667 0-23.466666 8.533334-2.133333 4.266667-4.266667 10.666667-4.266667 19.2V768c0 8.533333 2.133333 14.933333 4.266667 19.2 6.4 8.533333 14.933333 8.533333 23.466666 8.533333h64c19.2 0 34.133333-4.266667 49.066667-10.666666 12.8-6.4 25.6-17.066667 34.133333-29.866667 8.533333-12.8 14.933333-25.6 19.2-42.666667 4.266667-14.933333 6.4-32 6.4-49.066666 0-17.066667-2.133333-34.133333-6.4-49.066667-4.266667-14.933333-10.666667-29.866667-19.2-42.666667z m-42.666666 153.6c-8.533333 12.8-21.333333 19.2-38.4 19.2h-38.4v-160H576c21.333333 0 38.4 6.4 46.933333 19.2 10.666667 12.8 14.933333 34.133333 14.933334 59.733334 2.133333 27.733333-4.266667 46.933333-12.8 61.866666zM851.2 533.333333h-106.666667c-8.533333 0-17.066667 2.133333-21.333333 6.4-6.4 4.266667-8.533333 12.8-8.533333 21.333334v209.066666c0 6.4 2.133333 12.8 6.4 17.066667 4.266667 6.4 10.666667 8.533333 21.333333 8.533333 8.533333 0 17.066667-2.133333 21.333333-8.533333 2.133333-4.266667 6.4-8.533333 6.4-19.2v-85.333333h72.533334c12.8 0 23.466667-6.4 25.6-17.066667 2.133333-8.533333 2.133333-14.933333 0-17.066667-2.133333-4.266667-6.4-17.066667-25.6-17.066666H768v-49.066667h81.066667c8.533333 0 14.933333-2.133333 19.2-4.266667 4.266667-2.133333 8.533333-8.533333 8.533333-21.333333 2.133333-12.8-8.533333-23.466667-25.6-23.466667z" fill="#8a8a8a" p-id="8154"></path></svg>`,`<span>${r(`chatMsg.exportPdf`)}</span>`,`</button>`,`<button class="export-dropdown-item export-image-item" type="button">`,`<svg t="1784207887308" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5993" width="32" height="32"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#8a8a8a" p-id="5994"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#8a8a8a" p-id="5995"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#8a8a8a" p-id="5996"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#8a8a8a" p-id="5997"></path></svg>`,`<span>${r(`chatMsg.exportImage`)}</span>`,`</button>`,`<button class="export-dropdown-item export-md-item" type="button">`,`<svg t="1784038824502" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1666" width="32" height="32"><path d="M601.216 85.333333a42.666667 42.666667 0 0 1 30.485333 12.821334l209.450667 213.973333a42.666667 42.666667 0 0 1 12.181333 29.866667V853.333333a85.333333 85.333333 0 0 1-85.333333 85.333334H256a85.333333 85.333333 0 0 1-85.333333-85.333334V170.666667a85.333333 85.333333 0 0 1 85.333333-85.333334h345.216z m-35.584 64H256a21.333333 21.333333 0 0 0-21.333333 21.333334v682.666666a21.333333 21.333333 0 0 0 21.333333 21.333334h512a21.333333 21.333333 0 0 0 21.333333-21.333334V395.413333h-191.68a32 32 0 0 1-32-32L565.632 149.333333z m64 38.186667v143.893333h140.821333L629.632 187.52z" fill="#8a8a8a" p-id="1667"></path><path d="M384.341333 800l-3.072-0.106667a32 32 0 0 1-29.162666-34.624l21.973333-256c2.752-32.256 46.165333-40.490667 60.544-11.477333l77.290667 156.010667 78.805333-156.224c14.08-27.925333 55.082667-20.906667 60.074667 8.789333l0.384 3.050667 20.714666 256a32 32 0 0 1-63.786666 5.162666l-11.541334-142.549333-56.341333 111.722667c-11.413333 22.613333-42.88 23.381333-55.744 2.517333l-1.493333-2.730667-54.912-110.826666-12.181334 142.016a32 32 0 0 1-31.552 29.269333z" fill="#8a8a8a" p-id="1668"></path></svg>`,`<span>${r(`chatMsg.exportMarkdown`)}</span>`,`</button>`].join(``);let p=f.querySelector(`.export-docx-item`);p.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToDocx:t}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToDocx:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,p,f)});let h=f.querySelector(`.export-md-item`);h.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToMarkdown:t}=await I(async()=>{let{exportAssistantMessageToMarkdown:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToMarkdown:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,h,f)});let _=f.querySelector(`.export-pdf-item`);_.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToPdf:t}=await I(async()=>{let{exportAssistantMessageToPdf:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToPdf:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,_,f)});let v=f.querySelector(`.export-image-item`);v.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToImage:t}=await I(async()=>{let{exportAssistantMessageToImage:e}=await import(`./chat-export-BNCkL6fS.js`);return{exportAssistantMessageToImage:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,v,f)}),u.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==f&&e.classList.remove(`show`)}),f.classList.toggle(`show`)});let y=null;l.addEventListener(`mouseenter`,()=>{y=setTimeout(()=>{document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==f&&e.classList.remove(`show`)}),f.classList.add(`show`)},300)}),l.addEventListener(`mouseleave`,()=>{y&&=(clearTimeout(y),null),setTimeout(()=>{!l.matches(`:hover`)&&!f.matches(`:hover`)&&f.classList.remove(`show`)},100)}),l.appendChild(u),l.appendChild(f),e.appendChild(l);let b=document.createElement(`div`);b.className=`footer-right-actions`,b.style.marginLeft=`auto`,b.style.display=`flex`,b.style.alignItems=`center`,b.style.gap=`8px`;let x=Ze(i);if(x){let e=document.createElement(`span`);e.className=`token-usage-tag`,e.title=r(`chatStream.tokenUsageTitle`,{total:z(x.totalTokens),prompt:z(x.promptTokens),completion:z(x.completionTokens)}),e.innerHTML=`<span class="token-tag-icon">⬤</span><span class="token-tag-value">${z(x.totalTokens)}</span>`,e.style.cursor=`pointer`,e.addEventListener(`click`,t=>{t.stopPropagation(),rt(x,e)}),b.appendChild(e)}let S=i&&i.length>0,C=o!=null,w=i?i.filter(e=>e.nodeType===`reflection`&&e.reflectionType===`post`&&e.status===`success`).length:0;sy(),ly(),oo();let T=i?.find(e=>e.nodeType===`reflection`&&e.reflectionType===`post`),E=ng(t),D=ag(i,t);if(E.length&&(m.dataset.declaredArtifacts=JSON.stringify(E)),Cg(D),console.log(`[addMessage] executionLog entries:`,i?.length,`| agent_file entries:`,i?.filter(e=>e.nodeType===`tool_exec`&&e.action?.name===`agent_file`).length,`| artifacts:`,D.length),D.length>0){let e=document.createElement(`button`);e.className=`artifacts-btn`,e.type=`button`,e.title=r(`artifacts.btnTitle`,{count:D.length}),e.innerHTML=`
|
|
1782
|
+
`;let u=o.querySelector(`.context-bubble-header`),d=o.querySelector(`.context-bubble-content`);return u.addEventListener(`click`,e=>{e.stopPropagation(),d.classList.toggle(`expanded`)}),e===`knowledge`&&o.querySelectorAll(`.kb-bubble-hit-text`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),e.classList.toggle(`expanded`)})}),a.appendChild(o),n&&(a.scrollTop=a.scrollHeight),o}function ny(e){let t=e,n;do n=t,t=t.replace(/^\[(?:已选技能|Selected skill): [^\]]+\]\n[\s\S]*?(?:请根据上述技能说明[\s\S]*?处理以下问题[::]|Please use the relevant tools[\s\S]*?handle the following problem[.:])\s*\n/,``).replace(/^\[(?:已选技能|Selected skill): [^\]]+\]\n(?:请|Please)[^\n]*(?:处理以下问题|handle the following problem)[^。\n]*。?\s*\n/,``);while(t!==n);return t}function ry(e){let t=e,n;do n=t,t=t.replace(/^\[(?:已选MCP服务|Selected MCP service):\s*[^\]]+\]\n(?:请使用「[^」]+」MCP服务来处理以下问题:|Please use the "[^"]+" MCP service to handle the following problem:)\s*\n/,``);while(t!==n);return t}function iy(e,t,n=!0,i=[],o=null,s=!1,c=null,l=null,u=[],d=!1,f=void 0){let p=document.getElementById(`chatContainer`),m=document.createElement(`div`);m.className=`message ${e}`;let h=f===void 0?new Date().toISOString():f||null;h&&(m.dataset.timestamp=h);let g=l||`msg_`+Date.now().toString(36)+`_`+Math.random().toString(36).substring(2,8);m.dataset.messageId=g;let _=Array.isArray(t)?t.filter(e=>e.type===`text`).map(e=>e.text).join(``):t,v=Array.isArray(t)&&t.some(e=>e.type===`image_url`);m.dataset.rawContent=Array.isArray(t)?JSON.stringify(t):Sa(t),m.dataset.textContent_=Sa(c||_);let y=_;if(m.dataset.executionLog=JSON.stringify(i),s&&(m.dataset.wasRevised=`true`),e===`assistant`){m.innerHTML=Na(t);let e=document.createElement(`div`);e.className=`message-footer`;let n=document.createElement(`button`);n.className=`copy-btn`,n.title=r(`chatStream.copyMarkdown`),n.innerHTML=[`<svg viewBox="0 0 16 16" fill="currentColor">`,`<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25z"/>`,`</svg>`,`<span>${r(`common.copy`)}</span>`].join(``),n.addEventListener(`click`,e=>{e.stopPropagation(),x_(m,n,e)}),e.appendChild(n);let c=document.createElement(`button`);c.className=`quote-btn`,c.title=r(`chat.quoteTitle`),c.innerHTML=[`<svg t="1781246498458" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9645" width="14" height="14"><path d="M156.09136 606.57001a457.596822 457.596822 0 0 1 221.680239-392.516385 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z m406.752731 0a457.596822 457.596822 0 0 1 221.680239-392.007944 50.844091 50.844091 0 1 1 50.844091 86.943396 355.90864 355.90864 0 0 0-138.804369 152.532274h16.77855a152.532274 152.532274 0 1 1-152.532274 152.532274z" fill="#8a8a8a" p-id="9646"></path></svg>`,`<span>${r(`chat.quote`)}</span>`].join(``),c.addEventListener(`click`,e=>{e.stopPropagation(),k_(m)}),e.appendChild(c);let l=document.createElement(`div`);l.className=`export-menu-container`;let u=document.createElement(`button`);u.className=`export-trigger-btn`,u.innerHTML=`<svg t="1781245244396" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5115" width="14" height="14"><path d="M496.213333 739.84c2.133333 2.133333 4.693333 3.84 7.68 5.12 0.853333 0.426667 2.133333 0.426667 2.986667 0.853333 1.706667 0.426667 2.986667 0.853333 4.693333 0.853334 5.546667 0 11.093333-2.133333 14.933334-6.4l256-256c8.533333-8.533333 8.533333-21.76 0-30.293334s-21.76-8.533333-30.293334 0L533.333333 674.133333V128c0-11.946667-9.386667-21.333333-21.333333-21.333333s-21.333333 9.386667-21.333333 21.333333v545.706667l-219.306667-219.306667c-8.533333-8.533333-21.76-8.533333-30.293333 0s-8.533333 21.76 0 30.293333l255.146666 255.146667zM768 874.666667H256c-11.946667 0-21.333333 9.386667-21.333333 21.333333s9.386667 21.333333 21.333333 21.333333h512c11.946667 0 21.333333-9.386667 21.333333-21.333333s-9.386667-21.333333-21.333333-21.333333z" fill="#8a8a8a" p-id="5116"></path></svg><span>${r(`chat.export`)}</span><svg class="dropdown-arrow" width="8" height="6" viewBox="0 0 8 6" fill="currentColor"><path d="M0 0l4 6 4-6z"/></svg>`;let f=document.createElement(`div`);f.className=`export-dropdown`,f.innerHTML=[`<button class="export-dropdown-item export-docx-item" type="button">`,`<svg t="1781245550030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6544" width="32" height="32"><path d="M747.936 901.171H276.819c-72.2 0-130.953-55.224-130.953-123.078V244.721c0-67.854 58.752-123.078 130.953-123.078h383.525c6.597 0 12.937 2.505 17.795 6.954l192.363 178.046c5.317 4.96 8.386 11.914 8.386 19.227v452.223c0 67.854-58.752 123.078-130.952 123.078zM276.819 174.004c-43.31 0-78.592 31.703-78.592 70.717v533.372c0 39.015 35.282 70.718 78.592 70.718h471.117c43.31 0 78.592-31.703 78.592-70.718V337.324l-176.461-163.32H276.819z" fill="#8a8a8a" p-id="6545"></path><path d="M830.567 331.546H669.446c-14.471 0-26.18-11.71-26.18-26.181V156.209c0-14.471 11.709-26.18 26.18-26.18s26.181 11.709 26.181 26.18v122.976h134.94c14.471 0 26.181 11.709 26.181 26.18s-11.711 26.181-26.181 26.181z" fill="#8a8a8a" p-id="6546"></path><path d="M730.214 428.749l-92.04 343.616h-53.179L511.363 498.29l-75.677 274.074h-53.179l-92.04-343.616h49.088l69.542 255.667 69.541-255.667h63.406l69.541 255.667 69.541-255.667h49.088z" fill="#8a8a8a" p-id="6547"></path></svg>`,`<span>${r(`chatMsg.exportWord`)}</span>`,`</button>`,`<button class="export-dropdown-item export-pdf-item" type="button">`,`<svg t="1781245863206" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8152" width="32" height="32"><path d="M582.4 864H170.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V170.666667c0-6.4 4.266667-10.666667 10.666667-10.666667h309.333333V320c0 40.533333 34.133333 74.666667 74.666667 74.666667h160v38.4c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V298.666667c0-8.533333-4.266667-17.066667-8.533334-23.466667l-170.666666-170.666667c-6.4-6.4-14.933333-8.533333-23.466667-8.533333H170.666667C130.133333 96 96 130.133333 96 170.666667v682.666666c0 40.533333 34.133333 74.666667 74.666667 74.666667h411.733333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z m132.266667-550.4v17.066667H554.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V160h19.2l151.466667 153.6z" fill="#8a8a8a" p-id="8153"></path><path d="M332.8 533.333333c-12.8 0-19.2 2.133333-25.6 6.4-6.4 4.266667-8.533333 12.8-8.533333 23.466667v206.933333c0 6.4 2.133333 12.8 6.4 19.2 4.266667 4.266667 10.666667 8.533333 21.333333 8.533334s17.066667-4.266667 21.333333-8.533334c4.266667-4.266667 6.4-10.666667 6.4-19.2v-64h32c57.6 0 89.6-29.866667 89.6-87.466666 0-27.733333-8.533333-51.2-23.466666-64-14.933333-14.933333-36.266667-21.333333-66.133334-21.333334h-53.333333z m87.466667 85.333334c0 12.8-2.133333 23.466667-8.533334 27.733333-4.266667 4.266667-14.933333 8.533333-27.733333 8.533333h-32v-70.4H384c12.8 0 21.333333 2.133333 27.733333 8.533334 6.4 4.266667 8.533333 12.8 8.533334 25.6zM667.733333 571.733333c-8.533333-12.8-21.333333-21.333333-34.133333-29.866666-14.933333-4.266667-32-8.533333-51.2-8.533334h-61.866667c-8.533333 0-17.066667 0-23.466666 8.533334-2.133333 4.266667-4.266667 10.666667-4.266667 19.2V768c0 8.533333 2.133333 14.933333 4.266667 19.2 6.4 8.533333 14.933333 8.533333 23.466666 8.533333h64c19.2 0 34.133333-4.266667 49.066667-10.666666 12.8-6.4 25.6-17.066667 34.133333-29.866667 8.533333-12.8 14.933333-25.6 19.2-42.666667 4.266667-14.933333 6.4-32 6.4-49.066666 0-17.066667-2.133333-34.133333-6.4-49.066667-4.266667-14.933333-10.666667-29.866667-19.2-42.666667z m-42.666666 153.6c-8.533333 12.8-21.333333 19.2-38.4 19.2h-38.4v-160H576c21.333333 0 38.4 6.4 46.933333 19.2 10.666667 12.8 14.933333 34.133333 14.933334 59.733334 2.133333 27.733333-4.266667 46.933333-12.8 61.866666zM851.2 533.333333h-106.666667c-8.533333 0-17.066667 2.133333-21.333333 6.4-6.4 4.266667-8.533333 12.8-8.533333 21.333334v209.066666c0 6.4 2.133333 12.8 6.4 17.066667 4.266667 6.4 10.666667 8.533333 21.333333 8.533333 8.533333 0 17.066667-2.133333 21.333333-8.533333 2.133333-4.266667 6.4-8.533333 6.4-19.2v-85.333333h72.533334c12.8 0 23.466667-6.4 25.6-17.066667 2.133333-8.533333 2.133333-14.933333 0-17.066667-2.133333-4.266667-6.4-17.066667-25.6-17.066666H768v-49.066667h81.066667c8.533333 0 14.933333-2.133333 19.2-4.266667 4.266667-2.133333 8.533333-8.533333 8.533333-21.333333 2.133333-12.8-8.533333-23.466667-25.6-23.466667z" fill="#8a8a8a" p-id="8154"></path></svg>`,`<span>${r(`chatMsg.exportPdf`)}</span>`,`</button>`,`<button class="export-dropdown-item export-image-item" type="button">`,`<svg t="1784207887308" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5993" width="32" height="32"><path d="M400.696 268.795c-17.249 0-31.233 13.986-31.233 31.233v30.471c0 17.249 13.986 31.233 31.233 31.233s31.233-13.986 31.233-31.233v-30.471c0-17.249-13.985-31.233-31.233-31.233z" fill="#8a8a8a" p-id="5994"></path><path d="M623.649 361.734c17.249 0 31.234-13.986 31.234-31.233v-30.471c0-17.249-13.986-31.233-31.234-31.233s-31.233 13.986-31.233 31.233v30.471c-0.001 17.248 13.985 31.233 31.233 31.233z" fill="#8a8a8a" p-id="5995"></path><path d="M438.295 388.804c-14.656 9.104-19.155 28.362-10.050 43.013 11.209 18.047 41.976 48.59 86.157 48.59 43.958 0 75.1-30.313 86.574-48.223 9.303-14.529 5.068-33.847-9.455-43.15-14.539-9.298-33.852-5.068-43.15 9.455-0.122 0.199-13.38 19.45-33.969 19.45-20.009 0-32.444-18.128-33.278-19.373-9.166-14.423-28.28-18.805-42.829-9.761z" fill="#8a8a8a" p-id="5996"></path><path d="M824.508503 116.690676 571.592236 116.690676c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c40.181141 0 72.878844 32.692586 72.878844 72.878844l0 396.966057-189.334159-165.29465c-12.20088-10.655687-30.517037-10.207479-42.173518 0.9967L468.578048 674.16231 309.521472 517.519714c-11.895935-11.70253-30.903847-12.002358-43.154869-0.645706L126.957507 646.163629l0-394.126382c0-40.186258 32.692586-72.878844 72.878844-72.878844l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352S470.000444 116.690676 452.751594 116.690676L199.836351 116.690676c-74.632791 0-135.346571 60.71378-135.346571 135.346571l0 520.56405c0 74.632791 60.71378 135.346571 135.346571 135.346571l252.916267 0c17.248849 0 31.233352-13.985526 31.233352-31.233352s-13.985526-31.233352-31.233352-31.233352L199.836351 845.481164c-40.186258 0-72.878844-32.692586-72.878844-72.878844l0-41.23924 160.003134-148.385539 159.428036 157.007917c12.048407 11.865235 31.361265 11.981892 43.546795 0.274246l198.576661-190.68697 208.876238 182.346001 0 40.683585c0 40.186258-32.697703 72.878844-72.878844 72.878844L571.592236 845.481164c-17.248849 0-31.233352 13.985526-31.233352 31.233352s13.985526 31.233352 31.233352 31.233352l252.916267 0c74.627674 0 135.346571-60.71378 135.346571-135.346571L959.855074 252.037247C959.855074 177.404456 899.136178 116.690676 824.508503 116.690676z" fill="#8a8a8a" p-id="5997"></path></svg>`,`<span>${r(`chatMsg.exportImage`)}</span>`,`</button>`,`<button class="export-dropdown-item export-md-item" type="button">`,`<svg t="1784038824502" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1666" width="32" height="32"><path d="M601.216 85.333333a42.666667 42.666667 0 0 1 30.485333 12.821334l209.450667 213.973333a42.666667 42.666667 0 0 1 12.181333 29.866667V853.333333a85.333333 85.333333 0 0 1-85.333333 85.333334H256a85.333333 85.333333 0 0 1-85.333333-85.333334V170.666667a85.333333 85.333333 0 0 1 85.333333-85.333334h345.216z m-35.584 64H256a21.333333 21.333333 0 0 0-21.333333 21.333334v682.666666a21.333333 21.333333 0 0 0 21.333333 21.333334h512a21.333333 21.333333 0 0 0 21.333333-21.333334V395.413333h-191.68a32 32 0 0 1-32-32L565.632 149.333333z m64 38.186667v143.893333h140.821333L629.632 187.52z" fill="#8a8a8a" p-id="1667"></path><path d="M384.341333 800l-3.072-0.106667a32 32 0 0 1-29.162666-34.624l21.973333-256c2.752-32.256 46.165333-40.490667 60.544-11.477333l77.290667 156.010667 78.805333-156.224c14.08-27.925333 55.082667-20.906667 60.074667 8.789333l0.384 3.050667 20.714666 256a32 32 0 0 1-63.786666 5.162666l-11.541334-142.549333-56.341333 111.722667c-11.413333 22.613333-42.88 23.381333-55.744 2.517333l-1.493333-2.730667-54.912-110.826666-12.181334 142.016a32 32 0 0 1-31.552 29.269333z" fill="#8a8a8a" p-id="1668"></path></svg>`,`<span>${r(`chatMsg.exportMarkdown`)}</span>`,`</button>`].join(``);let p=f.querySelector(`.export-docx-item`);p.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToDocx:t}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToDocx:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,p,f)});let h=f.querySelector(`.export-md-item`);h.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToMarkdown:t}=await I(async()=>{let{exportAssistantMessageToMarkdown:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToMarkdown:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,h,f)});let _=f.querySelector(`.export-pdf-item`);_.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToPdf:t}=await I(async()=>{let{exportAssistantMessageToPdf:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToPdf:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,_,f)});let v=f.querySelector(`.export-image-item`);v.addEventListener(`click`,async e=>{e.stopPropagation();let{exportAssistantMessageToImage:t}=await I(async()=>{let{exportAssistantMessageToImage:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToImage:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));t(m,v,f)}),u.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==f&&e.classList.remove(`show`)}),f.classList.toggle(`show`)});let y=null;l.addEventListener(`mouseenter`,()=>{y=setTimeout(()=>{document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==f&&e.classList.remove(`show`)}),f.classList.add(`show`)},300)}),l.addEventListener(`mouseleave`,()=>{y&&=(clearTimeout(y),null),setTimeout(()=>{!l.matches(`:hover`)&&!f.matches(`:hover`)&&f.classList.remove(`show`)},100)}),l.appendChild(u),l.appendChild(f),e.appendChild(l);let b=document.createElement(`div`);b.className=`footer-right-actions`,b.style.marginLeft=`auto`,b.style.display=`flex`,b.style.alignItems=`center`,b.style.gap=`8px`;let x=Ze(i);if(x){let e=document.createElement(`span`);e.className=`token-usage-tag`,e.title=r(`chatStream.tokenUsageTitle`,{total:z(x.totalTokens),prompt:z(x.promptTokens),completion:z(x.completionTokens)}),e.innerHTML=`<span class="token-tag-icon">⬤</span><span class="token-tag-value">${z(x.totalTokens)}</span>`,e.style.cursor=`pointer`,e.addEventListener(`click`,t=>{t.stopPropagation(),rt(x,e)}),b.appendChild(e)}let S=i&&i.length>0,C=o!=null,w=i?i.filter(e=>e.nodeType===`reflection`&&e.reflectionType===`post`&&e.status===`success`).length:0;sy(),ly(),oo();let T=i?.find(e=>e.nodeType===`reflection`&&e.reflectionType===`post`),E=ng(t),D=ag(i,t);if(E.length&&(m.dataset.declaredArtifacts=JSON.stringify(E)),Cg(D),console.log(`[addMessage] executionLog entries:`,i?.length,`| agent_file entries:`,i?.filter(e=>e.nodeType===`tool_exec`&&e.action?.name===`agent_file`).length,`| artifacts:`,D.length),D.length>0){let e=document.createElement(`button`);e.className=`artifacts-btn`,e.type=`button`,e.title=r(`artifacts.btnTitle`,{count:D.length}),e.innerHTML=`
|
|
1783
1783
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="14" height="14">
|
|
1784
1784
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
1785
1785
|
<polyline points="14 2 14 8 20 8"/>
|
|
@@ -1852,11 +1852,11 @@ Click to view assessment details`,reflectionFailedTitle:`Reflection assessment f
|
|
|
1852
1852
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
1853
1853
|
<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25z"/>
|
|
1854
1854
|
</svg>
|
|
1855
|
-
</button>`,e.parentElement.insertBefore(t,e),t.appendChild(e)}),s.querySelectorAll(`.subtask-progress`).forEach(e=>{Jv(e)}),s.querySelectorAll(`.tool-call-terminate-btn, .agent-stream-terminate-btn`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation(),hy(F.activeSessionId)})}),s.querySelectorAll(`.tool-call-abort-btn`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),chrome.runtime.sendMessage({type:`ABORT_CURRENT_TOOL`,sessionId:F.activeSessionId}),e.disabled=!0,e.title=r(`chatMsg.aborting`)})});let l=s.querySelector(`.message-footer`);if(l){let e=l.querySelector(`.copy-btn`);e&&e.addEventListener(`click`,t=>{t.stopPropagation(),x_(s,e,t)});let t=l.querySelector(`.quote-btn`);t&&t.addEventListener(`click`,e=>{e.stopPropagation(),k_(s)});let n=l.querySelector(`.export-trigger-btn`),r=l.querySelector(`.export-dropdown`);n&&r&&(n.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==r&&e.classList.remove(`show`)}),r.classList.toggle(`show`)}),r.querySelector(`.export-docx-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let t=e.currentTarget,{exportAssistantMessageToDocx:n}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-
|
|
1855
|
+
</button>`,e.parentElement.insertBefore(t,e),t.appendChild(e)}),s.querySelectorAll(`.subtask-progress`).forEach(e=>{Jv(e)}),s.querySelectorAll(`.tool-call-terminate-btn, .agent-stream-terminate-btn`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation(),hy(F.activeSessionId)})}),s.querySelectorAll(`.tool-call-abort-btn`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),chrome.runtime.sendMessage({type:`ABORT_CURRENT_TOOL`,sessionId:F.activeSessionId}),e.disabled=!0,e.title=r(`chatMsg.aborting`)})});let l=s.querySelector(`.message-footer`);if(l){let e=l.querySelector(`.copy-btn`);e&&e.addEventListener(`click`,t=>{t.stopPropagation(),x_(s,e,t)});let t=l.querySelector(`.quote-btn`);t&&t.addEventListener(`click`,e=>{e.stopPropagation(),k_(s)});let n=l.querySelector(`.export-trigger-btn`),r=l.querySelector(`.export-dropdown`);n&&r&&(n.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==r&&e.classList.remove(`show`)}),r.classList.toggle(`show`)}),r.querySelector(`.export-docx-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let t=e.currentTarget,{exportAssistantMessageToDocx:n}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToDocx:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(s,t,r)}),r.querySelector(`.export-md-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let t=e.currentTarget,{exportAssistantMessageToMarkdown:n}=await I(async()=>{let{exportAssistantMessageToMarkdown:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToMarkdown:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(s,t,r)}),r.querySelector(`.export-pdf-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let t=e.currentTarget,{exportAssistantMessageToPdf:n}=await I(async()=>{let{exportAssistantMessageToPdf:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToPdf:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(s,t,r)}),r.querySelector(`.export-image-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let t=e.currentTarget,{exportAssistantMessageToImage:n}=await I(async()=>{let{exportAssistantMessageToImage:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToImage:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));n(s,t,r)}));let i=l.querySelector(`.prototype-btn-small`);if(i){let e=(()=>{try{let e=s.dataset.executionLog;return e?JSON.parse(e):[]}catch{return[]}})().find(e=>e.nodeType===`tool_exec`&&e.action?.name===`preview_ui`||e.action?.name===`preview_preview_ui`&&e.status===`success`);e&&i.addEventListener(`click`,()=>{let t=e.prototypeId;if(!t&&e.observation)try{t=(typeof e.observation==`string`?JSON.parse(e.observation):e.observation)?.prototypeId}catch{}t?hs(t):a.error(`[SidePanel] not found prototypeId,entry keys:`,Object.keys(e),`observation:`,e.observation)})}let o=l.querySelector(`.bookmark-btn`);o&&(Pu(o,F.activeSessionId,s.dataset.messageId),o.addEventListener(`click`,async e=>{e.stopPropagation();let t=F.activeSessionId,n=s.dataset.messageId;if(o.classList.contains(`bookmarked`)){await Su(t,n),Pu(o,t,n);let{refreshBookmarkPanel:e}=await I(async()=>{let{refreshBookmarkPanel:e}=await Promise.resolve().then(()=>Eu);return{refreshBookmarkPanel:e}},void 0);e()}else{await xu(t,n,s.dataset.textContent_||``,F.sessions.find(e=>e.id===t)?.title||``),Pu(o,t,n);let{refreshBookmarkPanel:e}=await I(async()=>{let{refreshBookmarkPanel:e}=await Promise.resolve().then(()=>Eu);return{refreshBookmarkPanel:e}},void 0);e()}}));let c=l.querySelector(`.delete-btn`);c&&c.addEventListener(`click`,e=>{e.stopPropagation(),_y(s)});let u=l.querySelector(`.fork-btn`);u&&u.addEventListener(`click`,async e=>{e.stopPropagation();let t=s.dataset.messageId;t&&await Ho(F.activeSessionId,t)});let d=l.querySelector(`.resume-task-btn`);d&&d.addEventListener(`click`,async e=>{if(e.stopPropagation(),d.disabled)return;let t=await M_();t!==null&&(d.disabled=!0,d.style.opacity=`0.6`,d.style.cursor=`not-allowed`,I_(F.activeSessionId,t).finally(()=>{d.disabled=!1,d.style.opacity=``,d.style.cursor=``}))}),fy(s);let f=l.querySelector(`.token-usage-tag`);f&&!f._clickBound&&(f._clickBound=!0,f.style.cursor=`pointer`,f.addEventListener(`click`,e=>{e.stopPropagation();try{let e=s.dataset.executionLog,t=Ze(e?JSON.parse(e):[]);t&&rt(t,f)}catch{}}))}let u=s.querySelector(`.message-toolbar`);if(u){let e=u.querySelector(`.edit-btn`);e&&e.addEventListener(`click`,e=>{e.stopPropagation(),by(s)});let t=u.querySelector(`.copy-btn`);t&&t.addEventListener(`click`,e=>{e.stopPropagation(),b_(s,t)});let n=u.querySelector(`.delete-btn`);n&&n.addEventListener(`click`,e=>{e.stopPropagation(),_y(s)})}s.querySelectorAll(`.user-message-image`).forEach(e=>{e.addEventListener(`click`,()=>{Tl(e.src,e)})}),i.appendChild(s),Ox()}function my(e){e.querySelectorAll(`.tool-call-body > pre, .tool-result-content > pre, .agent-stream-output > pre`).forEach(e=>{if(e.parentElement.classList.contains(`code-block-container`))return;let t=document.createElement(`div`);t.className=`code-block-container`,t.style.position=`relative`,t.innerHTML=`<button class="code-copy-btn" title="${r(`chatMsg.copyCode`)}">
|
|
1856
1856
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
1857
1857
|
<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25zM5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25z"/>
|
|
1858
1858
|
</svg>
|
|
1859
|
-
</button>`,e.parentElement.insertBefore(t,e),t.appendChild(e)}),e.querySelectorAll(`.thinking-process-header`).forEach(e=>{Z_(e)}),e.querySelectorAll(`.tool-call-header`).forEach(e=>{e.addEventListener(`click`,t=>{if(t.ctrlKey||t.metaKey)return;let n=e.closest(`.tool-call-item`);n&&n.classList.toggle(`expanded`)})}),e.querySelectorAll(`.tool-call-result`).forEach(e=>{let t=e.querySelector(`code`);if(!t)return;let n=t.dataset.fullContent;if(!n||n.length<=500)return;let r=t.textContent||``,i=!1;e.style.cursor=`pointer`,e.addEventListener(`click`,e=>{e.ctrlKey||e.metaKey||(e.stopPropagation(),i=!i,t.textContent=i?n:r)})}),e.querySelectorAll(`.subtask-progress`).forEach(e=>{Jv(e)}),e.querySelectorAll(`.tool-call-terminate-btn, .agent-stream-terminate-btn`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation(),hy(F.activeSessionId)})}),e.querySelectorAll(`.tool-call-abort-btn`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),chrome.runtime.sendMessage({type:`ABORT_CURRENT_TOOL`,sessionId:F.activeSessionId}),e.disabled=!0,e.title=r(`chatMsg.aborting`)})}),e.querySelectorAll(`.message-footer`).forEach(e=>{let t=e.closest(`.message`);if(!t)return;let n=e.querySelector(`.copy-btn`);n&&n.addEventListener(`click`,e=>{e.stopPropagation(),x_(t,n,e)});let r=e.querySelector(`.quote-btn`);r&&r.addEventListener(`click`,e=>{e.stopPropagation(),k_(t)});let i=e.querySelector(`.export-trigger-btn`),a=e.querySelector(`.export-dropdown`);i&&a&&(i.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==a&&e.classList.remove(`show`)}),a.classList.toggle(`show`)}),a.querySelector(`.export-docx-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let n=e.currentTarget,{exportAssistantMessageToDocx:r}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-
|
|
1859
|
+
</button>`,e.parentElement.insertBefore(t,e),t.appendChild(e)}),e.querySelectorAll(`.thinking-process-header`).forEach(e=>{Z_(e)}),e.querySelectorAll(`.tool-call-header`).forEach(e=>{e.addEventListener(`click`,t=>{if(t.ctrlKey||t.metaKey)return;let n=e.closest(`.tool-call-item`);n&&n.classList.toggle(`expanded`)})}),e.querySelectorAll(`.tool-call-result`).forEach(e=>{let t=e.querySelector(`code`);if(!t)return;let n=t.dataset.fullContent;if(!n||n.length<=500)return;let r=t.textContent||``,i=!1;e.style.cursor=`pointer`,e.addEventListener(`click`,e=>{e.ctrlKey||e.metaKey||(e.stopPropagation(),i=!i,t.textContent=i?n:r)})}),e.querySelectorAll(`.subtask-progress`).forEach(e=>{Jv(e)}),e.querySelectorAll(`.tool-call-terminate-btn, .agent-stream-terminate-btn`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation(),hy(F.activeSessionId)})}),e.querySelectorAll(`.tool-call-abort-btn`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),chrome.runtime.sendMessage({type:`ABORT_CURRENT_TOOL`,sessionId:F.activeSessionId}),e.disabled=!0,e.title=r(`chatMsg.aborting`)})}),e.querySelectorAll(`.message-footer`).forEach(e=>{let t=e.closest(`.message`);if(!t)return;let n=e.querySelector(`.copy-btn`);n&&n.addEventListener(`click`,e=>{e.stopPropagation(),x_(t,n,e)});let r=e.querySelector(`.quote-btn`);r&&r.addEventListener(`click`,e=>{e.stopPropagation(),k_(t)});let i=e.querySelector(`.export-trigger-btn`),a=e.querySelector(`.export-dropdown`);i&&a&&(i.addEventListener(`click`,e=>{e.stopPropagation(),document.querySelectorAll(`.export-dropdown.show`).forEach(e=>{e!==a&&e.classList.remove(`show`)}),a.classList.toggle(`show`)}),a.querySelector(`.export-docx-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let n=e.currentTarget,{exportAssistantMessageToDocx:r}=await I(async()=>{let{exportAssistantMessageToDocx:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToDocx:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));r(t,n,a)}),a.querySelector(`.export-md-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let n=e.currentTarget,{exportAssistantMessageToMarkdown:r}=await I(async()=>{let{exportAssistantMessageToMarkdown:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToMarkdown:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));r(t,n,a)}),a.querySelector(`.export-pdf-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let n=e.currentTarget,{exportAssistantMessageToPdf:r}=await I(async()=>{let{exportAssistantMessageToPdf:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToPdf:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));r(t,n,a)}),a.querySelector(`.export-image-item`)?.addEventListener(`click`,async e=>{e.stopPropagation();let n=e.currentTarget,{exportAssistantMessageToImage:r}=await I(async()=>{let{exportAssistantMessageToImage:e}=await import(`./chat-export-CYBHjKQ4.js`);return{exportAssistantMessageToImage:e}},__vite__mapDeps([9,10,1,3,11,2,12,0]));r(t,n,a)}));let o=e.querySelector(`.prototype-btn-small`);if(o){let e=(()=>{try{let e=t.dataset.executionLog;return e?JSON.parse(e):[]}catch{return[]}})().find(e=>e.nodeType===`tool_exec`&&e.action?.name===`preview_ui`||e.action?.name===`preview_preview_ui`&&e.status===`success`);e&&o.addEventListener(`click`,()=>{let t=e.prototypeId;if(!t&&e.observation)try{t=(typeof e.observation==`string`?JSON.parse(e.observation):e.observation)?.prototypeId}catch{}t&&hs(t)})}let s=e.querySelector(`.bookmark-btn`);s&&(Pu(s,F.activeSessionId,t.dataset.messageId),s.addEventListener(`click`,async e=>{e.stopPropagation();let n=F.activeSessionId,r=t.dataset.messageId;if(s.classList.contains(`bookmarked`)){await Su(n,r),Pu(s,n,r);let{refreshBookmarkPanel:e}=await I(async()=>{let{refreshBookmarkPanel:e}=await Promise.resolve().then(()=>Eu);return{refreshBookmarkPanel:e}},void 0);e()}else{await xu(n,r,t.dataset.textContent_||``,F.sessions.find(e=>e.id===n)?.title||``),Pu(s,n,r);let{refreshBookmarkPanel:e}=await I(async()=>{let{refreshBookmarkPanel:e}=await Promise.resolve().then(()=>Eu);return{refreshBookmarkPanel:e}},void 0);e()}}));let c=e.querySelector(`.delete-btn`);c&&c.addEventListener(`click`,e=>{e.stopPropagation(),_y(t)});let l=e.querySelector(`.fork-btn`);l&&l.addEventListener(`click`,async e=>{e.stopPropagation();let n=t.dataset.messageId;n&&await Ho(F.activeSessionId,n)});let u=e.querySelector(`.resume-task-btn`);u&&u.addEventListener(`click`,async e=>{if(e.stopPropagation(),u.disabled)return;let t=await M_();t!==null&&(u.disabled=!0,u.style.opacity=`0.6`,u.style.cursor=`not-allowed`,I_(F.activeSessionId,t).finally(()=>{u.disabled=!1,u.style.opacity=``,u.style.cursor=``}))}),fy(t);let d=e.querySelector(`.token-usage-tag`);d&&!d._clickBound&&(d._clickBound=!0,d.style.cursor=`pointer`,d.addEventListener(`click`,e=>{e.stopPropagation();try{let e=t.dataset.executionLog,n=Ze(e?JSON.parse(e):[]);n&&rt(n,d)}catch{}}))}),e.querySelectorAll(`.message-toolbar`).forEach(e=>{let t=e.closest(`.message`);if(!t)return;let n=e.querySelector(`.edit-btn`);n&&n.addEventListener(`click`,e=>{e.stopPropagation(),by(t)});let r=e.querySelector(`.copy-btn`);r&&r.addEventListener(`click`,e=>{e.stopPropagation(),b_(t,r)});let i=e.querySelector(`.delete-btn`);i&&i.addEventListener(`click`,e=>{e.stopPropagation(),_y(t)})}),e.querySelectorAll(`.user-message-image`).forEach(e=>{e.addEventListener(`click`,()=>{Tl(e.src,e)})}),e.querySelectorAll(`.mermaid-controls`).forEach(e=>e.remove()),$a(),sy(),ly(),Ox()}function hy(e){return new Promise(t=>{let n=document.querySelector(`.command-terminate-overlay`);n&&n.remove();let i=document.createElement(`div`);i.className=`command-terminate-overlay`,i.innerHTML=`
|
|
1860
1860
|
<div class="command-terminate-modal">
|
|
1861
1861
|
<div class="command-terminate-header">
|
|
1862
1862
|
<div class="command-terminate-icon">⏹</div>
|
|
@@ -2536,7 +2536,7 @@ Agent address: {url}
|
|
|
2536
2536
|
Are you sure you want to update the agent? It will install the latest version via npm, then restart the service. The service will be unavailable during update.`,updateAgentTitle:`Update Agent`,agentUpdating:`Updating agent (may take a few minutes)...`,agentUpdateRestarting:`Agent is updating and restarting...`,updateFailed:`Update failed: {error}`,updateRequestFailed:`Update request failed: {error}`,stopAgentConfirm:`Agent name: {name}
|
|
2537
2537
|
Agent address: {url}
|
|
2538
2538
|
|
|
2539
|
-
Are you sure you want to stop the agent service? You will not be able to connect and will need to manually restart it.`,stopAgentTitle:`Stop Agent`,agentStopped:`Agent service stopped, agent is offline`,stopFailed:`Stop failed: {error}`,stopRequestFailed:`Stop request failed: {error}`,agentStatusRefreshed:`Agent status refreshed`,deleteAgentTitle:`Delete Agent`,deleteAgentConfirm:`Are you sure you want to delete agent "{name}"? This action cannot be undone.`,welcomeTitle:`Start a Conversation`,welcomeSubtitle:`Enter your question and the AI assistant will help you`,sendBtnStop:`Stop generating`,sendBtnSend:`Send`,imageNotEnabled:`Image recognition not enabled, image attached as file`,screenshotFailed:`Screenshot failed, please retry`,auditCategoryAuth:`Auth`,auditCategoryFs:`File`,auditCategoryExec:`Command`,auditCategorySecurity:`Security`,auditCategorySystem:`System`,auditDetailSeparator:`; `,auditQueryFailed:`Query failed: {error}`,auditLoadFailed:`Load failed: {error}`,auditNoMatch:`No matching audit logs`,auditEmpty:`No audit logs`,clearStatsConfirm:`Are you sure you want to clear all tool usage stats? This action cannot be undone.`,clearStatsTitle:`Clear Stats`,toolStatsSummary:`Used {used} tools, unused {unused} tools`,toolStatsLoadFailed:`Load failed`,toolNameDescSeparator:`: `}}),window.showCustomConfirm=function(e,t=r(`sidePanel.confirmAction`)){return new Promise(n=>{let r=document.getElementById(`customConfirmOverlay`),i=document.getElementById(`customConfirmTitle`),a=document.getElementById(`customConfirmMessage`),o=document.getElementById(`customConfirmCancelBtn`),s=document.getElementById(`customConfirmOkBtn`);if(!r||!i||!a||!o||!s){n(confirm(e));return}let c=()=>{r.style.display=`none`,s.removeEventListener(`click`,l),o.removeEventListener(`click`,u),r.removeEventListener(`click`,d),document.removeEventListener(`keydown`,f)},l=()=>{c(),n(!0)},u=()=>{c(),n(!1)},d=e=>{e.target===r&&(c(),n(!1))},f=e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),l()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u())};i.textContent=t,a.innerHTML=e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/\n/g,`<br>`),r.style.display=`flex`,s.addEventListener(`click`,l),o.addEventListener(`click`,u),r.addEventListener(`click`,d),document.addEventListener(`keydown`,f),requestAnimationFrame(()=>s.focus())})},chrome.storage.onChanged.addListener((e,t)=>{t===`local`&&e.chatAutoCompaction&&(F.chatConfig.autoCompaction=e.chatAutoCompaction.newValue===!0,LC(),a.debug(`[SidePanel] auto-compaction config updated:`,F.chatConfig.autoCompaction)),t===`local`&&e.chatPersistSummaryToMemory&&(F.chatConfig.persistSummaryToMemory=e.chatPersistSummaryToMemory.newValue!==!1,RC(),a.debug(`[SidePanel] persist-summary config updated:`,F.chatConfig.persistSummaryToMemory)),t===`local`&&e.chatMaxMemoryMessages&&(F.chatConfig.maxMemoryMessages=e.chatMaxMemoryMessages.newValue,IC(),a.debug(`[SidePanel] memory limitconfiguration updated:`,F.chatConfig.maxMemoryMessages))});function IC(){let e=document.getElementById(`memoryLimitLabel`);e&&(F.chatConfig.maxMemoryMessages!==null&&F.chatConfig.maxMemoryMessages!==void 0&&F.chatConfig.maxMemoryMessages>0?e.textContent=F.chatConfig.maxMemoryMessages:e.textContent=r(`sidePanel.memoryLimitAll`),e.title=r(`sidePanel.memoryLimitTitle`))}function LC(){let e=document.getElementById(`autoCompactBtn`);e&&(e.checked=F.chatConfig.autoCompaction===!0)}function RC(){let e=document.getElementById(`persistSummaryBtn`);e&&(e.checked=F.chatConfig.persistSummaryToMemory!==!1)}function zC(e){e.preventDefault(),e.stopPropagation();let t=document.getElementById(`memoryLimitDropdown`);if(t.classList.toggle(`show`),t.classList.contains(`show`)){let e=F.chatConfig.maxMemoryMessages;t.querySelectorAll(`.memory-limit-option`).forEach(t=>{t.classList.remove(`selected`);let n=parseInt(t.dataset.value);(e===null&&n===0||e!==null&&e>0&&n===e)&&t.classList.add(`selected`)});let n=t.querySelector(`#memoryLimitInput`);e!==null&&e>0?n.value=e:n.value=``}}function BC(){let e=document.getElementById(`memoryLimitDropdown`),t=document.getElementById(`memoryLimitLabel`),n=e?.querySelector(`#memoryLimitInput`);if(!e||!t)return;IC(),t.addEventListener(`click`,zC);let i=document.getElementById(`autoCompactBtn`);i&&(i.checked=F.chatConfig.autoCompaction===!0,i.addEventListener(`change`,()=>{let e=i.checked;chrome.storage.local.set({chatAutoCompaction:e},()=>{F.chatConfig.autoCompaction=e,L(r(`sidePanel.configUpdated`),`success`)})}));let a=document.getElementById(`persistSummaryBtn`);a&&(a.checked=F.chatConfig.persistSummaryToMemory!==!1,a.addEventListener(`change`,()=>{let e=a.checked;chrome.storage.local.set({chatPersistSummaryToMemory:e},()=>{F.chatConfig.persistSummaryToMemory=e,L(r(`sidePanel.configUpdated`),`success`)})}));let o=e.querySelectorAll(`.memory-limit-option`);o.forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation();let i=parseInt(e.dataset.value),a=i===0?null:i;o.forEach(e=>e.classList.remove(`selected`)),e.classList.add(`selected`),n&&(n.value=i===0?``:i),chrome.storage.local.set({chatMaxMemoryMessages:a},()=>{F.chatConfig.maxMemoryMessages=a,IC(),L(r(`sidePanel.configUpdated`),`success`)})})}),n&&(n.addEventListener(`click`,e=>e.stopPropagation()),n.addEventListener(`mousedown`,e=>e.stopPropagation()),n.addEventListener(`change`,e=>{e.stopPropagation();let t=e.target.value.trim(),n=t&&parseInt(t)>0?parseInt(t):null;o.forEach(e=>e.classList.remove(`selected`)),chrome.storage.local.set({chatMaxMemoryMessages:n},()=>{F.chatConfig.maxMemoryMessages=n,IC(),L(r(`sidePanel.configUpdated`),`success`)})})),document.getElementById(`memoryLimitConfigEntry`)?.addEventListener(`click`,()=>{chrome.runtime.sendMessage({type:`OPEN_OPTIONS_PAGE`,hash:`memory`})}),document.addEventListener(`click`,n=>{!e.contains(n.target)&&n.target!==t&&e.classList.remove(`show`)})}async function VC(e){if(F.activeAgentId&&F.activeAgentId!=="default")try{let{updateAgent:t}=await I(async()=>{let{updateAgent:e}=await import(`./agent-store-
|
|
2539
|
+
Are you sure you want to stop the agent service? You will not be able to connect and will need to manually restart it.`,stopAgentTitle:`Stop Agent`,agentStopped:`Agent service stopped, agent is offline`,stopFailed:`Stop failed: {error}`,stopRequestFailed:`Stop request failed: {error}`,agentStatusRefreshed:`Agent status refreshed`,deleteAgentTitle:`Delete Agent`,deleteAgentConfirm:`Are you sure you want to delete agent "{name}"? This action cannot be undone.`,welcomeTitle:`Start a Conversation`,welcomeSubtitle:`Enter your question and the AI assistant will help you`,sendBtnStop:`Stop generating`,sendBtnSend:`Send`,imageNotEnabled:`Image recognition not enabled, image attached as file`,screenshotFailed:`Screenshot failed, please retry`,auditCategoryAuth:`Auth`,auditCategoryFs:`File`,auditCategoryExec:`Command`,auditCategorySecurity:`Security`,auditCategorySystem:`System`,auditDetailSeparator:`; `,auditQueryFailed:`Query failed: {error}`,auditLoadFailed:`Load failed: {error}`,auditNoMatch:`No matching audit logs`,auditEmpty:`No audit logs`,clearStatsConfirm:`Are you sure you want to clear all tool usage stats? This action cannot be undone.`,clearStatsTitle:`Clear Stats`,toolStatsSummary:`Used {used} tools, unused {unused} tools`,toolStatsLoadFailed:`Load failed`,toolNameDescSeparator:`: `}}),window.showCustomConfirm=function(e,t=r(`sidePanel.confirmAction`)){return new Promise(n=>{let r=document.getElementById(`customConfirmOverlay`),i=document.getElementById(`customConfirmTitle`),a=document.getElementById(`customConfirmMessage`),o=document.getElementById(`customConfirmCancelBtn`),s=document.getElementById(`customConfirmOkBtn`);if(!r||!i||!a||!o||!s){n(confirm(e));return}let c=()=>{r.style.display=`none`,s.removeEventListener(`click`,l),o.removeEventListener(`click`,u),r.removeEventListener(`click`,d),document.removeEventListener(`keydown`,f)},l=()=>{c(),n(!0)},u=()=>{c(),n(!1)},d=e=>{e.target===r&&(c(),n(!1))},f=e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),l()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u())};i.textContent=t,a.innerHTML=e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/\n/g,`<br>`),r.style.display=`flex`,s.addEventListener(`click`,l),o.addEventListener(`click`,u),r.addEventListener(`click`,d),document.addEventListener(`keydown`,f),requestAnimationFrame(()=>s.focus())})},chrome.storage.onChanged.addListener((e,t)=>{t===`local`&&e.chatAutoCompaction&&(F.chatConfig.autoCompaction=e.chatAutoCompaction.newValue===!0,LC(),a.debug(`[SidePanel] auto-compaction config updated:`,F.chatConfig.autoCompaction)),t===`local`&&e.chatPersistSummaryToMemory&&(F.chatConfig.persistSummaryToMemory=e.chatPersistSummaryToMemory.newValue!==!1,RC(),a.debug(`[SidePanel] persist-summary config updated:`,F.chatConfig.persistSummaryToMemory)),t===`local`&&e.chatMaxMemoryMessages&&(F.chatConfig.maxMemoryMessages=e.chatMaxMemoryMessages.newValue,IC(),a.debug(`[SidePanel] memory limitconfiguration updated:`,F.chatConfig.maxMemoryMessages))});function IC(){let e=document.getElementById(`memoryLimitLabel`);e&&(F.chatConfig.maxMemoryMessages!==null&&F.chatConfig.maxMemoryMessages!==void 0&&F.chatConfig.maxMemoryMessages>0?e.textContent=F.chatConfig.maxMemoryMessages:e.textContent=r(`sidePanel.memoryLimitAll`),e.title=r(`sidePanel.memoryLimitTitle`))}function LC(){let e=document.getElementById(`autoCompactBtn`);e&&(e.checked=F.chatConfig.autoCompaction===!0)}function RC(){let e=document.getElementById(`persistSummaryBtn`);e&&(e.checked=F.chatConfig.persistSummaryToMemory!==!1)}function zC(e){e.preventDefault(),e.stopPropagation();let t=document.getElementById(`memoryLimitDropdown`);if(t.classList.toggle(`show`),t.classList.contains(`show`)){let e=F.chatConfig.maxMemoryMessages;t.querySelectorAll(`.memory-limit-option`).forEach(t=>{t.classList.remove(`selected`);let n=parseInt(t.dataset.value);(e===null&&n===0||e!==null&&e>0&&n===e)&&t.classList.add(`selected`)});let n=t.querySelector(`#memoryLimitInput`);e!==null&&e>0?n.value=e:n.value=``}}function BC(){let e=document.getElementById(`memoryLimitDropdown`),t=document.getElementById(`memoryLimitLabel`),n=e?.querySelector(`#memoryLimitInput`);if(!e||!t)return;IC(),t.addEventListener(`click`,zC);let i=document.getElementById(`autoCompactBtn`);i&&(i.checked=F.chatConfig.autoCompaction===!0,i.addEventListener(`change`,()=>{let e=i.checked;chrome.storage.local.set({chatAutoCompaction:e},()=>{F.chatConfig.autoCompaction=e,L(r(`sidePanel.configUpdated`),`success`)})}));let a=document.getElementById(`persistSummaryBtn`);a&&(a.checked=F.chatConfig.persistSummaryToMemory!==!1,a.addEventListener(`change`,()=>{let e=a.checked;chrome.storage.local.set({chatPersistSummaryToMemory:e},()=>{F.chatConfig.persistSummaryToMemory=e,L(r(`sidePanel.configUpdated`),`success`)})}));let o=e.querySelectorAll(`.memory-limit-option`);o.forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation();let i=parseInt(e.dataset.value),a=i===0?null:i;o.forEach(e=>e.classList.remove(`selected`)),e.classList.add(`selected`),n&&(n.value=i===0?``:i),chrome.storage.local.set({chatMaxMemoryMessages:a},()=>{F.chatConfig.maxMemoryMessages=a,IC(),L(r(`sidePanel.configUpdated`),`success`)})})}),n&&(n.addEventListener(`click`,e=>e.stopPropagation()),n.addEventListener(`mousedown`,e=>e.stopPropagation()),n.addEventListener(`change`,e=>{e.stopPropagation();let t=e.target.value.trim(),n=t&&parseInt(t)>0?parseInt(t):null;o.forEach(e=>e.classList.remove(`selected`)),chrome.storage.local.set({chatMaxMemoryMessages:n},()=>{F.chatConfig.maxMemoryMessages=n,IC(),L(r(`sidePanel.configUpdated`),`success`)})})),document.getElementById(`memoryLimitConfigEntry`)?.addEventListener(`click`,()=>{chrome.runtime.sendMessage({type:`OPEN_OPTIONS_PAGE`,hash:`memory`})}),document.addEventListener(`click`,n=>{!e.contains(n.target)&&n.target!==t&&e.classList.remove(`show`)})}async function VC(e){if(F.activeAgentId&&F.activeAgentId!=="default")try{let{updateAgent:t}=await I(async()=>{let{updateAgent:e}=await import(`./agent-store-Cqyodrcc.js`).then(e=>e.t);return{updateAgent:e}},__vite__mapDeps([0,1,2,3]));await t(F.activeAgentId,{model:e})}catch{}else chrome.storage.local.set({modelName:e}),k(e)}async function HC(){try{let e=await chrome.storage.local.get([`pairedAgents`,`activeAgentId`]),t=FC(e.pairedAgents),n=e.activeAgentId,r=t.find(e=>e.id===n&&!e.disabled);if(!r){F.agentPlatform={connected:!1},ZC(F.agentPlatform);return}if(r.token)try{let e=await fetch(`${r.url}/api/status/detail`,{cache:`no-cache`,headers:{Authorization:`Bearer ${r.token}`}});if(e.ok){let t=await e.json();if(t.success){F.agentPlatform={platformName:t.platformName||`Unknown`,platform:t.platform||`unknown`,arch:t.arch||`unknown`,shell:t.shell||`/bin/sh`,homeDir:t.homeDir||``,workdir:t.workdir||``,connected:!0},t.version&&F.agentVersions.set(n,t.version),t.workdir&&F.agentWorkdirs.set(n,t.workdir),t.homeDir&&F.agentHomeDirs.set(n,t.homeDir);let e=tw(t.platformName||t.platform,t.arch);e&&F.agentSystemInfos.set(n,e)}else F.agentPlatform={connected:!1}}else F.agentPlatform={connected:!1}}catch{F.agentPlatform={connected:!1}}else F.agentPlatform={connected:!1};ZC(F.agentPlatform),Cd()}catch{}}async function UC(e,t,n){if(F.activeAgentId&&F.activeAgentId!=="default")try{let{updateAgent:n}=await I(async()=>{let{updateAgent:e}=await import(`./agent-store-Cqyodrcc.js`).then(e=>e.t);return{updateAgent:e}},__vite__mapDeps([0,1,2,3]));await n(F.activeAgentId,{temperature:e,topP:t})}catch{}else chrome.storage.local.set({temperature:e,topP:t,selectedTempIndex:n})}function WC(){let e=document.getElementById(`currentModelTag`);if(!e)return;let t=F.currentModel||``;e.textContent=t,e.title=t,e.style.display=t?``:`none`}function GC(){let e=document.getElementById(`currentModelTag`);e&&e.addEventListener(`click`,e=>{e.stopPropagation(),document.getElementById(`tempDisplay`)?.click()}),WC()}function KC(e){let t=0;document.querySelectorAll(`.model-option`).forEach(n=>{n.dataset.value===e?(n.classList.add(`selected`),n.querySelector(`.model-option-check`).textContent=`✓`,t=parseInt(n.dataset.contextWindow,10)||0):(n.classList.remove(`selected`),n.querySelector(`.model-option-check`).textContent=``)});let n=document.getElementById(`modelSelectValue`);n&&e&&(n.textContent=e);let r=document.getElementById(`modelSelectCtxBadge`);r&&(t>0?(r.textContent=T(t),r.style.display=``):r.style.display=`none`),WC()}function qC(e,t){let n=document.getElementById(`tempDropdown`);if(!n){typeof t==`function`&&t();return}let i=n.querySelector(`.model-section`),a=[];if((Array.isArray(e)?e:[]).forEach(e=>{typeof e==`string`?a.push({name:e,contextWindow:0}):e&&typeof e==`object`&&e.name&&a.push({name:e.name,contextWindow:e.contextWindow||0})}),i){i.innerHTML=`
|
|
2540
2540
|
<div class="model-section-title" data-i18n="model.selectModel">${r(`model.selectModel`)}</div>
|
|
2541
2541
|
<div class="section-select" id="modelSelect">
|
|
2542
2542
|
<div class="section-select-row" id="modelSelectRow">
|
|
@@ -2579,7 +2579,7 @@ Are you sure you want to stop the agent service? You will not be able to connect
|
|
|
2579
2579
|
</div>
|
|
2580
2580
|
<div class="temp-preset-value">${t.temp.toFixed(2)}</div>
|
|
2581
2581
|
</div>
|
|
2582
|
-
`).join(``),p.querySelectorAll(`.temp-preset-item`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),C(parseInt(e.dataset.index))})})}function C(e){let t=ct[e];t&&(F.selectedTempIndex=e,F.temperature=t.temp,_(),UC(F.temperature,F.topP,F.selectedTempIndex))}m.addEventListener(`input`,e=>{e.stopPropagation();let t=parseFloat(e.target.value);isNaN(t)&&(t=0),t=Math.max(0,Math.min(1,t)),F.temperature=t,h.value=t.toFixed(2);let n=document.getElementById(`tempIconValue`);n&&(n.textContent=t.toFixed(2)),y(),UC(F.temperature,F.topP,v())}),h.addEventListener(`change`,e=>{e.stopPropagation();let t=parseFloat(e.target.value);isNaN(t)&&(t=0),t=Math.max(0,Math.min(1,t)),F.temperature=t,m.value=t,h.value=t.toFixed(2);let n=document.getElementById(`tempIconValue`);n&&(n.textContent=t.toFixed(2)),y(),UC(F.temperature,F.topP,v())}),d&&f&&(d.addEventListener(`click`,e=>{e.stopPropagation(),f.classList.toggle(`show`)}),document.addEventListener(`click`,e=>{let t=document.querySelector(`.temp-selector`);t&&!t.contains(e.target)&&f.classList.remove(`show`)})),u.addEventListener(`mousedown`,e=>{F.lastMouseX=e.clientX,F.lastMouseY=e.clientY}),u.addEventListener(`mouseup`,e=>{F.lastMouseX=e.clientX,F.lastMouseY=e.clientY,F.enableSelectionQuery&&setTimeout(()=>{let e=window.getSelection();if(e&&!e.isCollapsed&&e.toString().trim()){let t=e.toString().trim();u.contains(e.anchorNode)&&(F.lastSelectedText=t,F.currentSelectionRange=e.getRangeAt(0).cloneRange(),JC(t),YC(e,t,F.lastMouseX,F.lastMouseY))}else u.contains(e.anchorNode)||(F.lastSelectedText=``,F.currentSelectionRange=null,window.hideFloatingMenu())},50)});let w=``,T=null;async function E(){try{let e=await new Promise(e=>{chrome.tabs.query({active:!0,currentWindow:!0},t=>e(t))});if(e&&e.length>0){let t=await new Promise(t=>{chrome.tabs.sendMessage(e[0].id,{action:`getSelectedText`},e=>{chrome.runtime.lastError?(console.debug(`[SidePanel] content script not loaded or unreachable:`,chrome.runtime.lastError.message),t(null)):t(e)})});if(!t)return;let n=t?.text||``;n&&n.trim()?n!==w&&(w=n,JC(n.trim())):w=``}}catch{}}function D(){T&&=(clearInterval(T),null),F.enableSelectionQuery&&(T=setInterval(E,500))}D(),chrome.storage.onChanged.addListener((e,t)=>{if(t===`local`&&`enableSelectionQuery`in e){F.enableSelectionQuery=e.enableSelectionQuery.newValue;let t=document.getElementById(`enableSelectionQueryBtn`);t&&(t.checked=F.enableSelectionQuery),D()}}),await S(),SS(),chrome.storage.local.get([`modelName`,`customModels`,`customPrompts`,`systemPrompt`,`inputHistory`,`agentPlatform`,`enableImageInput`,`imageModelName`,`imageApiBase`,`imageApiKey`,`enableFileInput`],e=>{let t=e.modelName;t&&(F.currentModel=t),F.customPrompts=e.customPrompts||[],F.systemPrompt=e.systemPrompt||``,F.inputHistory=e.inputHistory||[],e.agentPlatform&&(F.agentPlatform=e.agentPlatform),ZC(F.agentPlatform),chrome.runtime.sendMessage({type:`TRIGGER_AGENT_HEALTH_CHECK`}).catch(()=>{}),HC(),F.enableImageInput=e.enableImageInput||!1,F.imageModelName=e.imageModelName||``,F.imageApiBase=e.imageApiBase||``,F.imageApiKey=x(e.imageApiKey)||``,F.enableFileInput=!0,xd(),Cd(),wy(),qC(e.customModels,()=>{t&&KC(t)})}),chrome.storage.onChanged.addListener((e,t)=>{if(t===`local`){if(e.customModels&&qC(e.customModels.newValue||[],()=>{KC(F.currentModel)}),e.modelName){let t=e.modelName.newValue;t&&(!F.activeAgentId||F.activeAgentId==="default")&&(F.currentModel=t,KC(t))}if(e.enableImageInput&&(F.enableImageInput=e.enableImageInput.newValue,xd()),e.enableFileInput&&(F.enableFileInput=e.enableFileInput.newValue,Cd()),e.enableExecutionLog&&(F.chatConfig.enableExecutionLog=e.enableExecutionLog.newValue),e.showMessageTimestamp){let t=e.showMessageTimestamp.newValue!==!1;F.chatConfig.showMessageTimestamp=t,ay(t)}e.systemPrompt&&(F.systemPrompt=e.systemPrompt.newValue||``),e.imageModelName&&(F.imageModelName=e.imageModelName.newValue||``),e.imageApiBase&&(F.imageApiBase=e.imageApiBase.newValue||``),e.imageApiKey&&(F.imageApiKey=e.imageApiKey.newValue||``)}}),await jv();let O=await chrome.storage.session.get([`pendingSelectionSearch`,`pendingFillInput`,`pendingDirectSend`]),k=[];if(O.pendingSelectionSearch&&O.pendingSelectionSearch.selectedText){let{prompt:e,selectedText:t}=O.pendingSelectionSearch;a.debug(`[SidePanel] pending selected textsearch:`,t?.substring(0,50)),JC(t),setTimeout(()=>{Qv(e,t)},500),k.push(`pendingSelectionSearch`)}if(O.pendingFillInput&&O.pendingFillInput.text){let{text:e}=O.pendingFillInput;a.debug(`[SidePanel] pending fill trackasktext:`,e?.substring(0,50)),setTimeout(()=>{$v(e)},500),k.push(`pendingFillInput`)}if(O.pendingDirectSend&&O.pendingDirectSend.text){let{text:e,selectedText:t}=O.pendingDirectSend;a.debug(`[SidePanel] pending directsend text:`,e?.substring(0,50)),t&&JC(t),setTimeout(()=>{ey(e,t||``)},500),k.push(`pendingDirectSend`)}k.length>0&&await chrome.storage.session.remove(k);let A=document.getElementById(`userInput`);A&&A.focus(),document.addEventListener(`session-switched`,e=>{let{sessionId:t,previousSessionId:n}=e.detail||{},i=document.getElementById(`chatContainer`),o=document.getElementById(`userInput`);if(!i)return;let s=n&&F.messageHistory?.some(e=>e.resumable);n&&!F.pendingCallApiSessionIds.has(n)&&!s&&fw(n,i.innerHTML);let c=document.getElementById(`imagePreviewBar`);F.attachedImages.length>0&&c&&c.style.display===`none`&&(F.attachedImages=[]),F.executionLogListener&&=(chrome.runtime.onMessage.removeListener(F.executionLogListener),null),ee(),o&&o.focus();let l=F.pendingCallApiSessionIds.has(t)&&!!F.pendingCancelApi,u=pw(t),d=F.messageHistory&&F.messageHistory.length>0;if(u&&!l&&d){if(i.innerHTML=u,my(i),ja(),Ga(),!e.detail?.skipScrollRestore){let e=`scrollPosition_`+(t||`default`);chrome.storage.local.get([e],t=>{t[e]!==void 0&&setTimeout(()=>{let n=document.getElementById(`chatContainer`);n&&(n.scrollTop=t[e])},150)})}F_();return}if(i.innerHTML=``,d)F.messageHistory.forEach(e=>{e.htmlContent?py(e.htmlContent,e.messageId,e.resumable):iy(e.role,e.content,!1,e.executionLog||[],e.reflectionScore,e.wasRevised,null,e.messageId,[],!1,e.timestamp??null)}),sy(),ly(),ja(),Ga(),F.pendingCallApiSessionIds.has(t)||fw(t,i.innerHTML),F_();else{let e=document.createElement(`div`);e.className=`welcome-message`,e.innerHTML=`
|
|
2582
|
+
`).join(``),p.querySelectorAll(`.temp-preset-item`).forEach(e=>{e.addEventListener(`click`,t=>{t.stopPropagation(),C(parseInt(e.dataset.index))})})}function C(e){let t=ct[e];t&&(F.selectedTempIndex=e,F.temperature=t.temp,_(),UC(F.temperature,F.topP,F.selectedTempIndex))}m.addEventListener(`input`,e=>{e.stopPropagation();let t=parseFloat(e.target.value);isNaN(t)&&(t=0),t=Math.max(0,Math.min(1,t)),F.temperature=t,h.value=t.toFixed(2);let n=document.getElementById(`tempIconValue`);n&&(n.textContent=t.toFixed(2)),y(),UC(F.temperature,F.topP,v())}),h.addEventListener(`change`,e=>{e.stopPropagation();let t=parseFloat(e.target.value);isNaN(t)&&(t=0),t=Math.max(0,Math.min(1,t)),F.temperature=t,m.value=t,h.value=t.toFixed(2);let n=document.getElementById(`tempIconValue`);n&&(n.textContent=t.toFixed(2)),y(),UC(F.temperature,F.topP,v())}),d&&f&&(d.addEventListener(`click`,e=>{e.stopPropagation(),f.classList.toggle(`show`)}),document.addEventListener(`click`,e=>{let t=document.querySelector(`.temp-selector`);t&&!t.contains(e.target)&&f.classList.remove(`show`)})),u.addEventListener(`mousedown`,e=>{F.lastMouseX=e.clientX,F.lastMouseY=e.clientY}),u.addEventListener(`mouseup`,e=>{F.lastMouseX=e.clientX,F.lastMouseY=e.clientY,F.enableSelectionQuery&&setTimeout(()=>{let e=window.getSelection();if(e&&!e.isCollapsed&&e.toString().trim()){let t=e.toString().trim();u.contains(e.anchorNode)&&(F.lastSelectedText=t,F.currentSelectionRange=e.getRangeAt(0).cloneRange(),JC(t),YC(e,t,F.lastMouseX,F.lastMouseY))}else u.contains(e.anchorNode)||(F.lastSelectedText=``,F.currentSelectionRange=null,window.hideFloatingMenu())},50)});let w=``,T=null;async function E(){try{let e=await new Promise(e=>{chrome.tabs.query({active:!0,currentWindow:!0},t=>e(t))});if(e&&e.length>0){let t=await new Promise(t=>{chrome.tabs.sendMessage(e[0].id,{action:`getSelectedText`},e=>{chrome.runtime.lastError?(console.debug(`[SidePanel] content script not loaded or unreachable:`,chrome.runtime.lastError.message),t(null)):t(e)})});if(!t)return;let n=t?.text||``;n&&n.trim()?n!==w&&(w=n,JC(n.trim())):w=``}}catch{}}function D(){T&&=(clearInterval(T),null),F.enableSelectionQuery&&(T=setInterval(E,500))}D(),chrome.storage.onChanged.addListener((e,t)=>{if(t===`local`&&`enableSelectionQuery`in e){F.enableSelectionQuery=e.enableSelectionQuery.newValue;let t=document.getElementById(`enableSelectionQueryBtn`);t&&(t.checked=F.enableSelectionQuery),D()}}),await S(),SS(),chrome.storage.local.get([`modelName`,`customModels`,`customPrompts`,`systemPrompt`,`inputHistory`,`agentPlatform`,`enableImageInput`,`imageModelName`,`imageApiBase`,`imageApiKey`,`enableFileInput`],e=>{let t=e.modelName;t&&(F.currentModel=t),F.customPrompts=e.customPrompts||[],F.systemPrompt=e.systemPrompt||``,F.inputHistory=e.inputHistory||[],e.agentPlatform&&(F.agentPlatform=e.agentPlatform),ZC(F.agentPlatform),chrome.runtime.sendMessage({type:`TRIGGER_AGENT_HEALTH_CHECK`}).catch(()=>{}),HC(),F.enableImageInput=e.enableImageInput||!1,F.imageModelName=e.imageModelName||``,F.imageApiBase=e.imageApiBase||``,F.imageApiKey=x(e.imageApiKey)||``,F.enableFileInput=!0,xd(),Cd(),wy(),qC(e.customModels,()=>{t&&KC(t)})}),chrome.storage.onChanged.addListener((e,t)=>{if(t===`local`){if(e.customModels&&qC(e.customModels.newValue||[],()=>{KC(F.currentModel)}),e.modelName){let t=e.modelName.newValue;t&&(!F.activeAgentId||F.activeAgentId==="default")&&(F.currentModel=t,KC(t))}if(e.enableImageInput&&(F.enableImageInput=e.enableImageInput.newValue,xd()),e.enableFileInput&&(F.enableFileInput=e.enableFileInput.newValue,Cd()),e.enableExecutionLog&&(F.chatConfig.enableExecutionLog=e.enableExecutionLog.newValue),e.showMessageTimestamp){let t=e.showMessageTimestamp.newValue!==!1;F.chatConfig.showMessageTimestamp=t,ay(t)}e.systemPrompt&&(F.systemPrompt=e.systemPrompt.newValue||``),e.imageModelName&&(F.imageModelName=e.imageModelName.newValue||``),e.imageApiBase&&(F.imageApiBase=e.imageApiBase.newValue||``),e.imageApiKey&&(F.imageApiKey=x(e.imageApiKey.newValue)||``)}}),await jv();let O=await chrome.storage.session.get([`pendingSelectionSearch`,`pendingFillInput`,`pendingDirectSend`]),k=[];if(O.pendingSelectionSearch&&O.pendingSelectionSearch.selectedText){let{prompt:e,selectedText:t}=O.pendingSelectionSearch;a.debug(`[SidePanel] pending selected textsearch:`,t?.substring(0,50)),JC(t),setTimeout(()=>{Qv(e,t)},500),k.push(`pendingSelectionSearch`)}if(O.pendingFillInput&&O.pendingFillInput.text){let{text:e}=O.pendingFillInput;a.debug(`[SidePanel] pending fill trackasktext:`,e?.substring(0,50)),setTimeout(()=>{$v(e)},500),k.push(`pendingFillInput`)}if(O.pendingDirectSend&&O.pendingDirectSend.text){let{text:e,selectedText:t}=O.pendingDirectSend;a.debug(`[SidePanel] pending directsend text:`,e?.substring(0,50)),t&&JC(t),setTimeout(()=>{ey(e,t||``)},500),k.push(`pendingDirectSend`)}k.length>0&&await chrome.storage.session.remove(k);let A=document.getElementById(`userInput`);A&&A.focus(),document.addEventListener(`session-switched`,e=>{let{sessionId:t,previousSessionId:n}=e.detail||{},i=document.getElementById(`chatContainer`),o=document.getElementById(`userInput`);if(!i)return;let s=n&&F.messageHistory?.some(e=>e.resumable);n&&!F.pendingCallApiSessionIds.has(n)&&!s&&fw(n,i.innerHTML);let c=document.getElementById(`imagePreviewBar`);F.attachedImages.length>0&&c&&c.style.display===`none`&&(F.attachedImages=[]),F.executionLogListener&&=(chrome.runtime.onMessage.removeListener(F.executionLogListener),null),ee(),o&&o.focus();let l=F.pendingCallApiSessionIds.has(t)&&!!F.pendingCancelApi,u=pw(t),d=F.messageHistory&&F.messageHistory.length>0;if(u&&!l&&d){if(i.innerHTML=u,my(i),ja(),Ga(),!e.detail?.skipScrollRestore){let e=`scrollPosition_`+(t||`default`);chrome.storage.local.get([e],t=>{t[e]!==void 0&&setTimeout(()=>{let n=document.getElementById(`chatContainer`);n&&(n.scrollTop=t[e])},150)})}F_();return}if(i.innerHTML=``,d)F.messageHistory.forEach(e=>{e.htmlContent?py(e.htmlContent,e.messageId,e.resumable):iy(e.role,e.content,!1,e.executionLog||[],e.reflectionScore,e.wasRevised,null,e.messageId,[],!1,e.timestamp??null)}),sy(),ly(),ja(),Ga(),F.pendingCallApiSessionIds.has(t)||fw(t,i.innerHTML),F_();else{let e=document.createElement(`div`);e.className=`welcome-message`,e.innerHTML=`
|
|
2583
2583
|
<div class="icon-wrapper">
|
|
2584
2584
|
<div class="icon">💬</div>
|
|
2585
2585
|
</div>
|
|
@@ -2595,7 +2595,7 @@ Are you sure you want to stop the agent service? You will not be able to connect
|
|
|
2595
2595
|
<span class="audit-action">${R(e.action||`-`)}</span>
|
|
2596
2596
|
</div>
|
|
2597
2597
|
${a?`<div class="audit-details">${a}</div>`:``}
|
|
2598
|
-
</div>`}).join(``)}function Ye(){we&&(we.style.display=`flex`,qe())}function Xe(){we&&(we.style.display=`none`)}Ce&&Ce.addEventListener(`click`,e=>{e.stopPropagation(),ge(),Ye()}),Te&&Te.addEventListener(`click`,Xe),Oe&&Oe.addEventListener(`click`,qe),je&&je.addEventListener(`change`,qe),Me&&Me.addEventListener(`change`,qe),Ne&&Ne.addEventListener(`input`,()=>{Je()}),Pe&&Pe.addEventListener(`click`,()=>{Ne&&(Ne.value=``),Je()}),PC(()=>F.activeSessionId,showCustomConfirm);let Ze=document.getElementById(`isolateChatBtn`),Qe=document.getElementById(`enableToolsBtn`),z=document.getElementById(`toolsConfigBtn`),$e=`agentEnabledTools_${F.activeAgentId||`default`}`,B=`agentMcpClosedServers_${F.activeAgentId||`default`}`;chrome.storage.local.get([$e,`enabledTools`,`isolateChat`,`enableSelectionQuery`,`enableTools`,B,`mcpTools`,`mcpEnabled`,`ragTools`,`ragToolsIntroduced`],e=>{e.isolateChat!==void 0&&(F.isolateChat=e.isolateChat),Ze.checked=F.isolateChat,e.enableSelectionQuery!==void 0&&(F.enableSelectionQuery=e.enableSelectionQuery);let t=document.getElementById(`enableSelectionQueryBtn`);t&&(t.checked=F.enableSelectionQuery),e.enableTools!==void 0&&(F.useTools=e.enableTools),F.activeAgentId&&I(async()=>{let{getAgent:e}=await import(`./agent-store-
|
|
2598
|
+
</div>`}).join(``)}function Ye(){we&&(we.style.display=`flex`,qe())}function Xe(){we&&(we.style.display=`none`)}Ce&&Ce.addEventListener(`click`,e=>{e.stopPropagation(),ge(),Ye()}),Te&&Te.addEventListener(`click`,Xe),Oe&&Oe.addEventListener(`click`,qe),je&&je.addEventListener(`change`,qe),Me&&Me.addEventListener(`change`,qe),Ne&&Ne.addEventListener(`input`,()=>{Je()}),Pe&&Pe.addEventListener(`click`,()=>{Ne&&(Ne.value=``),Je()}),PC(()=>F.activeSessionId,showCustomConfirm);let Ze=document.getElementById(`isolateChatBtn`),Qe=document.getElementById(`enableToolsBtn`),z=document.getElementById(`toolsConfigBtn`),$e=`agentEnabledTools_${F.activeAgentId||`default`}`,B=`agentMcpClosedServers_${F.activeAgentId||`default`}`;chrome.storage.local.get([$e,`enabledTools`,`isolateChat`,`enableSelectionQuery`,`enableTools`,B,`mcpTools`,`mcpEnabled`,`ragTools`,`ragToolsIntroduced`],e=>{e.isolateChat!==void 0&&(F.isolateChat=e.isolateChat),Ze.checked=F.isolateChat,e.enableSelectionQuery!==void 0&&(F.enableSelectionQuery=e.enableSelectionQuery);let t=document.getElementById(`enableSelectionQueryBtn`);t&&(t.checked=F.enableSelectionQuery),e.enableTools!==void 0&&(F.useTools=e.enableTools),F.activeAgentId&&I(async()=>{let{getAgent:e}=await import(`./agent-store-Cqyodrcc.js`).then(e=>e.t);return{getAgent:e}},__vite__mapDeps([0,1,2,3])).then(({getAgent:e})=>e(F.activeAgentId)).then(e=>{F.activeAgentMcpExcludedServerIds=e?e.mcpExcludedServerIds??null:null,Dn()}).catch(()=>{}),F.mcpClosedServers=e[B]||[];let n=e.ragTools||[],r=e[$e],i=e.enabledTools;if(Array.isArray(r)){let t=An(n);F.enabledTools=r.filter(e=>t.has(e));let i=kn(F.enabledTools,n,e.ragToolsIntroduced);F.enabledTools=i.tools,i.migrated?chrome.storage.local.set({ragToolsIntroduced:!0,[$e]:F.enabledTools}):F.enabledTools.length!==r.length&&chrome.storage.local.set({[$e]:F.enabledTools})}else if(i&&i.length>0){let t=An(n),r=i.filter(e=>t.has(e)),a=b.filter(e=>e.enabled&&!r.includes(e.id)).map(e=>e.id);F.enabledTools=[...r,...a];let o=kn(F.enabledTools,n,e.ragToolsIntroduced);F.enabledTools=o.tools,chrome.storage.local.set({[$e]:F.enabledTools,...o.migrated?{ragToolsIntroduced:!0}:{}})}else{F.enabledTools=b.filter(e=>e.enabled).map(e=>e.id);let t=kn(F.enabledTools,n,e.ragToolsIntroduced);F.enabledTools=t.tools,t.migrated&&chrome.storage.local.set({ragToolsIntroduced:!0,[$e]:F.enabledTools})}Qe&&(Qe.checked=F.useTools),Dn(),D()}),Ze.addEventListener(`change`,()=>{F.isolateChat=Ze.checked,chrome.storage.local.set({isolateChat:F.isolateChat}),a.debug(`[SidePanel] conv memory:`,F.isolateChat?`enabled`:`disabled`)});let et=document.getElementById(`enableSelectionQueryBtn`);et&&et.addEventListener(`change`,()=>{F.enableSelectionQuery=et.checked,chrome.storage.local.set({enableSelectionQuery:F.enableSelectionQuery}),a.debug(`[SidePanel] text Q&A:`,F.enableSelectionQuery?`enabled`:`disabled`),!F.enableSelectionQuery&&F.selectedContextText&&Ov()}),Qe&&Qe.addEventListener(`change`,()=>{F.useTools=Qe.checked,chrome.storage.local.set({enableTools:F.useTools}),a.debug(`[SidePanel] tool master switch:`,F.useTools?`enabled`:`disabled`),Dn()}),z&&z.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),pn()});let tt=document.getElementById(`toolsPopupOverlay`),nt=document.getElementById(`toolsPopupClose`),rt=tt?tt.querySelector(`.modal-container`):null;nt&&nt.addEventListener(`click`,mn),rt&&rt.addEventListener(`click`,e=>{e.stopPropagation()});let it=document.getElementById(`toolsSearchInput`),at=document.getElementById(`toolsSearchClear`);it&&it.addEventListener(`input`,e=>{F.currentSearch=e.target.value.toLowerCase(),at&&(at.style.display=e.target.value?``:`none`),hn()}),at&&at.addEventListener(`click`,()=>{it&&(it.value=``,at.style.display=`none`,F.currentSearch=``,hn())});let ot=document.querySelectorAll(`.category-btn`);ot.forEach(e=>{e.addEventListener(`click`,()=>{ot.forEach(e=>{e.classList.remove(`active`),e.classList.contains(`category-all`)?(e.style.background=`var(--brand-violet-soft-bg)`,e.style.color=`var(--brand-500)`,e.style.borderColor=`var(--brand-violet-soft-border)`):(e.style.background=`var(--bg-surface)`,e.style.color=`var(--text-secondary)`,e.style.borderColor=`var(--border-subtle)`)}),e.classList.add(`active`),e.style.background=`linear-gradient(135deg, var(--brand-500) 0%, var(--brand-accent) 100%)`,e.style.color=`var(--text-on-brand)`,e.style.borderColor=`transparent`,F.currentCategory=e.dataset.category,hn()})});let st=document.getElementById(`toolsCategories`);st&&st.addEventListener(`wheel`,e=>{e.preventDefault(),st.scrollLeft+=e.deltaY*2},{passive:!1});let lt=document.getElementById(`toolsSelectAll`),ut=document.getElementById(`toolsSelectNone`);lt&<.addEventListener(`click`,()=>{xn().forEach(e=>{let t=document.getElementById(`tool_`+e.id);t&&(t.checked=!0),F.enabledTools.includes(e.id)||F.enabledTools.push(e.id)}),En(!0),Sn(),Cn(),wn()}),ut&&ut.addEventListener(`click`,()=>{xn().forEach(e=>{let t=document.getElementById(`tool_`+e.id);t&&(t.checked=!1);let n=F.enabledTools.indexOf(e.id);n>-1&&F.enabledTools.splice(n,1)}),En(!1),Sn(),Cn(),wn()});let dt=document.getElementById(`toolsPopupSave`);dt&&dt.addEventListener(`click`,()=>{Tn(),wn()});let ft=document.getElementById(`toolsPreselectToggle`);ft&&ft.addEventListener(`change`,()=>{chrome.storage.local.set({enableToolPreselect:ft.checked},()=>{a.debug(`[SidePanel] toolpre-filter toggle updated:`,ft.checked)})});let pt=document.getElementById(`toolConfirmToggle`);pt&&pt.addEventListener(`change`,()=>{chrome.storage.local.set({toolConfirmationEnabled:pt.checked},()=>{a.debug(`[SidePanel] sensitive-operation confirmation toggle updated:`,pt.checked)})});let mt=document.getElementById(`toolsPopupCancel`);mt&&mt.addEventListener(`click`,()=>{mn()});let ht=document.getElementById(`modalCancelBtn`),gt=document.getElementById(`modalConfirmBtn`),_t=document.getElementById(`toolStatsOverlay`),vt=document.getElementById(`toolStatsClose`),yt=document.getElementById(`toolStatsBtn`);function bt(){_t&&(_t.style.display=`flex`,Tt())}function xt(){_t&&(_t.style.display=`none`)}yt&&yt.addEventListener(`click`,e=>{e.stopPropagation(),bt()}),vt&&vt.addEventListener(`click`,xt),_t&&_t.addEventListener(`click`,e=>{e.target===_t&&xt()});let St=document.getElementById(`toolStatsRefreshBtn`);St&&St.addEventListener(`click`,Tt);let Ct=document.getElementById(`toolStatsClearBtn`);Ct&&Ct.addEventListener(`click`,async()=>{await showCustomConfirm(r(`sidePanel.clearStatsConfirm`),r(`sidePanel.clearStatsTitle`))&&(await chrome.storage.local.remove([`toolUsageStats`]),Tt())});let wt={column:`callCount`,asc:!1};async function Tt(){let e=document.getElementById(`toolStatsTable`),t=document.getElementById(`toolStatsTableBody`),n=document.getElementById(`toolStatsLoading`),i=document.getElementById(`toolStatsEmpty`),o=document.getElementById(`toolStatsSummary`),s=document.getElementById(`toolStatsUnusedSection`),c=document.getElementById(`toolStatsUnusedList`);if(!(!e||!t||!n||!i)){e.style.display=`none`,i.style.display=`none`,s&&(s.style.display=`none`),o&&(o.textContent=``),n.style.display=``;try{let t=(await chrome.storage.local.get([`toolUsageStats`])).toolUsageStats||{},a=Object.entries(t);if(a.length===0){n.style.display=`none`,i.style.display=``;return}let l={};b.forEach(e=>{l[e.id]=e.name?`${e.name}${r(`sidePanel.toolNameDescSeparator`)}${e.description||``}`:e.description||e.id}),Et(a,l);let u=b.map(e=>e.id),d=new Set(a.map(([e])=>e)),f=u.filter(e=>!d.has(e)),p=a.length,m=f.length;o&&(o.textContent=r(`sidePanel.toolStatsSummary`,{used:p,unused:m})),s&&c&&m>0&&(c.innerHTML=f.sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).map(e=>`<code title="${R(l[e]||e)}" style="padding: 3px 10px; background: var(--bg-subtle); color: var(--text-disabled); border: 1px solid var(--border-subtle); border-radius: 4px; font-size: 11px;">${e}</code>`).join(``),s.style.display=``),n.style.display=`none`,e.style.display=``}catch(e){a.error(`[SidePanel] loadstats failed:`,e),n.style.display=`none`,i.textContent=r(`sidePanel.toolStatsLoadFailed`),i.style.display=``}}}function Et(e,t){let n=document.getElementById(`toolStatsTableBody`);if(!n)return;let{column:r,asc:i}=wt;n.innerHTML=[...e].sort((e,t)=>{let[n,a]=e,[o,s]=t,c=a.callCount>0?a.successCount/a.callCount*100:0,l=s.callCount>0?s.successCount/s.callCount*100:0,u=a.callCount>0?a.totalDuration/a.callCount:0,d=s.callCount>0?s.totalDuration/s.callCount:0,f=0;switch(r){case`name`:f=n.toLowerCase().localeCompare(o.toLowerCase());break;case`callCount`:f=a.callCount-s.callCount;break;case`successCount`:f=a.successCount-s.successCount;break;case`successRate`:f=c-l;break;case`duration`:f=u-d;break}return i?f:-f}).map(([e,n])=>{let r=n.callCount>0?n.successCount/n.callCount*100:0,i=n.callCount>0?n.totalDuration/n.callCount:0,a=t[e]||e,o=`#38a169`;r<60?o=`#e53e3e`:r<85&&(o=`#d69e2e`);let s=Ge(i);return`<tr>
|
|
2599
2599
|
<td style="padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary);"><code title="${R(a)}">${e}</code></td>
|
|
2600
2600
|
<td style="padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary);">${n.callCount}</td>
|
|
2601
2601
|
<td style="padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary);">${n.successCount}</td>
|