HEX
Server: nginx/1.28.3
System: Linux ip-172-31-12-242 6.17.0-1007-aws #7~24.04.1-Ubuntu SMP Thu Jan 22 21:04:49 UTC 2026 x86_64
User: root (0)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/server/panel/BTPanel/static/js/index5.js
import{c as Ie,j as i,k as r,q as e,F as Z,B as ie,L as N,s as B,R as Ze,A as Ye,r as M,g as Ae,p as s,y as I,J as _t,K as bt,x as dt,C as tt,e as ve,v as Be,bm as ze,b3 as Jt,n as J,o as Ft,a8 as Nt,M as ke,w as kt,aW as Xt,az as a1,b as r1,Q as rt}from"./base-lib.js?v=1777008528";import{w as Rt,cZ as Ue,M as Xe,k as d1,R as u1,jA as Ht,c as c1}from"./utils-lib.js?v=1777008528";import{p as Ut,i as et,f as Yt,a as e1,r as p1,b as v1,s as Bt}from"./chat-utils.js?v=1777008528";import{w as Ot}from"./index3.js?v=1777008528";import{p as g1,q as f1,d as h1,k as Wt,n as Vt,r as C1}from"./ai.js?v=1777008528";import{f as yt,g as m1,i as At,p as y1,j as w1}from"./useController23.js?v=1777008528";import"./__commonjsHelpers__.js?v=1777008528";import"./marked.esm.js?v=1777008528";import"./index119.js?v=1777008528";import"./index116.js?v=1777008528";const x1={class:"history-panel-header"},S1={class:"history-list"},L1={key:0,class:"history-empty"},k1=["onClick"],T1={class:"history-item-title"},_1={class:"history-item-time"},b1=["onClick"],M1=Ie({__name:"ChatSidebar",props:{conversations:{},currentConversationId:{},panelVisible:{type:Boolean},getTimeAgo:{type:Function},isSending:{type:Boolean}},emits:["showPanel","hidePanel","startHideTimer","clearHideTimer","loadConversation","deleteConversation"],setup(t,{emit:a}){const n=a;async function y(k){await Rt({title:"删除对话",content:"确定要删除这个对话吗?",type:"default top-index"}),n("deleteConversation",k)}return(k,u)=>(i(),r("div",{class:N(["history-panel",{"show-panel":t.panelVisible}]),onMouseenter:u[1]||(u[1]=x=>k.$emit("clearHideTimer")),onMouseleave:u[2]||(u[2]=x=>k.$emit("startHideTimer"))},[e("div",x1,[u[4]||(u[4]=e("h4",null,"历史对话",-1)),e("button",{class:"close-panel-btn",onClick:u[0]||(u[0]=x=>k.$emit("hidePanel"))},[...u[3]||(u[3]=[e("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",S1,[t.conversations.length===0?(i(),r("div",L1,[...u[5]||(u[5]=[e("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[e("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})],-1),e("div",{class:"empty-title"},"暂无历史对话",-1),e("div",{class:"empty-desc"},"开始新对话后会显示在这里",-1)])])):(i(!0),r(Z,{key:1},ie(t.conversations,x=>(i(),r("div",{key:x.id,class:N(["history-item",{active:x.id===t.currentConversationId}]),onClick:_=>k.$emit("loadConversation",x.id,x.sessions_dir)},[e("div",T1,B(x.title),1),e("div",_1,B(t.getTimeAgo(new Date(x.updatedAt))),1),e("button",{class:"history-item-delete",title:"删除对话",onClick:Ze(_=>y(x.id),["stop"])},[...u[6]||(u[6]=[Ye('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-b33e478a><polyline points="3 6 5 6 21 6" data-v-b33e478a></polyline><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2" data-v-b33e478a></path><line x1="10" y1="11" x2="10" y2="17" data-v-b33e478a></line><line x1="14" y1="11" x2="14" y2="17" data-v-b33e478a></line></svg>',1)])],8,b1)],10,k1))),128))])],34))}}),$1=Ue(M1,[["__scopeId","data-v-b33e478a"]]),qt=M(!1),Zt=M("");function Dt(t){return t.contentBlocks&&t.contentBlocks.length>0?t.contentBlocks.filter(a=>a.type==="message").map(a=>a.content).join("\n"):typeof t.content=="string"?t.content:""}function It(t){if(typeof t.content=="string")return t.content;if(Array.isArray(t.content)){const a=t.content.find(n=>n.type==="text");return(a==null?void 0:a.text)||""}return""}function Qt(t){return Array.isArray(t.content)?t.content.filter(a=>a.type==="image_url").map(a=>{var n;return((n=a.image_url)==null?void 0:n.url)||""}).filter(a=>a):[]}function P1(t){return Array.isArray(t.content)?t.content.filter(a=>a.type==="file"&&a.source&&a.path).map(a=>({value:a.source.value,path:a.path,start:a.source.start,end:a.source.end})):[]}function A1(t){return Array.isArray(t.content)?t.content.filter(a=>a.type==="site"&&a.source&&a.name).map(a=>({value:a.source.value,name:a.name,start:a.source.start,end:a.source.end})):[]}function B1(t){t.collapsed=!t.collapsed}function I1(t){t.collapsed=!t.collapsed}function U1(t){Zt.value=t,qt.value=!0}function Lt(){qt.value=!1,Zt.value=""}function D1(t,a){return t.role!=="assistant"||!a?!1:Dt(t).includes("max_tool_iterations")}const E1={class:"user-message-wrapper"},F1={class:"message-content user-message-content"},N1={key:0,class:"user-images"},R1=["src","onClick"],q1=["innerHTML"],Z1={class:"message-actions user-actions"},z1=["disabled"],H1={class:"message-body"},O1=["onClick"],W1=["innerHTML"],V1=["onClick"],Q1={key:0,class:"tool-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},G1={key:1,class:"tool-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},K1={key:2,class:"tool-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},j1={key:0,class:"tool-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},J1={key:1,class:"tool-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},X1={class:"tool-name"},Y1={key:0,class:"tool-call-description"},eo={class:"tool-call-details"},to={key:0,class:"todo-list"},oo={class:"todo-status-icon"},so={key:0,class:"todo-icon-spin",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},no={key:1,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},lo={key:2,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},io={key:3,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ao={class:"todo-description"},ro={class:"tool-call-args"},uo={key:0,class:"tool-result-content"},co=["innerHTML"],po={key:2,class:"continue-section"},vo={key:3,class:"message-actions"},go=["disabled"],fo=["disabled"],ho=["src"],Co=Ie({__name:"MessageItem",props:{msg:{},isSending:{type:Boolean},isLastAssistant:{type:Boolean},isLast:{type:Boolean},assistantName:{}},emits:["copy","regenerate","delete","toggleThink","continue"],setup(t,{emit:a}){const n=t,y=a,k=Ae(()=>D1(n.msg,!!n.isLast));function u(S){return p1(S,P1(n.msg),A1(n.msg))}function x(){const S=Dt(n.msg);y("copy",S)}function _(){y("copy",It(n.msg))}return(S,v)=>(i(),r("div",{class:N(["message",t.msg.role])},[t.msg.role==="user"?(i(),r(Z,{key:0},[e("div",E1,[e("div",F1,[s(Qt)(t.msg).length>0?(i(),r("div",N1,[(i(!0),r(Z,null,ie(s(Qt)(t.msg),(g,E)=>(i(),r("img",{key:E,src:g,alt:"图片",class:"user-image",onClick:D=>s(U1)(g)},null,8,R1))),128))])):I("",!0),s(It)(t.msg)?(i(),r("div",{key:1,innerHTML:u(s(It)(t.msg))},null,8,q1)):I("",!0)]),e("div",Z1,[e("button",{class:"message-action-btn",title:"复制",onClick:_},[...v[7]||(v[7]=[e("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})],-1)])]),e("button",{class:"message-action-btn",title:"删除",disabled:n.isSending,onClick:v[0]||(v[0]=g=>S.$emit("delete"))},[...v[8]||(v[8]=[Ye('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-3a31ed57><polyline points="3 6 5 6 21 6" data-v-3a31ed57></polyline><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2" data-v-3a31ed57></path><line x1="10" y1="11" x2="10" y2="17" data-v-3a31ed57></line><line x1="14" y1="11" x2="14" y2="17" data-v-3a31ed57></line></svg>',1)])],8,z1)])]),v[9]||(v[9]=e("div",{class:"message-avatar user-avatar"},[e("span",{class:"avatar-text"},"ME")],-1))],64)):t.msg.role==="assistant"?(i(),r(Z,{key:1},[v[27]||(v[27]=e("div",{class:"message-avatar assistant-avatar"},[e("span",{class:"avatar-text"},[e("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 17 24",width:"36.000000",height:"49.000000",fill:"none",customFrame:"#000000"},[e("defs",null,[e("clipPath",{id:"clipPath_0"},[e("rect",{width:"13.000000",height:"13.000000",x:"3.175781",y:"12.000000",fill:"rgb(255,255,255)"})]),e("linearGradient",{id:"paint_linear_5",x1:"9.67578125",x2:"9.67578125",y1:"12.2714844",y2:"25",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(207,86,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(139,136,240)",offset:"1","stop-opacity":"1"})]),e("linearGradient",{id:"paint_linear_6",x1:"9.5",x2:"9.5",y1:"14",y2:"24",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(207,86,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(139,136,240)",offset:"1","stop-opacity":"1"})]),e("clipPath",{id:"clipPath_1"},[e("rect",{width:"7.000000",height:"7.000000",x:"6.175781",y:"4.000000",fill:"rgb(255,255,255)"})]),e("linearGradient",{id:"paint_linear_7",x1:"9.68390274",x2:"9.68390274",y1:"4.32434082",y2:"10.6896744",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(255,192,8)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(255,222,124)",offset:"1","stop-opacity":"1"})]),e("linearGradient",{id:"paint_linear_8",x1:"1.98535156",x2:"1.98535156",y1:"0",y2:"3.97070312",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(255,15,0)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(255,15,0)",offset:"1","stop-opacity":"0"})]),e("linearGradient",{id:"paint_linear_9",x1:"1.98339844",x2:"1.98339844",y1:"0",y2:"3.96679688",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(0,136,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(0,136,255)",offset:"1","stop-opacity":"0"})]),e("linearGradient",{id:"paint_linear_10",x1:"1",x2:"1",y1:"0",y2:"2",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(0,255,129)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(0,255,129)",offset:"1","stop-opacity":"0"})])]),e("g",{id:"组合 286"},[e("g",{id:"svg 155",opacity:"0","clip-path":"url(#clipPath_0)",customFrame:"url(#clipPath_0)"},[e("rect",{id:"svg 155",width:"13.000000",height:"13.000000",x:"3.175781",y:"12.000000"}),e("path",{id:"合并",d:"M10.2174 13.6896C10.3837 13.5406 10.4883 13.3245 10.4883 13.084C10.4883 12.9289 10.4439 12.777 10.3603 12.6463C10.2767 12.5156 10.1575 12.4115 10.0166 12.3464C9.87581 12.2814 9.71929 12.258 9.56558 12.279C9.41188 12.3 9.26741 12.3646 9.14925 12.4652C9.0311 12.5657 8.94419 12.698 8.89882 12.8463C8.85344 12.9947 8.85148 13.1529 8.89318 13.3024C8.93487 13.4518 9.01848 13.5862 9.13411 13.6896L9.13411 14.709L6.42578 14.709C6.14053 14.709 5.86031 14.7841 5.61328 14.9267C5.36625 15.0693 5.16111 15.2745 5.01849 15.5215C4.87587 15.7685 4.80078 16.0488 4.80078 16.334L4.80078 21.7507C4.80078 22.0359 4.87587 22.3161 5.01849 22.5632C5.16111 22.8102 5.36625 23.0153 5.61328 23.158C5.86031 23.3006 6.14053 23.3757 6.42578 23.3757L12.9258 23.3757C13.211 23.3757 13.4912 23.3006 13.7383 23.158C13.9853 23.0153 14.1904 22.8102 14.3331 22.5632C14.4757 22.3161 14.5508 22.0359 14.5508 21.7507L14.5508 16.334C14.5508 16.0488 14.4757 15.7685 14.3331 15.5215C14.1904 15.2745 13.9853 15.0693 13.7383 14.9267C13.4912 14.7841 13.211 14.709 12.9258 14.709L10.2174 14.709L10.2174 13.6896ZM4.25911 17.4173L3.17578 17.4173L3.17578 20.6673L4.25911 20.6673L4.25911 17.4173ZM15.0924 17.4173L16.1758 17.4173L16.1758 20.6673L15.0924 20.6673L15.0924 17.4173ZM8.52836 19.6997C8.38954 19.8005 8.22236 19.8548 8.05078 19.8548C7.8792 19.8548 7.71202 19.8005 7.57321 19.6997C7.43439 19.5988 7.33107 19.4566 7.27805 19.2934C7.22503 19.1302 7.22503 18.9544 7.27805 18.7913C7.33107 18.6281 7.43439 18.4859 7.57321 18.385C7.71202 18.2842 7.8792 18.2298 8.05078 18.2298C8.22236 18.2298 8.38954 18.2842 8.52836 18.385C8.66717 18.4859 8.77049 18.6281 8.82351 18.7913C8.87654 18.9544 8.87654 19.1302 8.82351 19.2934C8.77049 19.4566 8.66717 19.5988 8.52836 19.6997ZM11.5519 18.2696C11.715 18.3226 11.8573 18.4259 11.9581 18.5648C12.059 18.7036 12.1133 18.8708 12.1133 19.0423C12.1133 19.2139 12.059 19.3811 11.9581 19.5199C11.8573 19.6587 11.715 19.762 11.5519 19.8151C11.3887 19.8681 11.2129 19.8681 11.0497 19.8151C10.8865 19.762 10.7443 19.6587 10.6435 19.5199C10.5426 19.3811 10.4883 19.2139 10.4883 19.0423C10.4883 18.8708 10.5426 18.7036 10.6435 18.5648C10.7443 18.4259 10.8865 18.3226 11.0497 18.2696C11.2129 18.2166 11.3887 18.2166 11.5519 18.2696ZM13.1758 24.5C13.1758 24.2239 12.9519 24 12.6758 24L6.67578 24C6.39964 24 6.17578 24.2239 6.17578 24.5C6.17578 24.7761 6.39964 25 6.67578 25L12.6758 25C12.9519 25 13.1758 24.7761 13.1758 24.5Z",fill:"url(#paint_linear_5)","fill-rule":"evenodd"})]),e("g",{id:"组合 302"},[e("path",{id:"合并",d:"M11.3235 14.9659C11.6203 14.7183 11.61 14.0359 11.858 14.0093C12.4372 13.9472 13.1075 14.188 12.5669 14.9628C12.386 15.2222 12.0044 15.5484 11.5768 15.8676C11.7643 15.8935 11.9503 15.9222 12.1341 15.9532C12.9111 15.3147 14.3915 14.1808 14.9377 14.3283C15.4628 14.4701 15.1245 15.7963 14.8697 16.5908C15.9414 16.9049 16.6428 17.1837 16.6428 17.1837C16.6428 17.1837 17 18.2593 15.214 18.6192C14.6008 18.7427 14.7913 18.9199 15.2188 19.3176C15.422 19.5067 15.6788 19.7456 15.9284 20.0523C16.683 20.9798 17 22.5628 17 22.5628L14.857 21.8466L15.5712 22.9217L14.4998 22.9213L14.8569 23.9986L14.1426 23.2806L13.5384 23.9984L12.7146 23.9975L6.29425 23.9974L6.28544 23.9989L5.46131 23.9971L4.85743 23.282L4.14314 24L4.50021 22.9227L3.4288 22.9231L4.14295 21.848L2 22.5642C2 22.5642 2.31699 20.9812 3.07164 20.0537C3.32118 19.747 3.57798 19.5081 3.78121 19.319C4.20873 18.9213 4.39916 18.7441 3.78601 18.6206C1.99995 18.2607 2.35723 17.1851 2.35723 17.1851C2.35723 17.1851 3.05857 16.9063 4.13026 16.5922C3.87555 15.7977 3.53719 14.4715 4.06231 14.3297C4.60851 14.1822 6.08893 15.3161 6.86593 15.9546C7.0497 15.9236 7.23569 15.8949 7.42319 15.869C6.99561 15.5498 6.61404 15.2236 6.43307 14.9642C5.89247 14.1894 6.56276 13.9487 7.14196 14.0107C7.38998 14.0373 7.3797 14.7197 7.6765 14.9673C7.89071 15.1461 7.89864 15.0288 7.9076 14.8963C7.91522 14.7836 7.92357 14.66 8.06005 14.698C8.35707 14.7807 8.51548 14.8066 8.51968 15.0414C8.5217 15.1545 8.48678 15.2615 8.45302 15.365C8.41677 15.4761 8.38186 15.583 8.39545 15.6892C8.39935 15.7196 8.40974 15.7426 8.42535 15.7609C8.74972 15.7364 9.07491 15.7225 9.39745 15.7218C9.78695 15.7156 10.1814 15.7297 10.5746 15.7595C10.5903 15.7412 10.6006 15.7182 10.6045 15.6878C10.6181 15.5816 10.5832 15.4747 10.547 15.3636C10.5132 15.2601 10.4783 15.1531 10.4803 15.04C10.4845 14.8052 10.6429 14.7793 10.9399 14.6966C11.0764 14.6586 11.0848 14.7822 11.0924 14.8949C11.1014 15.0274 11.1093 15.1447 11.3235 14.9659Z",fill:"url(#paint_linear_6)","fill-rule":"evenodd"}),e("ellipse",{id:"椭圆 85",rx:"0.576923",ry:"0.579347",cx:"7.19215727",cy:"21.531496",fill:"rgb(255,255,255)"}),e("ellipse",{id:"椭圆 86",rx:"0.576923",ry:"0.579347",cx:"11.8076363",cy:"21.531496",fill:"rgb(255,255,255)"}),e("path",{id:"椭圆 87",d:"M8.47187 21.8046C8.27093 21.6029 7.99841 21.4895 7.71425 21.4895C7.43009 21.4895 7.15757 21.6029 6.95664 21.8046C6.7557 22.0064 6.64282 22.2801 6.64282 22.5654L6.95076 22.5654C6.95076 22.3621 7.0312 22.1671 7.17438 22.0233C7.31757 21.8795 7.51176 21.7987 7.71425 21.7987C7.91674 21.7987 8.11094 21.8795 8.25412 22.0233C8.3973 22.1671 8.47774 22.3621 8.47774 22.5654L8.78568 22.5654C8.78568 22.2801 8.6728 22.0064 8.47187 21.8046Z",opacity:"0",fill:"rgb(255,255,255)","fill-rule":"evenodd"}),e("path",{id:"椭圆 88",d:"M12.0434 21.8046C11.8425 21.6029 11.5699 21.4895 11.2858 21.4895C11.0016 21.4895 10.7291 21.6029 10.5282 21.8046C10.3272 22.0064 10.2144 22.2801 10.2144 22.5654L10.5223 22.5654C10.5223 22.3621 10.6027 22.1671 10.7459 22.0233C10.8891 21.8795 11.0833 21.7987 11.2858 21.7987C11.4883 21.7987 11.6825 21.8795 11.8257 22.0233C11.9688 22.1671 12.0493 22.3621 12.0493 22.5654L12.3572 22.5654C12.3572 22.2801 12.2443 22.0064 12.0434 21.8046Z",opacity:"0",fill:"rgb(255,255,255)","fill-rule":"evenodd"}),e("path",{id:"矢量 2577",d:"M9.49975 22.1108L9.50002 22.8831L10.0769 23.2692M9.50002 22.8831L8.9231 23.2695",stroke:"rgb(255,255,255)","stroke-linecap":"round","stroke-width":"0.200000"})]),e("g",{id:"svg 154","clip-path":"url(#clipPath_1)",customFrame:"url(#clipPath_1)",class:"lightbulb-glow"},[e("rect",{id:"svg 154",width:"7.000000",height:"7.000000",x:"6.175781",y:"4.000000"}),e("path",{id:"矢量 2565",d:"M7.59674 7.16634C7.59674 7.07301 7.60374 6.97967 7.6154 6.89101L6.91074 6.89101C6.80107 6.89101 6.7124 6.97734 6.7124 7.08467C6.7124 7.19201 6.80107 7.27834 6.91074 7.27834L7.59907 7.27834C7.59674 7.24101 7.59674 7.20367 7.59674 7.16634ZM7.58274 8.86967C7.50574 8.94667 7.50574 9.06801 7.58274 9.14501C7.65974 9.21967 7.78574 9.21967 7.86274 9.14501L8.2244 8.79034C8.14274 8.69934 8.0564 8.59901 7.97707 8.48467L7.58274 8.86967ZM8.0844 5.78967C8.16607 5.68701 8.25707 5.59367 8.3574 5.50734L7.86507 5.02434C7.78807 4.94734 7.66207 4.94734 7.58507 5.02434C7.50807 5.09901 7.50807 5.22267 7.58507 5.29967L8.0844 5.78967ZM10.1891 10.3187L9.18107 10.3187C9.07607 10.3187 8.99207 10.4027 8.99207 10.503C8.99207 10.6057 9.07607 10.6897 9.18107 10.6897L10.1891 10.6897C10.2941 10.6897 10.3781 10.6057 10.3781 10.503C10.3781 10.4003 10.2917 10.3187 10.1891 10.3187ZM9.68507 5.16667L9.68974 5.16667C9.75507 5.16667 9.81807 5.17134 9.88107 5.17601L9.88107 4.51801C9.88107 4.41067 9.7924 4.32434 9.68274 4.32434C9.57307 4.32434 9.4844 4.41067 9.4844 4.51801L9.4844 5.17601C9.5474 5.16901 9.61274 5.16667 9.67574 5.16667L9.68507 5.16667ZM11.2857 5.78967L11.7851 5.29967C11.8621 5.22501 11.8621 5.10134 11.7851 5.02434C11.7081 4.94734 11.5821 4.94734 11.5051 5.02434L11.0127 5.50734C11.1107 5.59367 11.2017 5.68701 11.2857 5.78967ZM11.3884 8.48234C11.3067 8.59901 11.2227 8.69701 11.1411 8.78801L11.5027 9.14267C11.5797 9.21734 11.7057 9.21734 11.7827 9.14267C11.8597 9.06567 11.8597 8.94434 11.7827 8.86734L11.3884 8.48234ZM10.1891 9.84967L9.18107 9.84967C9.07607 9.84967 8.99207 9.93134 8.99207 10.0363C8.99207 10.139 9.07607 10.2207 9.18107 10.2207L10.1891 10.2207C10.2941 10.2207 10.3781 10.1367 10.3781 10.0363C10.3781 9.93134 10.2917 9.84967 10.1891 9.84967ZM12.4571 6.89101L11.7524 6.89101C11.7641 6.98201 11.7711 7.07301 11.7711 7.16634C11.7711 7.20367 11.7711 7.24101 11.7687 7.27834L12.4571 7.27834C12.5667 7.27834 12.6554 7.19201 12.6554 7.08467C12.6531 6.97734 12.5667 6.89101 12.4571 6.89101ZM11.4934 7.16634C11.4934 6.76501 11.3581 6.39401 11.1271 6.09534C10.9264 5.83401 10.6511 5.62867 10.3337 5.50967L10.3361 5.50034L10.2007 5.46067C10.0957 5.43034 9.98607 5.40934 9.8764 5.39767L9.86007 5.39534C9.8064 5.39067 9.7504 5.38601 9.68974 5.38601L9.6804 5.38601C9.62207 5.38601 9.56607 5.39067 9.51007 5.39534L9.49373 5.39767C9.38407 5.40934 9.2744 5.43034 9.1694 5.46067L9.03873 5.49801L9.04107 5.50734C8.7214 5.62867 8.44607 5.83401 8.24307 6.09534C8.0144 6.39401 7.87674 6.76501 7.87674 7.16634C7.87674 7.45567 7.92807 7.69134 8.0074 7.88734C8.1264 8.18134 8.30607 8.37967 8.45307 8.53134C8.5254 8.60601 8.59074 8.67134 8.63274 8.72501C8.67707 8.78101 8.69807 8.82301 8.70507 8.85567C8.73773 9.02134 8.74007 9.22901 8.74007 9.28034L8.74007 9.29667C8.74007 9.53467 8.93607 9.72601 9.17873 9.72601L9.5194 9.72601L9.5194 8.04601L9.0294 7.55834C8.96873 7.50001 8.96873 7.40201 9.0294 7.34367C9.09007 7.28534 9.18573 7.28534 9.24407 7.34367L9.67107 7.76834L10.0981 7.34367C10.1587 7.28534 10.2544 7.28534 10.3127 7.34367C10.3734 7.40201 10.3734 7.50001 10.3127 7.55834L9.82273 8.04601L9.82273 9.72367L10.1914 9.72367C10.4341 9.72367 10.6301 9.53001 10.6301 9.29434L10.6301 9.28034C10.6301 9.22901 10.6324 9.01901 10.6651 8.85567C10.6697 8.83234 10.6791 8.80667 10.7001 8.77401C10.7351 8.71801 10.8004 8.64801 10.8821 8.56634C11.0034 8.44034 11.1574 8.28167 11.2811 8.05767C11.4047 7.83601 11.4934 7.54434 11.4934 7.16634Z",fill:"url(#paint_linear_7)","fill-rule":"nonzero"})]),e("g",{class:"star-animate star-1"},[e("path",{id:"星形 13",d:"M2.52162 1.44908L3.9707 1.98535L2.52162 2.52162L1.98535 3.9707L1.44908 2.52162L2.22045e-16 1.98535L1.44908 1.44908L1.98535 0L2.52162 1.44908Z",fill:"url(#paint_linear_8)","fill-rule":"evenodd",transform:"matrix(0.930482,0.366337,-0.366337,0.930482,12.6309,0)"})]),e("g",{class:"star-animate star-2"},[e("path",{id:"星形 12",d:"M2.51914 1.44765L3.9668 1.9834L2.51914 2.51914L1.9834 3.9668L1.44765 2.51914L2.22045e-16 1.9834L1.44765 1.44765L1.9834 0L2.51914 1.44765Z",fill:"url(#paint_linear_9)","fill-rule":"evenodd",transform:"matrix(0.96896,-0.247217,0.247217,0.96896,0,8.04492)"})]),e("g",{class:"star-animate star-3"},[e("path",{id:"星形 11",d:"M1.27011 0.729885L2 1L1.27011 1.27011L1 2L0.729885 1.27011L1.11022e-16 1L0.729885 0.729885L1 0L1.27011 0.729885Z",fill:"url(#paint_linear_10)","fill-rule":"evenodd",transform:"matrix(0.891472,0.453075,-0.453075,0.891472,15.082,10)"})])])])])],-1)),e("div",H1,[t.msg.contentBlocks&&t.msg.contentBlocks.length>0?(i(!0),r(Z,{key:0},ie(t.msg.contentBlocks,(g,E)=>(i(),r(Z,{key:E},[g.type==="think"?(i(),r("div",{key:0,class:N(["think-section",{collapsed:g.collapsed}])},[e("div",{class:"think-title",onClick:D=>s(B1)(g)},[...v[10]||(v[10]=[Ye('<svg class="think-toggle-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-3a31ed57><polyline points="6 9 12 15 18 9" data-v-3a31ed57></polyline></svg><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-3a31ed57><circle cx="12" cy="12" r="10" data-v-3a31ed57></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" data-v-3a31ed57></path><line x1="12" y1="17" x2="12.01" y2="17" data-v-3a31ed57></line></svg> 思考过程 ',3)])],8,O1),_t(e("div",{class:"think-content"},B(g.content),513),[[bt,!g.collapsed]])],2)):g.type==="message"?(i(),r("div",{key:1,class:"message-content",innerHTML:s(Ut)(g.content)},null,8,W1)):g.type==="tool_call"?(i(),r("div",{key:2,class:N(["tool-call-card",{completed:g.tool==="TodoWrite"?s(et)(g):g.status==="completed",collapsed:g.collapsed,"todo-card":g.tool==="TodoWrite"}])},[e("div",{class:"tool-call-header",onClick:D=>s(I1)(g)},[v[16]||(v[16]=e("svg",{class:"tool-toggle-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"6 9 12 15 18 9"})],-1)),g.tool==="TodoWrite"?(i(),r(Z,{key:0},[g.status==="calling"?(i(),r("svg",Q1,[...v[11]||(v[11]=[e("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"},null,-1)])])):s(et)(g)?(i(),r("svg",G1,[...v[12]||(v[12]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(i(),r("svg",K1,[...v[13]||(v[13]=[Ye('<line x1="8" y1="6" x2="21" y2="6" data-v-3a31ed57></line><line x1="8" y1="12" x2="21" y2="12" data-v-3a31ed57></line><line x1="8" y1="18" x2="21" y2="18" data-v-3a31ed57></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-3a31ed57></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-3a31ed57></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-3a31ed57></line>',6)])]))],64)):(i(),r(Z,{key:1},[g.status==="calling"?(i(),r("svg",j1,[...v[14]||(v[14]=[e("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"},null,-1)])])):(i(),r("svg",J1,[...v[15]||(v[15]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])]))],64)),e("span",X1,[dt(B(g.tool==="TodoWrite"?"任务计划":g.tool)+" ",1),g.description?(i(),r("div",Y1,B(g.description),1)):I("",!0)]),g.tool==="TodoWrite"?(i(),r("span",{key:2,class:N(["tool-badge",{success:s(et)(g)}])},B(g.status==="calling"?"更新中":s(et)(g)?"已完成":"进行中"),3)):(i(),r("span",{key:3,class:N(["tool-badge",{success:g.status==="completed"}])},B(g.status==="calling"?"调用中":"完成"),3))],8,V1),_t(e("div",eo,[g.tool==="TodoWrite"&&g.todoItems&&g.todoItems.length>0?(i(),r("div",to,[(i(!0),r(Z,null,ie(g.todoItems,D=>(i(),r("div",{key:D.id,class:N(["todo-item","todo-"+D.status])},[e("span",oo,[D.status==="in_progress"?(i(),r("svg",so,[...v[17]||(v[17]=[e("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"},null,-1)])])):D.status==="completed"?(i(),r("svg",no,[...v[18]||(v[18]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):D.status==="cancelled"?(i(),r("svg",lo,[...v[19]||(v[19]=[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)])])):(i(),r("svg",io,[...v[20]||(v[20]=[e("circle",{cx:"12",cy:"12",r:"9"},null,-1)])]))]),e("span",ao,B(D.content||D.description),1)],2))),128))])):(i(),r(Z,{key:1},[e("div",ro,[v[21]||(v[21]=e("div",{class:"tool-args-label"},"参数:",-1)),e("code",null,B(s(Yt)(g.args)),1)]),g.result?(i(),r("div",uo,[v[22]||(v[22]=e("div",{class:"tool-result-label"},"结果:",-1)),dt(" "+B(s(e1)(g.result)),1)])):I("",!0)],64))],512),[[bt,!g.collapsed]])],2)):I("",!0)],64))),128)):(i(),r("div",{key:1,class:"message-content",innerHTML:s(Ut)(s(Dt)(t.msg))},null,8,co)),k.value?(i(),r("div",po,[e("button",{class:"continue-btn",onClick:v[1]||(v[1]=g=>y("continue"))},[...v[23]||(v[23]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"23 4 23 10 17 10"}),e("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})],-1),dt(" 继续 ",-1)])])])):I("",!0),t.msg.role==="assistant"&&t.msg.content?(i(),r("div",vo,[e("button",{class:"message-action-btn",title:"复制",disabled:n.isSending,onClick:x},[...v[24]||(v[24]=[e("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})],-1)])],8,go),t.isLastAssistant?(i(),r("button",{key:0,class:"message-action-btn",title:"重新生成",disabled:n.isSending,onClick:v[2]||(v[2]=g=>S.$emit("regenerate"))},[...v[25]||(v[25]=[e("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0118.8-4.3M22 12.5a10 10 0 01-18.8 4.2"})],-1)])],8,fo)):I("",!0),e("button",{class:"message-action-btn",title:"删除",onClick:v[3]||(v[3]=g=>S.$emit("delete"))},[...v[26]||(v[26]=[Ye('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-3a31ed57><polyline points="3 6 5 6 21 6" data-v-3a31ed57></polyline><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2" data-v-3a31ed57></path><line x1="10" y1="11" x2="10" y2="17" data-v-3a31ed57></line><line x1="14" y1="11" x2="14" y2="17" data-v-3a31ed57></line></svg>',1)])])])):I("",!0)])],64)):I("",!0),(i(),tt(Jt,{to:"body"},[ve(ze,{name:"preview-fade"},{default:Be(()=>[s(qt)?(i(),r("div",{key:0,class:"image-preview-overlay",onClick:v[6]||(v[6]=(...g)=>s(Lt)&&s(Lt)(...g))},[e("img",{src:s(Zt),alt:"预览图片",class:"image-preview-full",onClick:v[4]||(v[4]=Ze(()=>{},["stop"]))},null,8,ho),e("button",{class:"image-preview-close",onClick:v[5]||(v[5]=(...g)=>s(Lt)&&s(Lt)(...g))},[...v[28]||(v[28]=[e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):I("",!0)]),_:1})]))],2))}}),mo=Ue(Co,[["__scopeId","data-v-3a31ed57"]]),we=M(null),Mt=M(!1),xt=M(!1),$t=M(!0);let wt=null;function t1(){xt.value||($t.value=yo(),Mt.value=!0,wt&&clearTimeout(wt),wt=setTimeout(()=>{Mt.value=!1},500))}function yo(){if(!we.value)return!0;const{scrollTop:t,scrollHeight:a,clientHeight:n}=we.value;return a-t-n<150}function wo(){Mt.value||$t.value&&J(()=>{we.value&&(xt.value=!0,$t.value=!0,we.value.scrollTo({top:we.value.scrollHeight,behavior:"smooth"}),setTimeout(()=>{xt.value=!1},500))})}function xo(){Mt.value=!1,$t.value=!0,J(()=>{we.value&&(xt.value=!0,we.value.scrollTo({top:we.value.scrollHeight,behavior:"smooth"}),setTimeout(()=>{xt.value=!1},500))})}function So(t,a){for(let n=t.length-1;n>=0;n--)if(t[n].role==="assistant")return n===a;return!1}async function Lo(t){try{if(navigator.clipboard)await navigator.clipboard.writeText(t);else{const a=document.createElement("textarea");a.value=t,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)}Xe.request({status:!0,msg:"复制成功"})}catch(a){Xe.request({status:!1,msg:"复制失败"})}}function ko(t,a){const n=t[a];n&&n.contentBlocks&&n.contentBlocks.forEach(y=>{y.type==="think"&&(y.collapsed=!y.collapsed)})}function To(t){t.collapsed=!t.collapsed}function _o(t){t.collapsed=!t.collapsed}function bo(){we.value&&we.value.addEventListener("scroll",t1,{passive:!0})}function Mo(){we.value&&we.value.removeEventListener("scroll",t1),wt&&clearTimeout(wt)}const $o={key:0,class:"welcome-message"},Po={class:"suggestion-cards"},Ao=["onClick"],Bo={key:1,class:"message assistant"},Io={class:"message-body"},Uo=["onClick"],Do=["innerHTML"],Eo=["onClick"],Fo={class:"tool-name"},No={key:0,class:"tool-call-description"},Ro={class:"tool-call-details"},qo={key:0,class:"todo-list"},Zo={class:"todo-status-icon"},zo={key:0,class:"todo-icon-spin",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},Ho={key:1,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},Oo={key:2,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},Wo={key:3,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Vo={class:"todo-description"},Qo={class:"tool-call-args"},Go={key:0,class:"tool-result-content"},Ko={key:2,class:"typing-indicator"},jo=Ie({__name:"ChatMain",props:{messages:{},isTyping:{type:Boolean},streamingContentBlocks:{},streamingThinkCollapsed:{type:Boolean},suggestions:{},assistantName:{},isSending:{type:Boolean}},emits:["update:streamingThinkCollapsed","suggestionClick","regenerate","deleteMessage","continue"],setup(t,{expose:a,emit:n}){const y=t;function k(x){return So(y.messages,x)}function u(x){ko(y.messages,x)}return Ft(()=>bo()),Nt(()=>Mo()),a({scrollToBottom:wo,forceScrollToBottom:xo}),(x,_)=>(i(),r("div",{class:"chat-messages",ref_key:"chatMessagesRef",ref:we},[t.messages.length===0?(i(),r("div",$o,[_[1]||(_[1]=e("h2",null,"有什么我能帮你的吗?",-1)),e("div",Po,[(i(!0),r(Z,null,ie(t.suggestions,(S,v)=>(i(),r("div",{key:v,class:"suggestion-card-container"},[e("button",{class:"suggestion-card",onClick:g=>x.$emit("suggestionClick",S)},B(S.question),9,Ao)]))),128))])])):I("",!0),(i(!0),r(Z,null,ie(t.messages,(S,v)=>(i(),tt(mo,{key:v,msg:S,isSending:t.isSending,isLastAssistant:k(v),isLast:v===t.messages.length-1,assistantName:t.assistantName,onCopy:s(Lo),onRegenerate:g=>x.$emit("regenerate",v),onDelete:g=>x.$emit("deleteMessage",v),onToggleThink:g=>u(v),onContinue:_[0]||(_[0]=g=>x.$emit("continue"))},null,8,["msg","isSending","isLastAssistant","isLast","assistantName","onCopy","onRegenerate","onDelete","onToggleThink"]))),128)),t.streamingContentBlocks.length>0?(i(),r("div",Bo,[_[10]||(_[10]=e("div",{class:"message-avatar assistant-avatar"},[e("span",{class:"avatar-text"},[e("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 17 24",width:"36.000000",height:"49.000000",fill:"none",customFrame:"#000000"},[e("defs",null,[e("clipPath",{id:"clipPath_0"},[e("rect",{width:"13.000000",height:"13.000000",x:"3.175781",y:"12.000000",fill:"rgb(255,255,255)"})]),e("linearGradient",{id:"paint_linear_5",x1:"9.67578125",x2:"9.67578125",y1:"12.2714844",y2:"25",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(207,86,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(139,136,240)",offset:"1","stop-opacity":"1"})]),e("linearGradient",{id:"paint_linear_6",x1:"9.5",x2:"9.5",y1:"14",y2:"24",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(207,86,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(139,136,240)",offset:"1","stop-opacity":"1"})]),e("clipPath",{id:"clipPath_1"},[e("rect",{width:"7.000000",height:"7.000000",x:"6.175781",y:"4.000000",fill:"rgb(255,255,255)"})]),e("linearGradient",{id:"paint_linear_7",x1:"9.68390274",x2:"9.68390274",y1:"4.32434082",y2:"10.6896744",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(255,192,8)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(255,222,124)",offset:"1","stop-opacity":"1"})]),e("linearGradient",{id:"paint_linear_8",x1:"1.98535156",x2:"1.98535156",y1:"0",y2:"3.97070312",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(255,15,0)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(255,15,0)",offset:"1","stop-opacity":"0"})]),e("linearGradient",{id:"paint_linear_9",x1:"1.98339844",x2:"1.98339844",y1:"0",y2:"3.96679688",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(0,136,255)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(0,136,255)",offset:"1","stop-opacity":"0"})]),e("linearGradient",{id:"paint_linear_10",x1:"1",x2:"1",y1:"0",y2:"2",gradientUnits:"userSpaceOnUse"},[e("stop",{"stop-color":"rgb(0,255,129)",offset:"0","stop-opacity":"1"}),e("stop",{"stop-color":"rgb(0,255,129)",offset:"1","stop-opacity":"0"})])]),e("g",{id:"组合 286"},[e("g",{id:"svg 155",opacity:"0","clip-path":"url(#clipPath_0)",customFrame:"url(#clipPath_0)"},[e("rect",{id:"svg 155",width:"13.000000",height:"13.000000",x:"3.175781",y:"12.000000"}),e("path",{id:"合并",d:"M10.2174 13.6896C10.3837 13.5406 10.4883 13.3245 10.4883 13.084C10.4883 12.9289 10.4439 12.777 10.3603 12.6463C10.2767 12.5156 10.1575 12.4115 10.0166 12.3464C9.87581 12.2814 9.71929 12.258 9.56558 12.279C9.41188 12.3 9.26741 12.3646 9.14925 12.4652C9.0311 12.5657 8.94419 12.698 8.89882 12.8463C8.85344 12.9947 8.85148 13.1529 8.89318 13.3024C8.93487 13.4518 9.01848 13.5862 9.13411 13.6896L9.13411 14.709L6.42578 14.709C6.14053 14.709 5.86031 14.7841 5.61328 14.9267C5.36625 15.0693 5.16111 15.2745 5.01849 15.5215C4.87587 15.7685 4.80078 16.0488 4.80078 16.334L4.80078 21.7507C4.80078 22.0359 4.87587 22.3161 5.01849 22.5632C5.16111 22.8102 5.36625 23.0153 5.61328 23.158C5.86031 23.3006 6.14053 23.3757 6.42578 23.3757L12.9258 23.3757C13.211 23.3757 13.4912 23.3006 13.7383 23.158C13.9853 23.0153 14.1904 22.8102 14.3331 22.5632C14.4757 22.3161 14.5508 22.0359 14.5508 21.7507L14.5508 16.334C14.5508 16.0488 14.4757 15.7685 14.3331 15.5215C14.1904 15.2745 13.9853 15.0693 13.7383 14.9267C13.4912 14.7841 13.211 14.709 12.9258 14.709L10.2174 14.709L10.2174 13.6896ZM4.25911 17.4173L3.17578 17.4173L3.17578 20.6673L4.25911 20.6673L4.25911 17.4173ZM15.0924 17.4173L16.1758 17.4173L16.1758 20.6673L15.0924 20.6673L15.0924 17.4173ZM8.52836 19.6997C8.38954 19.8005 8.22236 19.8548 8.05078 19.8548C7.8792 19.8548 7.71202 19.8005 7.57321 19.6997C7.43439 19.5988 7.33107 19.4566 7.27805 19.2934C7.22503 19.1302 7.22503 18.9544 7.27805 18.7913C7.33107 18.6281 7.43439 18.4859 7.57321 18.385C7.71202 18.2842 7.8792 18.2298 8.05078 18.2298C8.22236 18.2298 8.38954 18.2842 8.52836 18.385C8.66717 18.4859 8.77049 18.6281 8.82351 18.7913C8.87654 18.9544 8.87654 19.1302 8.82351 19.2934C8.77049 19.4566 8.66717 19.5988 8.52836 19.6997ZM11.5519 18.2696C11.715 18.3226 11.8573 18.4259 11.9581 18.5648C12.059 18.7036 12.1133 18.8708 12.1133 19.0423C12.1133 19.2139 12.059 19.3811 11.9581 19.5199C11.8573 19.6587 11.715 19.762 11.5519 19.8151C11.3887 19.8681 11.2129 19.8681 11.0497 19.8151C10.8865 19.762 10.7443 19.6587 10.6435 19.5199C10.5426 19.3811 10.4883 19.2139 10.4883 19.0423C10.4883 18.8708 10.5426 18.7036 10.6435 18.5648C10.7443 18.4259 10.8865 18.3226 11.0497 18.2696C11.2129 18.2166 11.3887 18.2166 11.5519 18.2696ZM13.1758 24.5C13.1758 24.2239 12.9519 24 12.6758 24L6.67578 24C6.39964 24 6.17578 24.2239 6.17578 24.5C6.17578 24.7761 6.39964 25 6.67578 25L12.6758 25C12.9519 25 13.1758 24.7761 13.1758 24.5Z",fill:"url(#paint_linear_5)","fill-rule":"evenodd"})]),e("g",{id:"组合 302"},[e("path",{id:"合并",d:"M11.3235 14.9659C11.6203 14.7183 11.61 14.0359 11.858 14.0093C12.4372 13.9472 13.1075 14.188 12.5669 14.9628C12.386 15.2222 12.0044 15.5484 11.5768 15.8676C11.7643 15.8935 11.9503 15.9222 12.1341 15.9532C12.9111 15.3147 14.3915 14.1808 14.9377 14.3283C15.4628 14.4701 15.1245 15.7963 14.8697 16.5908C15.9414 16.9049 16.6428 17.1837 16.6428 17.1837C16.6428 17.1837 17 18.2593 15.214 18.6192C14.6008 18.7427 14.7913 18.9199 15.2188 19.3176C15.422 19.5067 15.6788 19.7456 15.9284 20.0523C16.683 20.9798 17 22.5628 17 22.5628L14.857 21.8466L15.5712 22.9217L14.4998 22.9213L14.8569 23.9986L14.1426 23.2806L13.5384 23.9984L12.7146 23.9975L6.29425 23.9974L6.28544 23.9989L5.46131 23.9971L4.85743 23.282L4.14314 24L4.50021 22.9227L3.4288 22.9231L4.14295 21.848L2 22.5642C2 22.5642 2.31699 20.9812 3.07164 20.0537C3.32118 19.747 3.57798 19.5081 3.78121 19.319C4.20873 18.9213 4.39916 18.7441 3.78601 18.6206C1.99995 18.2607 2.35723 17.1851 2.35723 17.1851C2.35723 17.1851 3.05857 16.9063 4.13026 16.5922C3.87555 15.7977 3.53719 14.4715 4.06231 14.3297C4.60851 14.1822 6.08893 15.3161 6.86593 15.9546C7.0497 15.9236 7.23569 15.8949 7.42319 15.869C6.99561 15.5498 6.61404 15.2236 6.43307 14.9642C5.89247 14.1894 6.56276 13.9487 7.14196 14.0107C7.38998 14.0373 7.3797 14.7197 7.6765 14.9673C7.89071 15.1461 7.89864 15.0288 7.9076 14.8963C7.91522 14.7836 7.92357 14.66 8.06005 14.698C8.35707 14.7807 8.51548 14.8066 8.51968 15.0414C8.5217 15.1545 8.48678 15.2615 8.45302 15.365C8.41677 15.4761 8.38186 15.583 8.39545 15.6892C8.39935 15.7196 8.40974 15.7426 8.42535 15.7609C8.74972 15.7364 9.07491 15.7225 9.39745 15.7218C9.78695 15.7156 10.1814 15.7297 10.5746 15.7595C10.5903 15.7412 10.6006 15.7182 10.6045 15.6878C10.6181 15.5816 10.5832 15.4747 10.547 15.3636C10.5132 15.2601 10.4783 15.1531 10.4803 15.04C10.4845 14.8052 10.6429 14.7793 10.9399 14.6966C11.0764 14.6586 11.0848 14.7822 11.0924 14.8949C11.1014 15.0274 11.1093 15.1447 11.3235 14.9659Z",fill:"url(#paint_linear_6)","fill-rule":"evenodd"}),e("ellipse",{id:"椭圆 85",rx:"0.576923",ry:"0.579347",cx:"7.19215727",cy:"21.531496",fill:"rgb(255,255,255)"}),e("ellipse",{id:"椭圆 86",rx:"0.576923",ry:"0.579347",cx:"11.8076363",cy:"21.531496",fill:"rgb(255,255,255)"}),e("path",{id:"椭圆 87",d:"M8.47187 21.8046C8.27093 21.6029 7.99841 21.4895 7.71425 21.4895C7.43009 21.4895 7.15757 21.6029 6.95664 21.8046C6.7557 22.0064 6.64282 22.2801 6.64282 22.5654L6.95076 22.5654C6.95076 22.3621 7.0312 22.1671 7.17438 22.0233C7.31757 21.8795 7.51176 21.7987 7.71425 21.7987C7.91674 21.7987 8.11094 21.8795 8.25412 22.0233C8.3973 22.1671 8.47774 22.3621 8.47774 22.5654L8.78568 22.5654C8.78568 22.2801 8.6728 22.0064 8.47187 21.8046Z",opacity:"0",fill:"rgb(255,255,255)","fill-rule":"evenodd"}),e("path",{id:"椭圆 88",d:"M12.0434 21.8046C11.8425 21.6029 11.5699 21.4895 11.2858 21.4895C11.0016 21.4895 10.7291 21.6029 10.5282 21.8046C10.3272 22.0064 10.2144 22.2801 10.2144 22.5654L10.5223 22.5654C10.5223 22.3621 10.6027 22.1671 10.7459 22.0233C10.8891 21.8795 11.0833 21.7987 11.2858 21.7987C11.4883 21.7987 11.6825 21.8795 11.8257 22.0233C11.9688 22.1671 12.0493 22.3621 12.0493 22.5654L12.3572 22.5654C12.3572 22.2801 12.2443 22.0064 12.0434 21.8046Z",opacity:"0",fill:"rgb(255,255,255)","fill-rule":"evenodd"}),e("path",{id:"矢量 2577",d:"M9.49975 22.1108L9.50002 22.8831L10.0769 23.2692M9.50002 22.8831L8.9231 23.2695",stroke:"rgb(255,255,255)","stroke-linecap":"round","stroke-width":"0.200000"})]),e("g",{id:"svg 154","clip-path":"url(#clipPath_1)",customFrame:"url(#clipPath_1)",class:"lightbulb-glow"},[e("rect",{id:"svg 154",width:"7.000000",height:"7.000000",x:"6.175781",y:"4.000000"}),e("path",{id:"矢量 2565",d:"M7.59674 7.16634C7.59674 7.07301 7.60374 6.97967 7.6154 6.89101L6.91074 6.89101C6.80107 6.89101 6.7124 6.97734 6.7124 7.08467C6.7124 7.19201 6.80107 7.27834 6.91074 7.27834L7.59907 7.27834C7.59674 7.24101 7.59674 7.20367 7.59674 7.16634ZM7.58274 8.86967C7.50574 8.94667 7.50574 9.06801 7.58274 9.14501C7.65974 9.21967 7.78574 9.21967 7.86274 9.14501L8.2244 8.79034C8.14274 8.69934 8.0564 8.59901 7.97707 8.48467L7.58274 8.86967ZM8.0844 5.78967C8.16607 5.68701 8.25707 5.59367 8.3574 5.50734L7.86507 5.02434C7.78807 4.94734 7.66207 4.94734 7.58507 5.02434C7.50807 5.09901 7.50807 5.22267 7.58507 5.29967L8.0844 5.78967ZM10.1891 10.3187L9.18107 10.3187C9.07607 10.3187 8.99207 10.4027 8.99207 10.503C8.99207 10.6057 9.07607 10.6897 9.18107 10.6897L10.1891 10.6897C10.2941 10.6897 10.3781 10.6057 10.3781 10.503C10.3781 10.4003 10.2917 10.3187 10.1891 10.3187ZM9.68507 5.16667L9.68974 5.16667C9.75507 5.16667 9.81807 5.17134 9.88107 5.17601L9.88107 4.51801C9.88107 4.41067 9.7924 4.32434 9.68274 4.32434C9.57307 4.32434 9.4844 4.41067 9.4844 4.51801L9.4844 5.17601C9.5474 5.16901 9.61274 5.16667 9.67574 5.16667L9.68507 5.16667ZM11.2857 5.78967L11.7851 5.29967C11.8621 5.22501 11.8621 5.10134 11.7851 5.02434C11.7081 4.94734 11.5821 4.94734 11.5051 5.02434L11.0127 5.50734C11.1107 5.59367 11.2017 5.68701 11.2857 5.78967ZM11.3884 8.48234C11.3067 8.59901 11.2227 8.69701 11.1411 8.78801L11.5027 9.14267C11.5797 9.21734 11.7057 9.21734 11.7827 9.14267C11.8597 9.06567 11.8597 8.94434 11.7827 8.86734L11.3884 8.48234ZM10.1891 9.84967L9.18107 9.84967C9.07607 9.84967 8.99207 9.93134 8.99207 10.0363C8.99207 10.139 9.07607 10.2207 9.18107 10.2207L10.1891 10.2207C10.2941 10.2207 10.3781 10.1367 10.3781 10.0363C10.3781 9.93134 10.2917 9.84967 10.1891 9.84967ZM12.4571 6.89101L11.7524 6.89101C11.7641 6.98201 11.7711 7.07301 11.7711 7.16634C11.7711 7.20367 11.7711 7.24101 11.7687 7.27834L12.4571 7.27834C12.5667 7.27834 12.6554 7.19201 12.6554 7.08467C12.6531 6.97734 12.5667 6.89101 12.4571 6.89101ZM11.4934 7.16634C11.4934 6.76501 11.3581 6.39401 11.1271 6.09534C10.9264 5.83401 10.6511 5.62867 10.3337 5.50967L10.3361 5.50034L10.2007 5.46067C10.0957 5.43034 9.98607 5.40934 9.8764 5.39767L9.86007 5.39534C9.8064 5.39067 9.7504 5.38601 9.68974 5.38601L9.6804 5.38601C9.62207 5.38601 9.56607 5.39067 9.51007 5.39534L9.49373 5.39767C9.38407 5.40934 9.2744 5.43034 9.1694 5.46067L9.03873 5.49801L9.04107 5.50734C8.7214 5.62867 8.44607 5.83401 8.24307 6.09534C8.0144 6.39401 7.87674 6.76501 7.87674 7.16634C7.87674 7.45567 7.92807 7.69134 8.0074 7.88734C8.1264 8.18134 8.30607 8.37967 8.45307 8.53134C8.5254 8.60601 8.59074 8.67134 8.63274 8.72501C8.67707 8.78101 8.69807 8.82301 8.70507 8.85567C8.73773 9.02134 8.74007 9.22901 8.74007 9.28034L8.74007 9.29667C8.74007 9.53467 8.93607 9.72601 9.17873 9.72601L9.5194 9.72601L9.5194 8.04601L9.0294 7.55834C8.96873 7.50001 8.96873 7.40201 9.0294 7.34367C9.09007 7.28534 9.18573 7.28534 9.24407 7.34367L9.67107 7.76834L10.0981 7.34367C10.1587 7.28534 10.2544 7.28534 10.3127 7.34367C10.3734 7.40201 10.3734 7.50001 10.3127 7.55834L9.82273 8.04601L9.82273 9.72367L10.1914 9.72367C10.4341 9.72367 10.6301 9.53001 10.6301 9.29434L10.6301 9.28034C10.6301 9.22901 10.6324 9.01901 10.6651 8.85567C10.6697 8.83234 10.6791 8.80667 10.7001 8.77401C10.7351 8.71801 10.8004 8.64801 10.8821 8.56634C11.0034 8.44034 11.1574 8.28167 11.2811 8.05767C11.4047 7.83601 11.4934 7.54434 11.4934 7.16634Z",fill:"url(#paint_linear_7)","fill-rule":"nonzero"})]),e("g",{class:"star-animate star-1"},[e("path",{id:"星形 13",d:"M2.52162 1.44908L3.9707 1.98535L2.52162 2.52162L1.98535 3.9707L1.44908 2.52162L2.22045e-16 1.98535L1.44908 1.44908L1.98535 0L2.52162 1.44908Z",fill:"url(#paint_linear_8)","fill-rule":"evenodd",transform:"matrix(0.930482,0.366337,-0.366337,0.930482,12.6309,0)"})]),e("g",{class:"star-animate star-2"},[e("path",{id:"星形 12",d:"M2.51914 1.44765L3.9668 1.9834L2.51914 2.51914L1.9834 3.9668L1.44765 2.51914L2.22045e-16 1.9834L1.44765 1.44765L1.9834 0L2.51914 1.44765Z",fill:"url(#paint_linear_9)","fill-rule":"evenodd",transform:"matrix(0.96896,-0.247217,0.247217,0.96896,0,8.04492)"})]),e("g",{class:"star-animate star-3"},[e("path",{id:"星形 11",d:"M1.27011 0.729885L2 1L1.27011 1.27011L1 2L0.729885 1.27011L1.11022e-16 1L0.729885 0.729885L1 0L1.27011 0.729885Z",fill:"url(#paint_linear_10)","fill-rule":"evenodd",transform:"matrix(0.891472,0.453075,-0.453075,0.891472,15.082,10)"})])])])])],-1)),e("div",Io,[(i(!0),r(Z,null,ie(t.streamingContentBlocks,(S,v)=>(i(),r(Z,{key:v},[S.type==="think"?(i(),r("div",{key:0,class:N(["think-section",{collapsed:S.collapsed}])},[e("div",{class:"think-title",onClick:g=>s(To)(S)},[..._[2]||(_[2]=[Ye('<svg class="think-toggle-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-4a4775cd><polyline points="6 9 12 15 18 9" data-v-4a4775cd></polyline></svg><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-4a4775cd><circle cx="12" cy="12" r="10" data-v-4a4775cd></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" data-v-4a4775cd></path><line x1="12" y1="17" x2="12.01" y2="17" data-v-4a4775cd></line></svg> 思考过程 ',3)])],8,Uo),_t(e("div",{class:"think-content"},B(S.content),513),[[bt,!S.collapsed]])],2)):S.type==="message"?(i(),r("div",{key:1,class:"message-content",innerHTML:S.renderedHtml||s(Ut)(S.content)},null,8,Do)):S.type==="tool_call"?(i(),r("div",{key:2,class:N(["tool-call-card",{completed:S.tool==="TodoWrite"?s(et)(S):S.status==="completed",collapsed:S.collapsed,"todo-card":S.tool==="TodoWrite"}])},[e("div",{class:"tool-call-header",onClick:g=>s(_o)(S)},[_[3]||(_[3]=e("svg",{class:"tool-toggle-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("polyline",{points:"6 9 12 15 18 9"})],-1)),e("span",Fo,[dt(B(S.tool==="TodoWrite"?"任务计划":S.tool)+" ",1),S.description?(i(),r("div",No,B(S.description),1)):I("",!0)]),S.tool==="TodoWrite"?(i(),r("span",{key:0,class:N(["tool-badge",{success:s(et)(S)}])},B(S.status==="calling"?"更新中":s(et)(S)?"已完成":"进行中"),3)):(i(),r("span",{key:1,class:N(["tool-badge",{success:S.status==="completed"}])},B(S.status==="calling"?"调用中":"完成"),3))],8,Eo),_t(e("div",Ro,[S.tool==="TodoWrite"&&S.todoItems&&S.todoItems.length>0?(i(),r("div",qo,[(i(!0),r(Z,null,ie(S.todoItems,g=>(i(),r("div",{key:g.id,class:N(["todo-item","todo-"+g.status])},[e("span",Zo,[g.status==="in_progress"?(i(),r("svg",zo,[..._[4]||(_[4]=[e("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"},null,-1)])])):g.status==="completed"?(i(),r("svg",Ho,[..._[5]||(_[5]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):g.status==="cancelled"?(i(),r("svg",Oo,[..._[6]||(_[6]=[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)])])):(i(),r("svg",Wo,[..._[7]||(_[7]=[e("circle",{cx:"12",cy:"12",r:"9"},null,-1)])]))]),e("span",Vo,B(g.content||g.description),1)],2))),128))])):(i(),r(Z,{key:1},[e("div",Qo,[_[8]||(_[8]=e("div",{class:"tool-args-label"},"参数:",-1)),e("code",null,B(s(Yt)(S.args)),1)]),S.result?(i(),r("div",Go,[_[9]||(_[9]=e("div",{class:"tool-result-label"},"结果:",-1)),dt(" "+B(s(e1)(S.result)),1)])):I("",!0)],64))],512),[[bt,!S.collapsed]])],2)):I("",!0)],64))),128))])])):I("",!0),t.isTyping?(i(),r("div",Ko,[..._[11]||(_[11]=[e("div",{class:"typing-dots"},[e("div",{class:"typing-dot"}),e("div",{class:"typing-dot"}),e("div",{class:"typing-dot"})],-1)])])):I("",!0)],512))}}),Jo=Ue(jo,[["__scopeId","data-v-4a4775cd"]]),Xo={class:"popover-header"},Yo={class:"tool-search-bar"},es=["value"],ts={class:"popover-content"},os={key:0,class:"popover-loading"},ss={key:1,class:"tool-search-empty"},ns={key:2,class:"tool-list"},ls=["onClick"],is=["onClick"],as={class:"tool-info"},rs={class:"tool-name"},ds={key:0,class:"risk-badge"},us=Ie({__name:"ToolSelectPopover",props:{showToolPopover:{type:Boolean},toolPopoverPosition:{},toolsLoading:{type:Boolean},toolSearchQuery:{},groupedTools:{},isToolSelected:{type:Function},isCategoryAllSelected:{type:Function},isCategoryPartialSelected:{type:Function}},emits:["update:showToolPopover","update:toolSearchQuery","toggleToolSelection","toggleCategorySelection"],setup(t,{emit:a}){const n=a;function y(k){const u=k.target;n("update:toolSearchQuery",u.value)}return(k,u)=>(i(),tt(ze,{name:"popover-fade"},{default:Be(()=>[t.showToolPopover?(i(),r("div",{key:0,class:"custom-popover",style:ke(t.toolPopoverPosition)},[e("div",Xo,[u[3]||(u[3]=e("span",{class:"popover-title"},"选择工具",-1)),e("button",{class:"popover-close",onClick:u[0]||(u[0]=x=>n("update:showToolPopover",!1))},[...u[2]||(u[2]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",Yo,[u[5]||(u[5]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",class:"tool-search-icon"},[e("circle",{cx:"11",cy:"11",r:"8"}),e("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})],-1)),e("input",{class:"tool-search-input",value:t.toolSearchQuery,onInput:y,placeholder:"搜索工具名称...",type:"text"},null,40,es),t.toolSearchQuery?(i(),r("button",{key:0,class:"tool-search-clear",onClick:u[1]||(u[1]=Ze(x=>n("update:toolSearchQuery",""),["stop"]))},[...u[4]||(u[4]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):I("",!0)]),e("div",ts,[t.toolsLoading?(i(),r("div",os,[...u[6]||(u[6]=[e("div",{class:"loading-spinner"},null,-1),e("span",null,"加载中...",-1)])])):Object.keys(t.groupedTools).length===0?(i(),r("div",ss," 未找到匹配的工具 ")):(i(),r("div",ns,[(i(!0),r(Z,null,ie(t.groupedTools,(x,_)=>(i(),r(Z,{key:_},[e("div",{class:"tool-category",onClick:S=>n("toggleCategorySelection",x)},[e("span",null,B(_),1),e("div",{class:N(["category-switch",{active:t.isCategoryAllSelected(x),partial:t.isCategoryPartialSelected(x)}])},[...u[7]||(u[7]=[e("div",{class:"category-switch-slider"},null,-1)])],2)],8,ls),(i(!0),r(Z,null,ie(x,S=>(i(),r("div",{key:S.id,class:"tool-item",onClick:v=>n("toggleToolSelection",S)},[e("div",as,[e("span",rs,B(S.name),1),S.risk_level&&S.risk_level!=="low"?(i(),r("span",ds," 风险 ")):I("",!0)]),e("div",{class:N(["tool-switch",{active:t.isToolSelected(S.id)}])},[...u[8]||(u[8]=[e("div",{class:"tool-switch-slider"},null,-1)])],2)],8,is))),128))],64))),128))]))])],4)):I("",!0)]),_:1}))}}),cs=Ue(us,[["__scopeId","data-v-5c2c8682"]]),ps={class:"popover-header"},vs={class:"popover-content"},gs=Ie({__name:"UploadPopover",props:{showUploadPopover:{type:Boolean},uploadPopoverPosition:{}},emits:["update:showUploadPopover","selectLocalFile","selectLocalDir","selectServerFile"],setup(t,{emit:a}){const n=a;return(y,k)=>(i(),tt(ze,{name:"popover-fade"},{default:Be(()=>[t.showUploadPopover?(i(),r("div",{key:0,class:"custom-popover upload-popover",style:ke(t.uploadPopoverPosition)},[e("div",ps,[k[5]||(k[5]=e("span",{class:"popover-title"},"上传文件",-1)),e("button",{class:"popover-close",onClick:k[0]||(k[0]=u=>n("update:showUploadPopover",!1))},[...k[4]||(k[4]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",vs,[e("div",{class:"upload-option",onClick:k[1]||(k[1]=u=>n("selectLocalFile"))},[...k[6]||(k[6]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),e("polyline",{points:"17 8 12 3 7 8"}),e("line",{x1:"12",y1:"3",x2:"12",y2:"15"})],-1),e("span",null,"本地文件上传",-1)])]),e("div",{class:"upload-option",onClick:k[2]||(k[2]=u=>n("selectLocalDir"))},[...k[7]||(k[7]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})],-1),e("span",null,"本地目录上传",-1)])]),e("div",{class:"upload-option",onClick:k[3]||(k[3]=u=>n("selectServerFile"))},[...k[8]||(k[8]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2.18",ry:"2.18"}),e("line",{x1:"7",y1:"2",x2:"7",y2:"22"}),e("line",{x1:"17",y1:"2",x2:"17",y2:"22"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("line",{x1:"2",y1:"7",x2:"7",y2:"7"}),e("line",{x1:"2",y1:"17",x2:"7",y2:"17"}),e("line",{x1:"17",y1:"17",x2:"22",y2:"17"}),e("line",{x1:"17",y1:"7",x2:"22",y2:"7"})],-1),e("span",null,"从服务器选择",-1)])])])],4)):I("",!0)]),_:1}))}}),fs=Ue(gs,[["__scopeId","data-v-0d592f1b"]]),hs=Ie({__name:"AtPopover",props:{showAtPopover:{type:Boolean},atPopoverPosition:{},atSelectedIndex:{}},emits:["update:atSelectedIndex","selectServerFile","selectSite"],setup(t,{emit:a}){const n=a;function y(){n("update:atSelectedIndex",0),n("selectServerFile")}function k(){n("update:atSelectedIndex",1),n("selectSite")}return(u,x)=>(i(),tt(ze,{name:"popover-fade"},{default:Be(()=>[t.showAtPopover?(i(),r("div",{key:0,class:"at-mention-popover",style:ke(t.atPopoverPosition)},[e("div",{class:N(["at-mention-option",{active:t.atSelectedIndex===0}]),onClick:y,onMouseenter:x[0]||(x[0]=_=>n("update:atSelectedIndex",0))},[...x[2]||(x[2]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2.18",ry:"2.18"}),e("line",{x1:"7",y1:"2",x2:"7",y2:"22"}),e("line",{x1:"17",y1:"2",x2:"17",y2:"22"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("line",{x1:"2",y1:"7",x2:"7",y2:"7"}),e("line",{x1:"2",y1:"17",x2:"7",y2:"17"}),e("line",{x1:"17",y1:"17",x2:"22",y2:"17"}),e("line",{x1:"17",y1:"7",x2:"22",y2:"7"})],-1),e("span",null,"从服务器选择文件",-1),e("span",{class:"at-mention-hint"},"按 Enter 选择",-1)])],34),e("div",{class:N(["at-mention-option",{active:t.atSelectedIndex===1}]),onClick:k,onMouseenter:x[1]||(x[1]=_=>n("update:atSelectedIndex",1))},[...x[3]||(x[3]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})],-1),e("span",null,"选择网站",-1),e("span",{class:"at-mention-hint"},"按 Enter 选择",-1)])],34)],4)):I("",!0)]),_:1}))}}),Cs=Ue(hs,[["__scopeId","data-v-590232cb"]]),ms={key:0,class:"site-search-loading"},ys={key:1,class:"site-search-empty"},ws=["onClick","onMouseenter"],xs={class:"site-name"},Ss={class:"site-type-badge"},Ls=Ie({__name:"SiteSearchPopover",props:{showSiteSearchPopover:{type:Boolean},atPopoverPosition:{},siteSearchLoading:{type:Boolean},siteSearchResults:{},siteSelectedIndex:{}},emits:["update:siteSelectedIndex","selectSite"],setup(t,{emit:a}){const n=a;function y(k){n("update:siteSelectedIndex",k),n("selectSite")}return(k,u)=>(i(),tt(ze,{name:"popover-fade"},{default:Be(()=>[t.showSiteSearchPopover?(i(),r("div",{key:0,class:"at-mention-popover site-search-popover",style:ke(t.atPopoverPosition)},[u[2]||(u[2]=e("div",{class:"site-search-tip"},"输入自动搜索域名",-1)),t.siteSearchLoading?(i(),r("div",ms,[...u[0]||(u[0]=[e("span",null,"搜索中...",-1)])])):t.siteSearchResults.length===0?(i(),r("div",ys,[...u[1]||(u[1]=[e("span",null,"无匹配网站",-1)])])):(i(!0),r(Z,{key:2},ie(t.siteSearchResults,(x,_)=>(i(),r("div",{key:x.name,class:N(["site-search-item",{active:_===t.siteSelectedIndex}]),onClick:S=>y(_),onMouseenter:S=>n("update:siteSelectedIndex",_)},[e("span",{class:N(["site-status-dot",{online:x.status==="1"}])},null,2),e("span",xs,B(x.name),1),e("span",Ss,B(x.project_type),1)],42,ws))),128))],4)):I("",!0)]),_:1}))}}),ks=Ue(Ls,[["__scopeId","data-v-ac53de71"]]),Gt=5,Ts=5*1024*1024,_s=10*1024*1024;function bs(t,a){const n=M(null),y=M(null),k=M(null),u=M(null),x=M(null),_=M(null),S=M(""),v=M(!1),g=M(""),E=M({top:"0px",left:"0px"}),D=M([]),R=M([]),b=M([]),z=M([]),ae=M(!1),ue=M(!1),re=M(""),Q=M({bottom:"0px",left:"0px"}),ne=M({bottom:"0px",left:"0px"}),le=M({bottom:"0px",left:"0px"}),W=M(!1),he=M({bottom:"0px",left:"0px",width:"0px"}),X=M(null),V=M(null),oe=M(0),H=M(null),G=M(!1),Y=M([]),ge=M(!1),ee=M(0);let ce=null;kt(()=>t.inputMessage,o=>{n.value&&n.value.textContent!==o&&(n.value.textContent=o)}),kt(()=>t.showModelPopover,o=>{o&&J(()=>{ne.value=Ne(y.value)})}),kt(()=>t.showToolPopover,o=>{if(o){J(()=>{le.value=Ne(k.value)});return}S.value=""});const K=Ae(()=>t.selectedTools.slice(0,Gt)),A=Ae(()=>t.selectedTools.slice(Gt)),U=Ae(()=>{const o=S.value.trim().toLowerCase(),d=t.toolsList.filter(C=>C.show),L=o?d.filter(C=>C.name.toLowerCase().includes(o)):d,f={};return L.forEach(C=>{const w=C.category||"其他";f[w]||(f[w]=[]),f[w].push(C)}),f});function te(o){S.value=o}function xe(o){oe.value=o}function Te(o){ee.value=o}function Ce(){n.value&&(n.value.style.height="auto",n.value.style.height="".concat(Math.min(n.value.scrollHeight,120),"px"),W.value&&ye())}function _e(o){const d=o.target,L=d.innerHTML.replace(/\s|&nbsp;/g,"");(L==="<br>"||L==="<div><br></div>"||L==="<p><br></p>")&&(d.innerText=""),a("update:inputMessage",d.textContent||""),J(()=>{Ce()}),me(),be()}function me(){if(!n.value)return;const o=window.getSelection();if(!o||o.rangeCount===0){W.value=!1;return}const d=o.getRangeAt(0),L=d.startContainer;if(L.nodeType!==Node.TEXT_NODE){W.value=!1;return}const f=L.textContent||"",C=d.startOffset;if(C>0&&f[C-1]==="@"){if(G.value){W.value=!1;return}X.value=C-1,V.value=L,oe.value=0,G.value=!1,W.value=!0,ye();return}W.value=!1,G.value||(X.value=null,V.value=null)}function be(){if(!n.value||!G.value)return;const o=window.getSelection();if(!o||o.rangeCount===0){G.value=!1;return}const d=o.getRangeAt(0),L=d.startContainer;if(L.nodeType!==Node.TEXT_NODE){G.value=!1;return}const f=L.textContent||"",C=d.startOffset,w="@site:",h=f.indexOf(w);if(h!==-1&&C>h){const $=f.substring(h+w.length);O($);return}G.value=!1}function ye(){const o=document.querySelector(".chat-main"),d=o==null?void 0:o.getBoundingClientRect();if(!d)return;const L=document.querySelector(".chat-input-wrapper"),f=L==null?void 0:L.getBoundingClientRect();if(!f)return;const C=45;he.value={bottom:"".concat(f.bottom-f.top+C,"px"),left:"".concat(f.left-d.left,"px"),width:"".concat(f.width,"px")}}function De(){const o=document.getElementById("tool-tooltip"),d=localStorage.getItem("showToolTooltip");o&&!d&&(o.classList.add("show"),localStorage.setItem("showToolTooltip","true"),setTimeout(()=>{o.classList.remove("show")},3e3))}function Re(){var L;const o=window.getSelection();if(!o||o.rangeCount===0)return;const d=o.getRangeAt(0);(L=n.value)!=null&&L.contains(d.commonAncestorContainer)&&(H.value=d.cloneRange())}function Me(o){if(!o.isComposing){if(W.value){if(o.key==="ArrowUp"){o.preventDefault(),oe.value=oe.value===0?1:0;return}if(o.key==="ArrowDown"){o.preventDefault(),oe.value=oe.value===1?0:1;return}if(o.key==="Enter"&&!o.shiftKey){o.preventDefault(),oe.value===0?Ee():qe();return}if(o.key==="Escape"){W.value=!1,X.value=null,V.value=null;return}}if(G.value){if(o.key==="Enter"&&!o.shiftKey){o.preventDefault(),We();return}if(o.key==="ArrowUp"){o.preventDefault(),ee.value=ee.value>0?ee.value-1:Y.value.length-1;return}if(o.key==="ArrowDown"){o.preventDefault(),ee.value=ee.value<Y.value.length-1?ee.value+1:0;return}if(o.key==="Escape"){G.value=!1;return}}o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),a("sendMessage")),o.key==="Backspace"&&Oe()}}function Oe(){n.value&&J(()=>{var L;const o=((L=n.value)==null?void 0:L.querySelectorAll(".file-tag"))||[],d=new Set;o.forEach(f=>{const C=f.dataset.id;C&&d.add(C)}),R.value=R.value.filter(f=>d.has(f.id))})}function Ee(){W.value=!1,Ot({type:"all",path:"/",change:o=>{q(o)}},{customClass:"top-index"})}function q(o){if(!n.value)return;const d=o.split("/").pop()||o,L=Date.now().toString(),f=document.createElement("span");if(f.className="file-tag truncate",f.contentEditable="false",f.dataset.id=L,f.dataset.path=o,f.textContent="@".concat(d),V.value&&X.value!==null){const C=V.value,w=C.textContent||"",h=X.value;if(w[h]==="@"){const $=w.substring(0,h),P=w.substring(h+1);C.textContent=$+P;const F=document.createRange();F.setStart(C,h),F.setEnd(C,h),F.insertNode(f);const j=document.createTextNode(" ");F.setStartAfter(f),F.insertNode(j),F.setStartAfter(j),F.collapse(!0);const Pe=window.getSelection();Pe&&(Pe.removeAllRanges(),Pe.addRange(F))}else{p(o);return}}else{p(o);return}R.value.push({id:L,path:o,name:d}),X.value=null,V.value=null,a("update:inputMessage",n.value.textContent||""),J(()=>Ce())}function qe(){var f;if(W.value=!1,!V.value||X.value===null)return;const o=V.value,d=o.textContent||"",L=X.value;if(d[L]==="@"){const C=d.substring(0,L),w=d.substring(L+1);o.textContent="".concat(C,"@site:").concat(w);const h=window.getSelection();if(h){const $=document.createRange(),P=L+6;$.setStart(o,Math.min(P,o.textContent.length)),$.collapse(!0),h.removeAllRanges(),h.addRange($)}}G.value=!0,ee.value=0,ye(),O(""),a("update:inputMessage",((f=n.value)==null?void 0:f.textContent)||"")}function O(o){ce&&clearTimeout(ce),ce=setTimeout(()=>{ot(o)},300)}async function ot(o){ge.value=!0;try{const{data:d}=await g1({name:o,limit:5});d.status?(Y.value=d.data||[],ee.value=0):Y.value=[]}catch(d){Y.value=[]}finally{ge.value=!1}}function We(){if(Y.value.length===0)return;const o=Y.value[ee.value];o&&(G.value=!1,ce&&(clearTimeout(ce),ce=null),st(o.name))}function st(o){if(!n.value)return;const d=Date.now().toString(),L="@site:".concat(o),f=document.createElement("span");if(f.className="site-tag truncate",f.contentEditable="false",f.dataset.id=d,f.dataset.name=o,f.textContent=L,V.value&&X.value!==null){const C=V.value,w=C.textContent||"",h=X.value;let $=h+1;for(w.substring(h,h+6)==="@site:"&&($=h+6);$<w.length&&w[$]!==" "&&w[$]!==" ";)$++;const P=w.substring(0,h),F=w.substring($);C.textContent=P+F;const j=document.createRange();j.setStart(C,h),j.collapse(!0),j.insertNode(f);const Pe=document.createTextNode(" ");j.setStartAfter(f),j.insertNode(Pe),j.setStartAfter(Pe),j.collapse(!0);const Je=window.getSelection();Je&&(Je.removeAllRanges(),Je.addRange(j))}else{n.value.focus();const C=window.getSelection();if(C&&C.rangeCount>0){const w=C.getRangeAt(0);if(n.value.contains(w.commonAncestorContainer)){w.deleteContents(),w.insertNode(f);const h=document.createTextNode(" ");w.setStartAfter(f),w.insertNode(h),w.setStartAfter(h),w.collapse(!0),C.removeAllRanges(),C.addRange(w)}else{n.value.appendChild(f);const h=document.createTextNode(" ");n.value.appendChild(h),l()}}else{n.value.appendChild(f);const w=document.createTextNode(" ");n.value.appendChild(w),l()}}b.value.push({id:d,name:o}),X.value=null,V.value=null,a("update:inputMessage",n.value.textContent||""),J(()=>Ce())}function nt(o){var L;const d=(L=o.clipboardData)==null?void 0:L.items;if(d)for(const f of d){if(!f.type.startsWith("image/"))continue;o.preventDefault();const C=f.getAsFile();C&&Ge(C);break}}function ut(o){var d;(d=o.dataTransfer)!=null&&d.types.includes("Files")&&(ae.value=!0)}function Ve(o){const d=o.currentTarget;d&&!d.contains(o.relatedTarget)&&(ae.value=!1)}async function ct(o){var C,w;ae.value=!1;const d=(C=o.dataTransfer)==null?void 0:C.items;if(!d)return;const L=[],f=[];for(const h of Array.from(d)){if(h.kind!=="file")continue;const $=(w=h.webkitGetAsEntry)==null?void 0:w.call(h);if($){if($.isDirectory){const P=await Qe($);P.files.length>0&&f.push(P)}else if($.isFile){const P=h.getAsFile();P&&L.push(P)}}else{const P=h.getAsFile();P&&L.push(P)}}for(const h of L)h.type.startsWith("image/")?Ge(h):Ke(h);for(const h of f)h.files.length>0&&lt(h.files,h.name)}function Qe(o){return new Promise(d=>{const L=[],f=o.name,C=w=>{w.readEntries(async h=>{if(h.length===0){d({files:L,name:f});return}for(const $ of h)if($.isFile){const P=$,F=await new Promise(j=>{P.file(j)});L.push(F)}else if($.isDirectory){const P=await Qe($);L.push(...P.files)}C(w)})};C(o.createReader())})}function Ge(o){if(o.size>Ts){Xe.error("图片大小不能超过 5MB,当前文件大小: ".concat((o.size/1024/1024).toFixed(2),"MB"));return}const d=new FileReader;d.onload=L=>{var C;const f=(C=L.target)==null?void 0:C.result;f&&D.value.push(f)},d.readAsDataURL(o)}function Ke(o){if(o.size>_s){Xe.error("文件大小不能超过 10MB,当前文件大小: ".concat((o.size/1024/1024).toFixed(2),"MB"));return}const d=Date.now().toString(),L=Bt(o.name);z.value.push({id:d,name:L,size:o.size,uploaded:0,status:"uploading"});const f="/www/server/panel/plugin/bt_agent/upload",C=w=>{const h=Math.min(o.size,w+2097152),$=new FormData;$.append("f_path",f),$.append("f_name",L),$.append("f_size",o.size.toString()),$.append("f_start",w.toString()),$.append("blob",o.slice(w,h)),fetch("/files?action=upload",{method:"POST",body:$}).then(P=>P.json()).then(P=>{if(typeof P=="number"){const j=z.value.find(Pe=>Pe.id===d);j&&(j.uploaded=P),C(P);return}if(P.status){const j=z.value.find(Je=>Je.id===d);j&&(j.status="success",j.uploaded=o.size);const Pe="".concat(f,"/").concat(L);p(Pe),setTimeout(()=>{z.value=z.value.filter(Je=>Je.id!==d)},500);return}const F=z.value.find(j=>j.id===d);F&&(F.status="error"),Xe.error("文件上传失败:".concat(P.msg||"未知错误"))}).catch(()=>{const P=z.value.find(F=>F.id===d);P&&(P.status="error"),Xe.error("文件上传出现问题!")})};C(0)}async function lt(o,d){const L=Date.now().toString(),C="".concat("/www/server/panel/plugin/bt_agent/upload","/").concat(Bt(d)),w={id:L,name:"".concat(d,"/ (").concat(o.length," 个文件)"),size:o.reduce((P,F)=>P+F.size,0),uploaded:0,status:"uploading"};z.value.push(w);let h=0;const $=[];for(const P of o)try{const F=await pt(P,C);$.push(F),h+=P.size,w.uploaded=h}catch(F){}w.status="success",w.uploaded=w.size,se(C,d,$),setTimeout(()=>{z.value=z.value.filter(P=>P.id!==L)},500)}function pt(o,d){return new Promise((L,f)=>{const C=Bt(o.name),w=h=>{const $=Math.min(o.size,h+2097152),P=new FormData;P.append("f_path",d),P.append("f_name",C),P.append("f_size",o.size.toString()),P.append("f_start",h.toString()),P.append("blob",o.slice(h,$)),fetch("/files?action=upload",{method:"POST",body:P}).then(F=>F.json()).then(F=>{if(typeof F=="number"){w(F);return}F.status?L("".concat(d,"/").concat(C)):f(new Error(F.msg||"上传失败"))}).catch(F=>{f(F)})};w(0)})}function vt(o){D.value.splice(o,1)}function it(){D.value=[]}function gt(o){re.value=o,ue.value=!0}function ft(){ue.value=!1,re.value=""}function ht(){return[...D.value]}function Ct(o){o.stopPropagation(),a("update:showToolPopover",!1),a("update:showModelPopover",!1);const d=!t.showUploadPopover;a("update:showUploadPopover",d),d&&J(()=>{Q.value=Ne(u.value)})}function c(){var o;a("update:showUploadPopover",!1),(o=x.value)==null||o.click()}function T(){var o;a("update:showUploadPopover",!1),(o=_.value)==null||o.click()}function m(){a("update:showUploadPopover",!1),Ot({type:"all",path:"/",change:o=>{q(o)}},{customClass:"top-index"})}function l(){if(!n.value)return;const o=window.getSelection();if(!o)return;const d=document.createRange();d.selectNodeContents(n.value),d.collapse(!1),o.removeAllRanges(),o.addRange(d)}function p(o){if(!n.value)return;const d=o.split("/").pop()||o,L=Date.now().toString(),f=document.createElement("span");if(f.className="file-tag truncate",f.contentEditable="false",f.dataset.id=L,f.dataset.path=o,f.textContent="@".concat(d),n.value.focus(),H.value&&n.value.contains(H.value.commonAncestorContainer)){const w=window.getSelection();w&&(w.removeAllRanges(),w.addRange(H.value)),H.value=null}const C=window.getSelection();if(C)if(C.rangeCount>0){const w=C.getRangeAt(0);if(n.value.contains(w.commonAncestorContainer)){w.deleteContents(),w.insertNode(f);const h=document.createTextNode(" ");w.setStartAfter(f),w.insertNode(h),w.setStartAfter(h),w.collapse(!0),C.removeAllRanges(),C.addRange(w)}else{n.value.appendChild(f);const h=document.createTextNode(" ");n.value.appendChild(h),l()}}else{n.value.appendChild(f);const w=document.createTextNode(" ");n.value.appendChild(w),l()}else{n.value.appendChild(f);const w=document.createTextNode(" ");n.value.appendChild(w),l()}R.value.push({id:L,path:o,name:d}),a("update:inputMessage",n.value.textContent||""),J(()=>Ce())}function se(o,d,L){if(!n.value)return;const f=Date.now().toString(),C=document.createElement("span");if(C.className="file-tag dir-tag truncate",C.contentEditable="false",C.dataset.id=f,C.dataset.path=o,C.dataset.files=JSON.stringify(L),C.dataset.isDir="true",C.textContent="@".concat(d,"/"),n.value.focus(),H.value&&n.value.contains(H.value.commonAncestorContainer)){const h=window.getSelection();h&&(h.removeAllRanges(),h.addRange(H.value)),H.value=null}const w=window.getSelection();if(w)if(w.rangeCount>0){const h=w.getRangeAt(0);if(n.value.contains(h.commonAncestorContainer)){h.deleteContents(),h.insertNode(C);const $=document.createTextNode(" ");h.setStartAfter(C),h.insertNode($),h.setStartAfter($),h.collapse(!0),w.removeAllRanges(),w.addRange(h)}else{n.value.appendChild(C);const $=document.createTextNode(" ");n.value.appendChild($),l()}}else{n.value.appendChild(C);const h=document.createTextNode(" ");n.value.appendChild(h),l()}else{n.value.appendChild(C);const h=document.createTextNode(" ");n.value.appendChild(h),l()}R.value.push({id:f,path:o,name:"".concat(d,"/"),isDir:!0,files:L}),a("update:inputMessage",n.value.textContent||""),J(()=>Ce())}function Se(o){const d=o.target,L=d.files;if(L){for(const f of Array.from(L))f.type.startsWith("image/")?Ge(f):Ke(f);d.value=""}}function at(o){const d=o.target,L=d.files;if(!L||L.length===0)return;const w=L[0].webkitRelativePath.split("/")[0],h=Array.from(L).filter($=>!$.type.startsWith("image/"));if(h.length===0){Xe.error("目录中没有可上传的文件(图片文件不支持目录上传)"),d.value="";return}lt(h,w),d.value=""}function Le(o){o.stopPropagation(),a("update:showToolPopover",!1),a("update:showUploadPopover",!1);const d=!t.showModelPopover;a("update:showModelPopover",d),d&&J(()=>{ne.value=Ne(y.value)})}function je(o){o.stopPropagation(),a("update:showUploadPopover",!1);const d=!t.showToolPopover;a("update:showToolPopover",d),d&&J(()=>{le.value=Ne(k.value)})}function $e(o){return t.selectedTools.some(d=>d.id===o)}function pe(o){return o.length>0&&o.every(d=>$e(d.id))}function fe(o){const d=o.filter(L=>$e(L.id)).length;return d>0&&d<o.length}function Fe(o){const d=pe(o),L=o.filter(f=>{const C=$e(f.id);return d?C:!C});a("batchToggleTools",L,!d)}function Ne(o){if(!o)return{bottom:"0px",left:"0px"};const d=o.getBoundingClientRect(),L=8,f=350,C=window.innerHeight-d.top+L,{left:w}=d;let h=w;return h+f>window.innerWidth-8&&(h=window.innerWidth-f-8),h<8&&(h=8),{bottom:"".concat(C,"px"),left:"".concat(h,"px")}}function mt(o){return o?o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/\\n/g,"<br>").replace(/\n/g,"<br>"):""}function St(){var o;return((o=n.value)==null?void 0:o.innerText)||""}function s1(){return[...R.value]}function n1(){return[...b.value]}function l1(){n.value&&(n.value.innerHTML=""),D.value=[],R.value=[],b.value=[]}function i1(){var o;(o=n.value)==null||o.focus()}return{editorRef:n,modelBtnRef:y,toolBtnRef:k,uploadBtnRef:u,fileInputRef:x,dirInputRef:_,toolSearchQuery:S,toolTooltipVisible:v,toolTooltipText:g,toolTooltipPosition:E,pendingImages:D,uploadingFiles:z,isDragOver:ae,previewVisible:ue,previewUrl:re,showAtPopover:W,atPopoverPosition:he,atSelectedIndex:oe,showSiteSearchPopover:G,siteSearchResults:Y,siteSearchLoading:ge,siteSelectedIndex:ee,uploadPopoverPosition:Q,modelPopoverPosition:ne,toolPopoverPosition:le,visibleTools:K,overflowTools:A,groupedTools:U,updateToolSearchQuery:te,updateAtSelectedIndex:xe,updateSiteSelectedIndex:Te,autoResizeTextarea:Ce,handleInput:_e,handleBlur:Re,handleFocus:De,handlePaste:nt,handleKeydown:Me,handleDragOver:ut,handleDragLeave:Ve,handleDrop:ct,previewImage:gt,closePreview:ft,removeImage:vt,toggleUploadPopover:Ct,selectLocalFile:c,selectLocalDir:T,selectServerFile:m,handleFileSelect:Se,handleDirSelect:at,toggleModelPopover:Le,toggleToolPopover:je,isToolSelected:$e,isCategoryAllSelected:pe,isCategoryPartialSelected:fe,toggleCategorySelection:Fe,formatDescription:mt,formatFileSize:v1,handleAtSelectServerFile:Ee,handleAtSelectSite:qe,handleSiteSelect:We,getPendingImages:ht,clearImages:it,getTextContent:St,getPendingFiles:s1,getPendingSites:n1,clearAll:l1,focus:i1}}const Ms={class:"chat-input-container"},$s={key:0,class:"selected-tools-tags"},Ps={class:"tool-tag-name"},As=["onClick"],Bs={key:0,class:"tool-tag tool-tag-overflow"},Is={class:"tool-tag-name"},Us={class:"tool-overflow-tooltip"},Ds=["onClick"],Es={key:1,class:"image-preview-container"},Fs=["src","onClick"],Ns=["onClick"],Rs={key:2,class:"upload-progress-container"},qs={class:"upload-file-info"},Zs={class:"upload-file-name"},zs={class:"upload-file-size"},Hs={class:"upload-progress-bar"},Os={class:"input-toolbar"},Ws={style:{position:"relative"}},Vs={t:"1775718327975",style:{width:"16px",height:"16px"},viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"4752"},Qs=["title"],Gs={style:{position:"relative"}},Ks=["title"],js={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Js={key:1,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"},Xs={class:"popover-header"},Ys={class:"popover-content"},en={key:0,class:"popover-loading"},tn={key:1,class:"model-list"},on=["onClick"],sn={class:"model-name"},nn={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ln=["innerHTML"],an=["src"],rn=Ie({__name:"ChatInput",props:{inputMessage:{},selectedTools:{},modelsList:{},currentModel:{},toolsList:{},showModelPopover:{type:Boolean},showToolPopover:{type:Boolean},showUploadPopover:{type:Boolean},modelsLoading:{type:Boolean},toolsLoading:{type:Boolean},isSending:{type:Boolean},webSearchEnabled:{type:Boolean},smartMode:{type:Boolean}},emits:["update:inputMessage","update:showModelPopover","update:showToolPopover","update:showUploadPopover","update:webSearchEnabled","update:smartMode","sendMessage","stopMessage","removeSelectedTool","selectModel","toggleToolSelection","batchToggleTools","openSettings"],setup(t,{expose:a,emit:n}){const y=t,k=n,{editorRef:u,modelBtnRef:x,toolBtnRef:_,uploadBtnRef:S,fileInputRef:v,dirInputRef:g,toolSearchQuery:E,toolTooltipVisible:D,toolTooltipText:R,toolTooltipPosition:b,pendingImages:z,uploadingFiles:ae,isDragOver:ue,previewVisible:re,previewUrl:Q,showAtPopover:ne,atPopoverPosition:le,atSelectedIndex:W,showSiteSearchPopover:he,siteSearchResults:X,siteSearchLoading:V,siteSelectedIndex:oe,uploadPopoverPosition:H,modelPopoverPosition:G,toolPopoverPosition:Y,visibleTools:ge,overflowTools:ee,groupedTools:ce,updateToolSearchQuery:K,updateAtSelectedIndex:A,updateSiteSelectedIndex:U,autoResizeTextarea:te,handleInput:xe,handleBlur:Te,handleFocus:Ce,handlePaste:_e,handleKeydown:me,handleDragOver:be,handleDragLeave:ye,handleDrop:De,previewImage:Re,closePreview:Me,removeImage:Oe,toggleUploadPopover:Ee,selectLocalFile:q,selectLocalDir:qe,selectServerFile:O,handleFileSelect:ot,handleDirSelect:We,toggleModelPopover:st,toggleToolPopover:nt,isToolSelected:ut,isCategoryAllSelected:Ve,isCategoryPartialSelected:ct,toggleCategorySelection:Qe,formatDescription:Ge,formatFileSize:Ke,handleAtSelectServerFile:lt,handleAtSelectSite:pt,handleSiteSelect:vt,getPendingImages:it,clearImages:gt,getTextContent:ft,getPendingFiles:ht,getPendingSites:Ct,clearAll:c,focus:T}=bs(y,k);return a({autoResizeTextarea:te,getPendingImages:it,clearImages:gt,getTextContent:ft,getPendingFiles:ht,getPendingSites:Ct,clearAll:c,focus:T}),(m,l)=>(i(),r("div",Ms,[e("div",{class:N(["chat-input-wrapper",{"drag-over":s(ue)}]),onDragover:l[11]||(l[11]=Ze((...p)=>s(be)&&s(be)(...p),["prevent"])),onDragleave:l[12]||(l[12]=(...p)=>s(ye)&&s(ye)(...p)),onDrop:l[13]||(l[13]=Ze((...p)=>s(De)&&s(De)(...p),["prevent"]))},[t.selectedTools.length>0&&!t.smartMode?(i(),r("div",$s,[(i(!0),r(Z,null,ie(s(ge),p=>(i(),r("div",{key:p.id,class:"tool-tag"},[e("span",Ps,B(p.name),1),e("button",{class:"tool-tag-remove",onClick:se=>m.$emit("removeSelectedTool",p.id),title:"移除工具"},[...l[23]||(l[23]=[e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,As)]))),128)),s(ee).length>0?(i(),r("div",Bs,[e("span",Is,"+"+B(s(ee).length),1),e("div",Us,[(i(!0),r(Z,null,ie(s(ee),p=>(i(),r("div",{key:p.id,class:"tool-overflow-item"},[e("span",null,B(p.name),1),e("button",{class:"tool-tag-remove",onClick:se=>m.$emit("removeSelectedTool",p.id),title:"移除工具"},[...l[24]||(l[24]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Ds)]))),128))])])):I("",!0)])):I("",!0),s(z).length>0?(i(),r("div",Es,[(i(!0),r(Z,null,ie(s(z),(p,se)=>(i(),r("div",{key:se,class:"image-preview-item"},[e("img",{src:p,alt:"预览图片",class:"image-preview-thumb",onClick:Se=>s(Re)(p)},null,8,Fs),e("button",{class:"image-preview-remove",onClick:Ze(Se=>s(Oe)(se),["stop"]),title:"移除图片"},[...l[25]||(l[25]=[e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Ns)]))),128))])):I("",!0),s(ae).length>0?(i(),r("div",Rs,[(i(!0),r(Z,null,ie(s(ae),p=>(i(),r("div",{key:p.id,class:N(["upload-progress-item",{error:p.status==="error",success:p.status==="success"}])},[e("div",qs,[l[26]||(l[26]=e("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e("polyline",{points:"14 2 14 8 20 8"})],-1)),e("span",Zs,B(p.name),1),e("span",zs,"("+B(s(Ke)(p.uploaded))+"/"+B(s(Ke)(p.size))+")",1)]),e("div",Hs,[e("div",{class:"upload-progress-fill",style:ke({width:"".concat(p.uploaded/p.size*100,"%")})},null,4)])],2))),128))])):I("",!0),e("div",{ref_key:"editorRef",ref:u,class:"chat-input",contenteditable:"true",onInput:l[0]||(l[0]=(...p)=>s(xe)&&s(xe)(...p)),onBlur:l[1]||(l[1]=(...p)=>s(Te)&&s(Te)(...p)),onFocus:l[2]||(l[2]=(...p)=>s(Ce)&&s(Ce)(...p)),onPaste:l[3]||(l[3]=(...p)=>s(_e)&&s(_e)(...p)),onKeydown:l[4]||(l[4]=(...p)=>s(me)&&s(me)(...p)),"aria-label":"输入框","data-placeholder":"输入消息,按 Shift + Enter 换行,@ 打开引用菜单,可拖拽上传文件,可粘贴图片,按 Enter 发送"},null,544),e("div",Os,[e("div",Ws,[e("button",{ref_key:"uploadBtnRef",ref:S,class:"toolbar-button !p-[.5rem]",style:{padding:"0"},onClick:l[5]||(l[5]=(...p)=>s(Ee)&&s(Ee)(...p)),title:"上传文件"},[(i(),r("svg",Vs,[...l[27]||(l[27]=[e("path",{d:"M924.672 126.976q36.864 36.864 54.784 82.432t17.92 93.696-17.92 93.696-54.784 82.432l-392.192 389.12q-36.864 36.864-90.624 61.44t-113.664 28.672-122.368-16.384-115.712-73.728q-52.224-52.224-72.704-113.152t-16.384-121.344 28.16-113.664 60.928-90.112l348.16-345.088q9.216-9.216 27.136-4.608t27.136 13.824q8.192 9.216 13.312 27.136t-4.096 27.136l-347.136 344.064q-27.648 27.648-46.08 64.512t-21.504 78.848 12.288 84.992 55.296 82.944q35.84 35.84 79.36 50.688t86.528 12.288 81.92-18.944 66.56-44.032l391.168-388.096q27.648-27.648 39.424-57.344t11.264-58.88-13.824-56.832-36.864-51.2q-44.032-43.008-98.816-40.448t-110.08 57.856l-353.28 351.232q-23.552 23.552-23.04 52.224t18.944 47.104q22.528 22.528 51.712 18.432t47.616-22.528l320.512-318.464q9.216-9.216 27.136-4.608t27.136 13.824 14.336 27.136-4.096 27.136l-321.536 318.464q-36.864 36.864-70.656 51.2t-63.488 12.8-55.296-15.872-47.104-34.816q-17.408-16.384-31.232-41.984t-15.872-56.32 10.752-65.536 49.664-70.656q18.432-18.432 32.768-33.792 12.288-13.312 23.04-23.552t11.776-11.264l285.696-284.672q36.864-36.864 80.384-57.856t88.576-24.064 88.576 12.288 80.384 52.224z","p-id":"4753",fill:"var(--el-color-text-secondary)"},null,-1)])]))],512)]),e("button",{ref_key:"modelBtnRef",ref:x,class:"toolbar-button",onClick:l[6]||(l[6]=(...p)=>s(st)&&s(st)(...p)),title:"切换模型"},[l[28]||(l[28]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"3"}),e("path",{d:"M12 1v6m0 6v6m5.2-14.2l-4.2 4.2m0 6l4.2 4.2M23 12h-6m-6 0H1m14.2 5.2l-4.2-4.2m0-6l-4.2-4.2"})],-1)),e("span",null,B(t.currentModel||"选择模型"),1)],512),e("button",{class:N(["toolbar-button",{"toolbar-button-active":t.smartMode}]),onClick:l[7]||(l[7]=p=>m.$emit("update:smartMode",!t.smartMode)),title:t.smartMode?"智能模式已开启,AI将自动判断是否使用工具和联网搜索":"智能模式已关闭,可手动选择工具和联网搜索"},[l[29]||(l[29]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),e("path",{d:"M2 17l10 5 10-5"}),e("path",{d:"M2 12l10 5 10-5"})],-1)),e("span",null,B((t.smartMode,"智能模式")),1)],10,Qs),t.smartMode?I("",!0):(i(),r(Z,{key:0},[e("div",Gs,[e("button",{ref_key:"toolBtnRef",ref:_,class:"toolbar-button",onClick:l[8]||(l[8]=(...p)=>s(nt)&&s(nt)(...p)),title:"使用工具"},[l[30]||(l[30]=e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"})],-1)),e("span",null,"使用工具"+B(t.selectedTools.length>0?" (".concat(t.selectedTools.length,")"):""),1)],512)]),e("button",{class:N(["toolbar-button",{"toolbar-button-active":t.webSearchEnabled}]),onClick:l[9]||(l[9]=p=>m.$emit("update:webSearchEnabled",!t.webSearchEnabled)),title:"联网搜索"},[...l[31]||(l[31]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e("path",{d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})],-1),e("span",null,"联网搜索",-1)])],2)],64)),e("button",{class:N(["send-button",{"stop-button":t.isSending}]),onClick:l[10]||(l[10]=p=>t.isSending?m.$emit("stopMessage"):m.$emit("sendMessage")),title:t.isSending?"停止生成":"发送消息"},[t.isSending?(i(),r("svg",Js,[...l[33]||(l[33]=[e("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"},null,-1)])])):(i(),r("svg",js,[...l[32]||(l[32]=[e("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"},null,-1)])]))],10,Ks)])],34),l[39]||(l[39]=e("div",{class:"ai-disclaimer"}," 内容由 AI 生成,仅供参考,您据此所作判断及操作均由您自行承担责任。 ",-1)),ve(ze,{name:"popover-fade"},{default:Be(()=>[t.showModelPopover?(i(),r("div",{key:0,class:"custom-popover",style:ke(s(G))},[e("div",Xs,[l[35]||(l[35]=e("span",{class:"popover-title"},"选择模型",-1)),e("button",{class:"popover-close",onClick:l[14]||(l[14]=p=>m.$emit("update:showModelPopover",!1))},[...l[34]||(l[34]=[e("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e("div",Ys,[t.modelsLoading?(i(),r("div",en,[...l[36]||(l[36]=[e("div",{class:"loading-spinner"},null,-1),e("span",null,"加载中...",-1)])])):(i(),r("div",tn,[(i(!0),r(Z,null,ie(t.modelsList,p=>(i(),r("div",{key:p,class:N(["model-item",{active:t.currentModel===p}]),onClick:se=>m.$emit("selectModel",p)},[e("span",sn,B(p),1),t.currentModel===p?(i(),r("svg",nn,[...l[37]||(l[37]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):I("",!0)],10,on))),128))]))])],4)):I("",!0)]),_:1}),ve(cs,{showToolPopover:t.showToolPopover,toolPopoverPosition:s(Y),toolsLoading:t.toolsLoading,toolSearchQuery:s(E),groupedTools:s(ce),isToolSelected:s(ut),isCategoryAllSelected:s(Ve),isCategoryPartialSelected:s(ct),"onUpdate:showToolPopover":l[15]||(l[15]=p=>m.$emit("update:showToolPopover",p)),"onUpdate:toolSearchQuery":s(K),onToggleToolSelection:l[16]||(l[16]=p=>m.$emit("toggleToolSelection",p)),onToggleCategorySelection:s(Qe)},null,8,["showToolPopover","toolPopoverPosition","toolsLoading","toolSearchQuery","groupedTools","isToolSelected","isCategoryAllSelected","isCategoryPartialSelected","onUpdate:toolSearchQuery","onToggleCategorySelection"]),ve(fs,{showUploadPopover:t.showUploadPopover,uploadPopoverPosition:s(H),"onUpdate:showUploadPopover":l[17]||(l[17]=p=>m.$emit("update:showUploadPopover",p)),onSelectLocalFile:s(q),onSelectLocalDir:s(qe),onSelectServerFile:s(O)},null,8,["showUploadPopover","uploadPopoverPosition","onSelectLocalFile","onSelectLocalDir","onSelectServerFile"]),ve(Cs,{showAtPopover:s(ne),atPopoverPosition:s(le),atSelectedIndex:s(W),"onUpdate:atSelectedIndex":s(A),onSelectServerFile:s(lt),onSelectSite:s(pt)},null,8,["showAtPopover","atPopoverPosition","atSelectedIndex","onUpdate:atSelectedIndex","onSelectServerFile","onSelectSite"]),ve(ks,{showSiteSearchPopover:s(he),atPopoverPosition:s(le),siteSearchLoading:s(V),siteSearchResults:s(X),siteSelectedIndex:s(oe),"onUpdate:siteSelectedIndex":s(U),onSelectSite:s(vt)},null,8,["showSiteSearchPopover","atPopoverPosition","siteSearchLoading","siteSearchResults","siteSelectedIndex","onUpdate:siteSelectedIndex","onSelectSite"]),e("input",{ref_key:"fileInputRef",ref:v,type:"file",multiple:"",style:{display:"none"},onChange:l[18]||(l[18]=(...p)=>s(ot)&&s(ot)(...p))},null,544),e("input",{ref_key:"dirInputRef",ref:g,type:"file",webkitdirectory:"",directory:"",multiple:"",style:{display:"none"},onChange:l[19]||(l[19]=(...p)=>s(We)&&s(We)(...p))},null,544),ve(ze,{name:"tooltip-fade"},{default:Be(()=>[s(D)&&t.showToolPopover?(i(),r("div",{key:0,class:"tool-tooltip",style:ke(s(b))},[e("div",{class:"tool-tooltip-content",innerHTML:s(Ge)(s(R))},null,8,ln)],4)):I("",!0)]),_:1}),(i(),tt(Jt,{to:"body"},[ve(ze,{name:"preview-fade"},{default:Be(()=>[s(re)?(i(),r("div",{key:0,class:"image-preview-overlay",onClick:l[22]||(l[22]=(...p)=>s(Me)&&s(Me)(...p))},[e("img",{src:s(Q),alt:"预览图片",class:"image-preview-full",onClick:l[20]||(l[20]=Ze(()=>{},["stop"]))},null,8,an),e("button",{class:"image-preview-close",onClick:l[21]||(l[21]=(...p)=>s(Me)&&s(Me)(...p))},[...l[38]||(l[38]=[e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])):I("",!0)]),_:1})]))]))}}),dn=Ue(rn,[["__scopeId","data-v-a746516b"]]),Et=M(!1),He=M(null),de=M(null),Kt="linear-gradient(to right, #C2C63E 40%, #29A73A 70%)",jt=Ae(()=>({background:"var(--el-fill-color-dark)"})),un=Ae(()=>{if(!de.value)return"0%";const a=(de.value.daily_total-de.value.daily_used)/de.value.daily_total*100;return"".concat(Math.max(Math.min(a,100),0),"%")}),cn=Ae(()=>{if(!de.value)return"0%";const a=(de.value.extra_total-de.value.extra_used)/de.value.extra_total*100;return"".concat(Math.max(Math.min(a,100),0),"%")}),pn=Ae(()=>He.value?He.value.skills.filter(t=>t.enabled):[]);async function Pt(){var t,a;Et.value=!0;try{(!yt.value||yt.value.length===0)&&await m1();const n=await f1({sessions_dir:"skill_agent_sessions,aics_sessions"}),k=((a=(t=n.data)==null?void 0:t.data)!=null?a:n.data).map(u=>{const x=yt.value.find(_=>_.id===u.skill_agent_id);return{name:(x==null?void 0:x.name)||u.skill_agent_id,description:u.title,enabled:!0,session_id:u.session_id,sessions_dir:u.sessions_dir,skill_agent_id:u.skill_agent_id,time_str:u.time_str,preset_questions:(x==null?void 0:x.preset_questions)||[]}});He.value={total:k.length,enabled:k.length,disabled:0,skills:k}}catch(n){}finally{Et.value=!1}}function zt(t,a,n){if(a)return;const{createNewConversation:y}=At();y(),n(t)}async function o1(t){await Pt();const{currentAssistantId:a,currentAssistantName:n}=At(),y=a.value,k=n.value;if(y&&k){const u=yt.value.find(_=>_.id===y),x=(u==null?void 0:u.preset_questions)||[];zt({name:k,description:"新会话",enabled:!0,session_id:Date.now().toString(),sessions_dir:"skill_agent_sessions",skill_agent_id:y,time_str:"",preset_questions:x},!1,t);return}}function Tt(t,a,n,y,k,u){var v;const x=yt.value.find(g=>g.id===a),_=(x==null?void 0:x.preset_questions)||[],S={name:t||"AI助手",description:"新会话",enabled:!0,session_id:k||Date.now().toString(),sessions_dir:"skill_agent_sessions",skill_agent_id:a,time_str:"",preset_questions:_};(v=He.value)==null||v.skills.unshift(S),He.value.total+=1,He.value.enabled+=1,zt(S,n,y)}async function vn(t,a,n){if(a)return;await Rt({title:"删除消息",content:"删除后,聊天记录不可恢复,是否继续?"});const{currentConversationId:y,currentTimeStr:k,currentAssistantName:u,currentAssistantId:x}=At();if(!t.time_str){Tt("","",!1,n),Pt();return}d1({request:h1({session_id:t.session_id||"",sessions_dir:t.sessions_dir||""}),message:!0,success:async _=>{_.status&&y.value===t.session_id?(Tt("","",!1,n),Pt()):(await o1(n),k.value===""&&Tt(u.value||"",x.value||"",!1,n))}})}function gn(t,a,n){const y=t.detail;y&&Tt(y.name,y.skill_agent_id,a,n,y.session_id)}function fn(t){var n,y,k,u;const a=(n=t.detail)==null?void 0:n.data;a&&((y=a.data)!=null&&y.daily_quota)&&(de.value={daily_used:a.data.daily_quota.used,daily_total:a.data.daily_quota.total,extra_used:((k=a.data.daily_quota.common_packages)==null?void 0:k.used_count)||0,extra_total:((u=a.data.daily_quota.common_packages)==null?void 0:u.total_count)||0})}function hn(t,a){const n=u=>fn(u),y=u=>gn(u,t(),a),k=u=>{Pt()};return window.addEventListener("update-sidebar-info",n),window.addEventListener("create-new-chat",y),window.addEventListener("update-sidebar-list",k),{onQuotaUpdate:n,onCreateNewChat:y,onUpdateList:k}}function Cn(t){window.removeEventListener("update-sidebar-info",t.onQuotaUpdate),window.removeEventListener("create-new-chat",t.onCreateNewChat),window.removeEventListener("update-sidebar-list",t.onUpdateList)}const mn={class:"list-content"},yn={class:"list-header"},wn={class:"header-title"},xn={key:0,class:"loading-state"},Sn={key:1,class:"empty-state"},Ln={key:2,class:"assistant-items"},kn=["onClick"],Tn={class:"assistant-icon"},_n={key:0,width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 15.0001 14",fill:"none",customFrame:"#000000"},bn={class:"assistant-info"},Mn={class:"assistant-name"},$n={class:"assistant-desc"},Pn=["onClick"],An={key:3,class:"quota-section"},Bn={key:0,class:"quota-item"},In={class:"quota-top"},Un={class:"quota-value"},Dn={class:"quota-progress"},En={key:1,class:"quota-item"},Fn={class:"quota-top"},Nn={class:"quota-value"},Rn={class:"quota-progress"},qn=Ie({__name:"AssistantList",props:{currentAssistant:{},currentConversationId:{},collapsed:{type:Boolean},isSending:{type:Boolean}},emits:["select","create"],setup(t,{emit:a}){const n=t,y=a,k=Ae(()=>n.currentConversationId);function u(g){y("select",g)}function x(g){zt(g,!!n.isSending,u)}function _(g){return vn(g,!!n.isSending,u)}function S(){n.isSending||y("create")}let v=null;return Ft(()=>{o1(u),v=hn(()=>!!n.isSending,u)}),Nt(()=>{v&&(Cn(v),v=null)}),(g,E)=>{const D=Xt,R=a1;return i(),r("div",{class:N(["assistant-list",{collapsed:t.collapsed}])},[e("div",mn,[e("div",yn,[e("span",wn,[E[1]||(E[1]=dt(" 会话列表 ",-1)),ve(D,{effect:"dark",content:"新建会话",placement:"top","open-delay":500,"hide-after":0},{default:Be(()=>[(i(),r("svg",{class:N(["add-svg",{"!cursor-not-allowed":n.isSending}]),onClick:S,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 16 16",width:"20.000000",height:"20.000000",fill:"none"},[...E[0]||(E[0]=[e("rect",{id:"添加-方-L 1",width:"16.000000",height:"16.000000",x:"0.000000",y:"0.000000"},null,-1),e("path",{id:"矢量 2553",d:"M8.50001 5.33301C8.50001 5.22742 8.46658 5.12454 8.40452 5.03911C8.34245 4.95369 8.25494 4.89011 8.15452 4.85748C8.05409 4.82485 7.94592 4.82485 7.8455 4.85748C7.74508 4.89011 7.65756 4.95369 7.5955 5.03912C7.53343 5.12454 7.50001 5.22742 7.50001 5.33301L7.50001 7.50001L5.33301 7.50001C5.22742 7.50001 5.12454 7.53343 5.03912 7.5955C4.95369 7.65756 4.89011 7.74508 4.85748 7.8455C4.82485 7.94592 4.82485 8.05409 4.85748 8.15452C4.89011 8.25494 4.95369 8.34245 5.03911 8.40452C5.12454 8.46658 5.22742 8.50001 5.33301 8.50001L7.50001 8.50001L7.50001 10.667C7.50001 10.7726 7.53343 10.8755 7.5955 10.9609C7.65756 11.0463 7.74508 11.1099 7.8455 11.1425C7.94592 11.1752 8.05409 11.1752 8.15452 11.1425C8.25494 11.1099 8.34245 11.0463 8.40452 10.9609C8.46658 10.8755 8.50001 10.7726 8.50001 10.667L8.50001 8.50001L10.667 8.50001C10.7726 8.50001 10.8755 8.46658 10.9609 8.40452C11.0463 8.34245 11.1099 8.25494 11.1425 8.15452C11.1752 8.05409 11.1752 7.94592 11.1425 7.8455C11.1099 7.74508 11.0463 7.65756 10.9609 7.5955C10.8755 7.53343 10.7726 7.50001 10.667 7.50001L8.50001 7.50001L8.50001 5.33301Z",fill:"var(--el-color-text-primary)","fill-rule":"nonzero"},null,-1),e("path",{id:"矢量 2553",d:"M8.40452 5.03911C8.34245 4.95369 8.25494 4.89011 8.15452 4.85748C8.05409 4.82485 7.94592 4.82485 7.8455 4.85748C7.74508 4.89011 7.65756 4.95369 7.5955 5.03912C7.53343 5.12454 7.50001 5.22742 7.50001 5.33301L7.50001 7.50001L5.33301 7.50001C5.22742 7.50001 5.12454 7.53343 5.03912 7.5955C4.95369 7.65756 4.89011 7.74508 4.85748 7.8455C4.82485 7.94592 4.82485 8.05409 4.85748 8.15452C4.89011 8.25494 4.95369 8.34245 5.03911 8.40452C5.12454 8.46658 5.22742 8.50001 5.33301 8.50001L7.50001 8.50001L7.50001 10.667C7.50001 10.7726 7.53343 10.8755 7.5955 10.9609C7.65756 11.0463 7.74508 11.1099 7.8455 11.1425C7.94592 11.1752 8.05409 11.1752 8.15452 11.1425C8.25494 11.1099 8.34245 11.0463 8.40452 10.9609C8.46658 10.8755 8.50001 10.7726 8.50001 10.667L8.50001 8.50001L10.667 8.50001C10.7726 8.50001 10.8755 8.46658 10.9609 8.40452C11.0463 8.34245 11.1099 8.25494 11.1425 8.15452C11.1752 8.05409 11.1752 7.94592 11.1425 7.8455C11.1099 7.74508 11.0463 7.65756 10.9609 7.5955C10.8755 7.53343 10.7726 7.50001 10.667 7.50001L8.50001 7.50001L8.50001 5.33301C8.50001 5.22742 8.46658 5.12454 8.40452 5.03911Z","fill-rule":"nonzero",stroke:"var(--el-color-text-primary)","stroke-width":"0.300000"},null,-1),e("path",{id:"矢量 2554",d:"M8.03799 1.16699L7.96199 1.16699C6.50199 1.16699 5.35399 1.16699 4.45899 1.28699C3.54099 1.40999 2.81299 1.66899 2.24099 2.24099C1.66799 2.81299 1.41099 3.54099 1.28699 4.45899C1.16699 5.35399 1.16699 6.50099 1.16699 7.96199L1.16699 8.03799C1.16699 9.49799 1.16699 10.646 1.28699 11.541C1.40999 12.459 1.66799 13.187 2.24099 13.759C2.81299 14.331 3.54099 14.589 4.45899 14.713C5.35399 14.833 6.50099 14.833 7.96199 14.833L8.03799 14.833C9.49799 14.833 10.646 14.833 11.541 14.713C12.459 14.59 13.187 14.332 13.759 13.759C14.331 13.187 14.589 12.459 14.713 11.541C14.833 10.646 14.833 9.49899 14.833 8.03799L14.833 7.96199C14.833 6.50199 14.833 5.35399 14.713 4.45899C14.59 3.54099 14.332 2.81299 13.759 2.24099C13.187 1.66799 12.459 1.41099 11.541 1.28699C10.646 1.16699 9.49899 1.16699 8.03799 1.16699L8.03799 1.16699ZM2.94799 2.94699C3.30299 2.59199 3.78499 2.38699 4.59199 2.27799C5.41299 2.16799 6.49299 2.16699 7.99999 2.16699C9.50699 2.16699 10.587 2.16699 11.408 2.27799C12.215 2.38699 12.697 2.59199 13.052 2.94799C13.408 3.30299 13.613 3.78499 13.722 4.59199C13.832 5.41299 13.833 6.49299 13.833 7.99999C13.833 9.50699 13.833 10.587 13.722 11.408C13.613 12.215 13.408 12.697 13.052 13.052C12.697 13.408 12.215 13.613 11.408 13.722C10.587 13.832 9.50699 13.833 7.99999 13.833C6.49299 13.833 5.41299 13.833 4.59199 13.722C3.78499 13.613 3.30299 13.408 2.94799 13.052C2.59199 12.697 2.38699 12.215 2.27799 11.408C2.16799 10.587 2.16699 9.50699 2.16699 7.99999C2.16699 6.49299 2.16699 5.41299 2.27799 4.59199C2.38699 3.78499 2.59199 3.30299 2.94799 2.94799L2.94799 2.94699Z",fill:"var(--el-color-text-primary)","fill-rule":"nonzero"},null,-1),e("path",{id:"矢量 2554",d:"M7.96199 1.16699C6.50199 1.16699 5.35399 1.16699 4.45899 1.28699C3.54099 1.40999 2.81299 1.66899 2.24099 2.24099C1.66799 2.81299 1.41099 3.54099 1.28699 4.45899C1.16699 5.35399 1.16699 6.50099 1.16699 7.96199L1.16699 8.03799C1.16699 9.49799 1.16699 10.646 1.28699 11.541C1.40999 12.459 1.66799 13.187 2.24099 13.759C2.81299 14.331 3.54099 14.589 4.45899 14.713C5.35399 14.833 6.50099 14.833 7.96199 14.833L8.03799 14.833C9.49799 14.833 10.646 14.833 11.541 14.713C12.459 14.59 13.187 14.332 13.759 13.759C14.331 13.187 14.589 12.459 14.713 11.541C14.833 10.646 14.833 9.49899 14.833 8.03799L14.833 7.96199C14.833 6.50199 14.833 5.35399 14.713 4.45899C14.59 3.54099 14.332 2.81299 13.759 2.24099C13.187 1.66799 12.459 1.41099 11.541 1.28699C10.646 1.16699 9.49899 1.16699 8.03799 1.16699L8.03799 1.16699L7.96199 1.16699ZM4.59199 2.27799C5.41299 2.16799 6.49299 2.16699 7.99999 2.16699C9.50699 2.16699 10.587 2.16699 11.408 2.27799C12.215 2.38699 12.697 2.59199 13.052 2.94799C13.408 3.30299 13.613 3.78499 13.722 4.59199C13.832 5.41299 13.833 6.49299 13.833 7.99999C13.833 9.50699 13.833 10.587 13.722 11.408C13.613 12.215 13.408 12.697 13.052 13.052C12.697 13.408 12.215 13.613 11.408 13.722C10.587 13.832 9.50699 13.833 7.99999 13.833C6.49299 13.833 5.41299 13.833 4.59199 13.722C3.78499 13.613 3.30299 13.408 2.94799 13.052C2.59199 12.697 2.38699 12.215 2.27799 11.408C2.16799 10.587 2.16699 9.50699 2.16699 7.99999C2.16699 6.49299 2.16699 5.41299 2.27799 4.59199C2.38699 3.78499 2.59199 3.30299 2.94799 2.94799L2.94799 2.94699C3.30299 2.59199 3.78499 2.38699 4.59199 2.27799Z","fill-rule":"nonzero",stroke:"var(--el-color-text-primary)","stroke-width":"0.300000"},null,-1)])],2))]),_:1})])]),s(Et)?(i(),r("div",xn,[...E[2]||(E[2]=[e("svg",{class:"spinning",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M21 12a9 9 0 11-6.219-8.56"})],-1),e("span",null,"加载中...",-1)])])):!s(He)||!s(He).skills.length?(i(),r("div",Sn,[ve(R,{description:"暂无可用会话"})])):(i(),r("div",Ln,[(i(!0),r(Z,null,ie(s(pn),b=>(i(),r("div",{key:b.session_id,class:N(["assistant-item",{active:k.value===b.session_id,"!cursor-not-allowed":n.isSending}]),onClick:z=>x(b)},[e("div",Tn,[k.value===b.session_id?(i(),r("svg",_n,[...E[3]||(E[3]=[Ye('<defs data-v-7ac52f9b><linearGradient id="paint_linear_0" x1="3.00110435" x2="12.1424131" y1="0" y2="1.30177629" gradientUnits="userSpaceOnUse" data-v-7ac52f9b><stop stop-color="rgb(194,198,62)" offset="0" stop-opacity="1" data-v-7ac52f9b></stop><stop stop-color="rgb(41,167,58)" offset="1" stop-opacity="1" data-v-7ac52f9b></stop></linearGradient><linearGradient id="paint_linear_1" x1="11.4636259" x2="15.1201496" y1="9.33251953" y2="9.85323048" gradientUnits="userSpaceOnUse" data-v-7ac52f9b><stop stop-color="rgb(194,198,62)" offset="0" stop-opacity="1" data-v-7ac52f9b></stop><stop stop-color="rgb(41,167,58)" offset="1" stop-opacity="1" data-v-7ac52f9b></stop></linearGradient></defs><g id="组合 217" data-v-7ac52f9b><path id="星形 1" d="M7.52048 4.25843L11.8422 5.83439L7.52048 7.41034L5.9211 11.6688L4.32172 7.41034L8.88178e-16 5.83438L4.32172 4.25843L5.9211 0L7.52048 4.25843Z" fill="url(#paint_linear_0)" fill-rule="evenodd" data-v-7ac52f9b></path><path id="星形 2" d="M13.2714 11.0359L15.0001 11.6663L13.2714 12.2967L12.6316 14L11.9919 12.2967L10.2632 11.6663L11.9919 11.0359L12.6316 9.33252L13.2714 11.0359Z" fill="url(#paint_linear_1)" fill-rule="evenodd" data-v-7ac52f9b></path></g>',2)])])):I("",!0)]),e("div",bn,[e("div",Mn,B(b.name||"AI助手"),1),e("div",$n,B(b.time_str||s(u1)(new Date().getTime())),1)]),e("div",{class:N(["assistant-delete",{"!cursor-not-allowed":n.isSending}]),onClick:Ze(z=>_(b),["stop"])},[...E[4]||(E[4]=[e("i",{class:"svgtofont-el-close-bold"},null,-1)])],10,Pn)],10,kn))),128))])),s(de)?(i(),r("div",An,[s(de).daily_total>0?(i(),r("div",Bn,[e("div",In,[E[5]||(E[5]=e("span",{class:"quota-label"},"每日免费额度",-1)),e("span",Un,"剩"+B(s(de).daily_total-s(de).daily_used)+"次",1)]),e("div",Dn,[e("div",{class:"progress-bar",style:ke(s(jt))},[e("div",{class:"progress-fill",style:ke({width:s(un),background:s(Kt)})},null,4)],4)])])):I("",!0),s(de).extra_total>0?(i(),r("div",En,[e("div",Fn,[E[6]||(E[6]=e("span",{class:"quota-label"},"资源包额度",-1)),e("span",Nn,"剩"+B(s(de).extra_total-s(de).extra_used)+"次",1)]),e("div",Rn,[e("div",{class:"progress-bar shiny-progress",style:ke(s(jt))},[e("div",{class:"progress-fill",style:ke({width:s(cn),background:s(Kt)})},null,4)],4)])])):I("",!0)])):I("",!0)])],2)}}}),Zn=Ue(qn,[["__scopeId","data-v-7ac52f9b"]]);function zn(){let t=null;const a=!1;async function n(k,u,x,_,S,v,g,E,D,R,b,z,ae,ue,re){var ne,le,W;t&&t.abort(),t=new AbortController;const Q=t.signal;try{const he=Date.now(),X=window.vite_public_proxy_key||"",V=Ht(String(he).concat(Ht(X))),H=(ne=(await fetch("".concat(a?"/api":"","/mod/agent/com/chat").concat(a?"?request_time=".concat(he,"&request_token=").concat(V):""),{method:"POST",headers:{"Content-Type":"application/json","x-http-token":window.vite_public_request_token},body:JSON.stringify({message:typeof k=="string"?k:JSON.stringify(k),model:x,...g?{web_search:!0,tools:S.map(Y=>Y.id)}:{tools:_.map(Y=>Y.id),...v?{web_search:!0}:{}},session_id:u,...E?{skill_agent_id:E,sessions_dir:"skill_agent_sessions"}:{prompt_id:"agent_aics"}}),signal:Q})).body)==null?void 0:ne.getReader();if(!H)throw new Error("无法获取响应流");const G=new TextDecoder("utf-8");for(;;){const{done:Y,value:ge}=await H.read();if(Y)break;let ce=G.decode(ge,{stream:!0}).split("\n"),K,A={onThink:z,onChunk:D,onError:b,onComplete:R,onToolCall:ae,onToolResult:ue,onMetaInfo:re};for(let U of ce)if(U=U.replace(/\r$/,""),U!==""){if(U.startsWith("event:"))switch(U.slice(6).trim()){case"message_think":K="onThink";break;case"message":K="onChunk";break;case"tool_call":K="onToolCall";break;case"tool_result":K="onToolResult";break;case"meta_info":K="onMetaInfo";break;case"message_end":R();break;case"error":K="onError";break;case"usage":K="";break}else if(U.startsWith("data:")){let te=U.slice(5).slice(1);if((te.startsWith('"')&&te.endsWith('"')||te.startsWith("'")&&te.endsWith("'"))&&(te=te.slice(1,-1)),!K)continue;if(K==="onToolCall"||K==="onToolResult"||K==="onMetaInfo")try{const xe=JSON.parse(te);(le=A[K])==null||le.call(A,xe)}catch(xe){}else te=te.replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"	"),(W=A[K])==null||W.call(A,te)}}}t=null}catch(he){if(he.name==="AbortError"){t=null;return}b("抱歉,连接AI服务时出现错误,请稍后再试。"),t=null}}function y(){t&&(t.abort(),t=null)}return{getAIResponseStream:n,abortCurrentRequest:y}}function Hn(t){const{mainHeight:a}=c1(),{inputMessage:n,currentMessages:y,conversations:k,currentConversationId:u,currentSkillAgentId:x,currentSessionDir:_,currentTimeStr:S,currentAssistantName:v,currentAssistantPresetQuestions:g,historyPanelVisible:E,isTyping:D,isSending:R,streamingContentBlocks:b,streamingThinkCollapsed:z,modelsList:ae,currentModel:ue,toolsList:re,selectedTools:Q,showModelPopover:ne,showToolPopover:le,showUploadPopover:W,modelsLoading:he,toolsLoading:X,webSearchEnabled:V,smartMode:oe,saveConversation:H,loadConversation:G,deleteConversation:Y,createNewConversation:ge,getTimeAgo:ee}=At(),{getAIResponseStream:ce,abortCurrentRequest:K}=zn();let A=null,U=null;const te=M(!1),xe=M(!1),Te=M({system_prompt:"",api_base_url:"",api_key:"",models:[],embedding:{embedding_api_key:"",embedding_base_url:"",embedding_model_name:""},rag:{sliding_window_size:10,rag_trigger_threshold:3,rag_retrieval_count:10,rag_final_count:5},agent:{max_tool_iterations:10,temperature:1,top_p:1},default_headers:{},questions:[]}),Ce=Ae(()=>g.value.length>0?g.value.map(c=>({question:c,tools:[]})):Te.value.questions||[]);let _e=null,me=null;function be(){D.value=!1,me&&clearTimeout(me),me=setTimeout(()=>{R.value&&(D.value=!0)},3e3)}function ye(){me&&(clearTimeout(me),me=null),D.value=!1}function De(c){return{onChunk:T=>{be();const m=b.value[b.value.length-1];m&&m.type==="message"?m.content+=T:b.value.push({type:"message",content:T}),b.value.some(l=>l.type==="think")&&(z.value=!0),J(()=>A==null?void 0:A.scrollToBottom())},onComplete:()=>{if(ye(),b.value.length>0){b.value.forEach(l=>{l.type==="think"&&(l.collapsed=!0)});const T=window.__temp_ai_msg_id;delete window.__temp_ai_msg_id;const m={role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...b.value],id:T};c!==void 0?y.value.splice(c,0,m):y.value.push(m)}b.value=[],R.value=!1,H(),O(),J(()=>A==null?void 0:A.scrollToBottom())},onError:T=>{ye(),b.value.forEach(l=>{l.type==="think"&&(l.collapsed=!0)}),b.value.push({type:"message",content:T});const m={role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...b.value]};c!==void 0?y.value.splice(c,0,m):y.value.push(m),b.value=[],R.value=!1,H(),O()},onThink:T=>{be();const m=b.value[b.value.length-1];m&&m.type==="think"?m.content+=T:(b.value.forEach(l=>{l.type==="think"&&(l.collapsed=!0)}),b.value.push({type:"think",content:T,collapsed:!1})),J(()=>A==null?void 0:A.scrollToBottom())},onToolCall:T=>{be();const m=(()=>{try{return JSON.parse(T.args).description}catch(p){return}})();if(T.tool==="TodoWrite"){const p=y1(T.args);if(p&&p.length>0){const se=b.value.findIndex(Se=>Se.type==="tool_call"&&Se.tool==="TodoWrite");se!==-1&&b.value.splice(se,1),b.value.push({type:"tool_call",tool:T.tool,args:T.args,id:T.id,status:"calling",collapsed:!1,todoItems:p,description:m})}}else{const p=b.value.find(se=>se.type==="tool_call"&&se.id===T.id);p&&p.type==="tool_call"?(p.args=T.args,p.status="calling",m&&(p.description=m)):b.value.push({type:"tool_call",tool:T.tool,args:T.args,id:T.id,status:"calling",collapsed:!0,description:m})}J(()=>A==null?void 0:A.scrollToBottom())},onToolResult:T=>{be();const m=b.value.find(l=>l.type==="tool_call"&&l.id===T.id);if(m&&m.type==="tool_call"&&(m.result=T.result,m.status="completed",m.tool==="TodoWrite")){const l=w1(T.result);l&&(m.todoItems=l)}J(()=>A==null?void 0:A.scrollToBottom())},onMetaInfo:(T,m)=>{m!==void 0&&y.value[m]&&(y.value[m].id=T.user_msg_id),window.__temp_ai_msg_id=T.ai_msg_id}}}async function Re(){var je,$e;const c=n.value,T=(U==null?void 0:U.getPendingImages())||[],m=(U==null?void 0:U.getPendingFiles())||[],l=U==null?void 0:U.getPendingSites();if(!c&&T.length===0&&m.length===0&&((l==null?void 0:l.length)||0)===0||R.value)return;u.value||(u.value=Date.now().toString()),R.value=!0,n.value="",U==null||U.clearAll(),J(()=>{U==null||U.autoResizeTextarea()});const p=[];c&&p.push({type:"text",text:c});const se=new Set;for(const pe of m){const fe="@"+pe.name,Fe=p.find(mt=>{var St;return mt.type==="file"&&"source"in mt&&((St=mt.source)==null?void 0:St.value)===fe}),Ne=c.indexOf(fe,($e=(je=Fe==null?void 0:Fe.source)==null?void 0:je.end)!=null?$e:0);Ne!==-1&&(p.push({type:"file",source:{value:fe,start:Ne,end:Ne+fe.length},path:pe.path}),se.add(fe))}for(const pe of l||[]){const fe="@site:".concat(pe.name),Fe=c.indexOf(fe);Fe!==-1&&p.push({type:"site",source:{value:fe,start:Fe,end:Fe+fe.length},name:pe.name})}if(T.length>0)for(const pe of T)p.push({type:"image_url",image_url:{url:pe}});const Se=p,at=y.value.length;y.value.push({role:"user",content:Se,time:new Date().toISOString()}),D.value=!0,A==null||A.forceScrollToBottom(),b.value=[],z.value=!1,window.dispatchEvent(new CustomEvent("update-sidebar-list"));const Le=De();await ce(Se,u.value,ue.value,Q.value,re.value,V.value,oe.value,x.value,Le.onChunk,Le.onComplete,Le.onError,Le.onThink,Le.onToolCall,Le.onToolResult,pe=>Le.onMetaInfo(pe,at))}async function Me(c){let T="";for(let l=c-1;l>=0;l--)if(y.value[l].role==="user"){T=y.value[l].content;break}if(!T)return;y.value.splice(c,1),D.value=!0,R.value=!0,b.value=[],z.value=!1;const m=De(c);await ce(T,u.value||Date.now().toString(),ue.value,Q.value,re.value,V.value,oe.value,x.value,m.onChunk,m.onComplete,m.onError,m.onThink,m.onToolCall,m.onToolResult,l=>{window.__temp_ai_msg_id_regen=l.ai_msg_id})}function Oe(){K(),ye(),R.value=!1,b.value.length>0&&(b.value.forEach(c=>{c.type==="think"&&(c.collapsed=!0)}),y.value.push({role:"assistant",content:"",time:new Date().toISOString(),contentBlocks:[...b.value]})),b.value=[],O()}async function Ee(c){v.value=c.name,x.value=c.skill_agent_id,S.value=c.time_str||"",c.time_str?(g.value=[],_.value=c.sessions_dir||"",await G(c.session_id,c.sessions_dir||"")):(g.value=c.preset_questions||[],u.value=c.session_id,_.value=c.sessions_dir||""),J(()=>{A==null||A.forceScrollToBottom()})}function q(){te.value=!te.value}function qe(){if(y.value.length===0)return;const c=x.value,T=v.value,m=new Date().getTime().toString();ge(),Ee({name:T,session_id:m,skill_agent_id:c||""}),window.dispatchEvent(new CustomEvent("create-new-chat",{detail:{name:T,session_id:m,skill_agent_id:c||""}}))}async function O(){var T;window.dispatchEvent(new CustomEvent("update-sidebar-list"));const c=await Wt({type:""});c.data&&((T=c.data.data)!=null&&T.daily_quota)&&window.dispatchEvent(new CustomEvent("update-sidebar-info",{detail:{data:c.data}}))}function ot(c){var T,m,l,p,se,Se,at,Le,je,$e,pe,fe;c&&c.config&&(Te.value={system_prompt:c.config.system_prompt||"",api_base_url:c.config.api_base_url||"",api_key:c.config.api_key||"",models:c.config.models||[],embedding:{embedding_api_key:((T=c.config.embedding)==null?void 0:T.embedding_api_key)||"",embedding_base_url:((m=c.config.embedding)==null?void 0:m.embedding_base_url)||"",embedding_model_name:((l=c.config.embedding)==null?void 0:l.embedding_model_name)||""},rag:{sliding_window_size:((p=c.config.rag)==null?void 0:p.sliding_window_size)||10,rag_trigger_threshold:((se=c.config.rag)==null?void 0:se.rag_trigger_threshold)||3,rag_retrieval_count:((Se=c.config.rag)==null?void 0:Se.rag_retrieval_count)||10,rag_final_count:((at=c.config.rag)==null?void 0:at.rag_final_count)||5},agent:{max_tool_iterations:((Le=c.config.agent)==null?void 0:Le.max_tool_iterations)||10,temperature:($e=(je=c.config.agent)==null?void 0:je.temperature)!=null?$e:1,top_p:(fe=(pe=c.config.agent)==null?void 0:pe.top_p)!=null?fe:1},default_headers:c.config.default_headers||{}},ae.value=c.config.models||[],ae.value.length>0&&(ue.value=c.config.default_model||ae.value[0])),c&&c.questions&&(Te.value.questions=c.questions)}async function We(c){const T=y.value[c],m=async()=>{if(!T.id||!u.value){y.value.splice(c,1),H(),y.value.length===0&&ge();return}(await C1({session_id:u.value,sessions_dir:_.value||"aics_sessions",id:T.id})).status&&(y.value.splice(c,1),H(),y.value.length===0&&ge())},l=T.id?"删除后,聊天记录不可恢复,对话内的文件也将被彻底删除":"是否删除该条消息?";await Rt({title:"删除消息",content:l}),await m()}function st(c){if(n.value=c.question,c.tools&&c.tools.length>0){const T=c.tools.map(m=>re.value.find(l=>l.id===m)).filter(m=>m!==void 0);Q.value=T}J(()=>{U==null||U.autoResizeTextarea()})}function nt(){R.value||(n.value="继续",J(()=>{Re()}))}function ut(){Qe(),E.value=!0}function Ve(){E.value=!1}function ct(){_e=setTimeout(()=>{Ve()},200)}function Qe(){_e&&(clearTimeout(_e),_e=null)}async function Ge(c){Ve(),await G(c),A==null||A.forceScrollToBottom()}function Ke(c){ue.value=c,ne.value=!1}async function lt(c){const T=Q.value.findIndex(m=>m.id===c.id);T>-1?Q.value.splice(T,1):Q.value.push(c)}function pt(c,T){if(T)c.forEach(m=>{Q.value.some(l=>l.id===m.id)||Q.value.push(m)});else{const m=new Set(c.map(l=>l.id));Q.value=Q.value.filter(l=>!m.has(l.id))}}function vt(c){const T=Q.value.findIndex(m=>m.id===c);T>-1&&Q.value.splice(T,1)}function it(c){const T=c.target;!T.closest(".custom-popover")&&!T.closest(".toolbar-button")&&(ne.value=!1,le.value=!1,W.value=!1)}async function gt(){var T;xe.value=!1;const c=await Vt();c.data&&Array.isArray((T=c.data)==null?void 0:T.data)&&(re.value=c.data.data||[])}async function ft(c){}kt(()=>t.path,()=>{setTimeout(()=>{A==null||A.forceScrollToBottom()},300)},{immediate:!0});async function ht(c,T){var p;A=c,U=T,document.addEventListener("click",it);const m=await Wt({type:""});m.status&&(ot(m.data.data),window.dispatchEvent(new CustomEvent("update-sidebar-info",{detail:{data:m.data}}))),X.value=!0;const l=await Vt();l.data&&Array.isArray((p=l.data)==null?void 0:p.data)&&(re.value=l.data.data||[]),X.value=!1}function Ct(){document.removeEventListener("click",it),K(),ye(),O(),b.value=[],ne.value=!1,le.value=!1,W.value=!1,R.value=!1}return{mainHeight:a,inputMessage:n,currentMessages:y,conversations:k,currentConversationId:u,currentAssistantName:v,historyPanelVisible:E,isTyping:D,isSending:R,streamingContentBlocks:b,streamingThinkCollapsed:z,modelsList:ae,currentModel:ue,toolsList:re,selectedTools:Q,showModelPopover:ne,showToolPopover:le,showUploadPopover:W,modelsLoading:he,toolsLoading:X,webSearchEnabled:V,smartMode:oe,assistantCollapsed:te,settingsDrawerVisible:xe,globalConfig:Te,computedSuggestions:Ce,getTimeAgo:ee,sendMessage:Re,regenerateMessage:Me,stopMessage:Oe,handleSelectAssistant:Ee,toggleAssistantCollapse:q,createNewChat:qe,handleDeleteMessage:We,handleSuggestionClick:st,handleContinue:nt,showHistoryPanel:ut,hideHistoryPanel:Ve,startHideTimer:ct,clearHideTimer:Qe,handleLoadConversation:Ge,selectModel:Ke,toggleToolSelection:lt,batchToggleTools:pt,removeSelectedTool:vt,closeSettingsDrawer:gt,handleSaveConfig:ft,saveConversation:H,loadConversation:G,deleteConversation:Y,createNewConversation:ge,init:ht,cleanup:Ct}}const On={class:"assistant-wrapper"},Wn={class:"chat-header"},Vn={class:"chat-header-left"},Qn={class:"assistant-name"},Gn=Ie({__name:"index",setup(t){const a=r1(),n=M(null),y=M(null),k=Hn(a),{mainHeight:u,inputMessage:x,currentMessages:_,conversations:S,currentConversationId:v,currentAssistantName:g,historyPanelVisible:E,isTyping:D,isSending:R,streamingContentBlocks:b,streamingThinkCollapsed:z,modelsList:ae,currentModel:ue,toolsList:re,selectedTools:Q,showModelPopover:ne,showToolPopover:le,showUploadPopover:W,modelsLoading:he,toolsLoading:X,webSearchEnabled:V,smartMode:oe,assistantCollapsed:H,computedSuggestions:G,getTimeAgo:Y,sendMessage:ge,regenerateMessage:ee,stopMessage:ce,handleSelectAssistant:K,toggleAssistantCollapse:A,createNewChat:U,handleDeleteMessage:te,handleSuggestionClick:xe,handleContinue:Te,showHistoryPanel:Ce,hideHistoryPanel:_e,startHideTimer:me,clearHideTimer:be,handleLoadConversation:ye,selectModel:De,toggleToolSelection:Re,batchToggleTools:Me,removeSelectedTool:Oe}=k;return Ft(()=>k.init(n.value,y.value)),Nt(()=>k.cleanup()),(Ee,q)=>{const qe=Xt;return i(),r("div",{class:"ai-chat-page",style:ke({"min-height":s(u)-120+"px","max-height":s(u)-120+"px"})},[e("div",On,[ve(Zn,{currentAssistant:s(g),currentConversationId:s(v),collapsed:s(H),isSending:s(R),onSelect:s(K),onCreate:s(U)},null,8,["currentAssistant","currentConversationId","collapsed","isSending","onSelect","onCreate"])]),e("div",{class:N(["chat-main",{"assistant-collapsed":s(H)}])},[e("div",Wn,[e("div",Vn,[e("div",{class:N(["assistant-collapse-btn",{"is-collapsed":s(H)}]),onClick:q[0]||(q[0]=(...O)=>s(A)&&s(A)(...O))},[ve(qe,{effect:"dark",content:s(H)?"展开助手列表":"折叠助手列表",placement:"top","open-delay":500,"hide-after":0},{default:Be(()=>[...q[8]||(q[8]=[e("svg",{t:"1775554157975",class:"w-[2.2rem] h-[2.2rem]",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"1655",width:"200",height:"200"},[e("path",{d:"M341.333333 298.666667H213.333333v469.333333h640V298.666667H384v469.333333H341.333333V298.666667z m554.666667-42.666667v554.666667H170.666667V256h725.333333z",fill:"var(--el-color-text-primary)","p-id":"1656"})],-1)])]),_:1},8,["content"])],2),e("span",Qn,B(s(g)||"AI助手"),1)]),q[9]||(q[9]=e("div",{class:"chat-header-right"},null,-1))]),ve($1,{conversations:s(S),currentConversationId:s(v),panelVisible:s(E),getTimeAgo:s(Y),isSending:s(R),onShowPanel:s(Ce),onHidePanel:s(_e),onStartHideTimer:s(me),onClearHideTimer:s(be),onLoadConversation:s(ye)},null,8,["conversations","currentConversationId","panelVisible","getTimeAgo","isSending","onShowPanel","onHidePanel","onStartHideTimer","onClearHideTimer","onLoadConversation"]),ve(Jo,{ref_key:"chatMainRef",ref:n,messages:s(_),isTyping:s(D),isSending:s(R),streamingContentBlocks:s(b),streamingThinkCollapsed:s(z),suggestions:s(G),assistantName:s(g),"onUpdate:streamingThinkCollapsed":q[1]||(q[1]=O=>z.value=O),onSuggestionClick:s(xe),onRegenerate:s(ee),onDeleteMessage:s(te),onContinue:s(Te)},null,8,["messages","isTyping","isSending","streamingContentBlocks","streamingThinkCollapsed","suggestions","assistantName","onSuggestionClick","onRegenerate","onDeleteMessage","onContinue"]),ve(dn,{ref_key:"chatInputRef",ref:y,inputMessage:s(x),"onUpdate:inputMessage":q[2]||(q[2]=O=>rt(x)?x.value=O:null),showModelPopover:s(ne),"onUpdate:showModelPopover":q[3]||(q[3]=O=>rt(ne)?ne.value=O:null),showToolPopover:s(le),"onUpdate:showToolPopover":q[4]||(q[4]=O=>rt(le)?le.value=O:null),showUploadPopover:s(W),"onUpdate:showUploadPopover":q[5]||(q[5]=O=>rt(W)?W.value=O:null),webSearchEnabled:s(V),"onUpdate:webSearchEnabled":q[6]||(q[6]=O=>rt(V)?V.value=O:null),smartMode:s(oe),"onUpdate:smartMode":q[7]||(q[7]=O=>rt(oe)?oe.value=O:null),currentModel:s(ue),selectedTools:s(Q),modelsList:s(ae),toolsList:s(re),modelsLoading:s(he),toolsLoading:s(X),isSending:s(R),onSendMessage:s(ge),onStopMessage:s(ce),onRemoveSelectedTool:s(Oe),onSelectModel:s(De),onToggleToolSelection:s(Re),onBatchToggleTools:s(Me)},null,8,["inputMessage","showModelPopover","showToolPopover","showUploadPopover","webSearchEnabled","smartMode","currentModel","selectedTools","modelsList","toolsList","modelsLoading","toolsLoading","isSending","onSendMessage","onStopMessage","onRemoveSelectedTool","onSelectModel","onToggleToolSelection","onBatchToggleTools"])],2)],4)}}}),ll=Ue(Gn,[["__scopeId","data-v-0f521143"]]);export{ll as default};