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/useController23.js
import{c as B,f as J}from"./utils-lib.js?v=1777008528";import{r as e,V as L,g as D}from"./base-lib.js?v=1777008528";import{g as R,d as U,a as W}from"./ai.js?v=1777008528";function H(n){try{let l=JSON.parse(n).todos;if(typeof l=="string"&&(l=JSON.parse(l)),Array.isArray(l))return l}catch(i){}}function ht(n){try{const i=n.match(/<toolcall_result>\s*([\s\S]*?)\s*<\/toolcall_result>/);if(!i)return;const l=i[1].trim(),f=JSON.parse(l);if(Array.isArray(f))return f}catch(i){}}const Q=e(""),g=e([]),d=e([]),v=e(null),y=e(null),_=e(null),V=e(""),z=e(""),w=e(""),S=e([]),E=e(!1),G=e(!1),F=e(!1),O=e([]),K=e(!1),X=e([]),Y=e(""),Z=e([]),tt=e([]),et=e(!1),st=e(!1),nt=e(!1),ot=e(!1),at=e(!1),lt=e(!1),it=e(!0);function rt(){const n=t=>{const r=[];let a=0;for(;a<t.length;){const s=t[a];if(s.role==="user")r.push({role:"user",content:s.content,time:new Date(s.timestamp*1e3).toISOString(),id:s.id}),a++;else if(s.role==="assistant"){const o=[];if(s.reasoning_content&&o.push({type:"think",content:s.reasoning_content,collapsed:!0}),s.tool_calls&&s.tool_calls.length>0)for(const c of s.tool_calls){const h=c.function.name==="TodoWrite",q=(()=>{try{return JSON.parse(c.function.arguments).description}catch(C){return}})(),A={type:"tool_call",tool:c.function.name,args:c.function.arguments,id:c.id,status:"calling",collapsed:!h,description:q,todoItems:h?H(c.function.arguments):void 0},k=t.find(C=>C.role==="tool"&&C.tool_call_id===c.id);k&&(A.result=k.content,A.status="completed"),o.push(A)}let u=s.content;if(Array.isArray(s.content)){const c=s.content.find(h=>h.type==="text");u=(c==null?void 0:c.text)||""}for(u&&o.push({type:"message",content:u}),r.push({role:"assistant",content:u||"",time:new Date(s.timestamp*1e3).toISOString(),contentBlocks:o.length>0?o:void 0,id:s.id}),a++;a<t.length&&t[a].role==="tool";)a++}else s.role,a++}return r},i=()=>{if(!v.value||g.value.length===0)return;const t=g.value.find(o=>o.role==="user");let r="新对话";if(t){if(typeof t.content=="string")r=t.content.substring(0,30);else if(Array.isArray(t.content)){const o=t.content.find(u=>u.type==="text");o!=null&&o.text?r=o.text.substring(0,30):r="[图片消息]"}}const a={id:v.value,title:r,messages:g.value,updatedAt:new Date().toISOString()},s=d.value.findIndex(o=>o.id===v.value);s>=0?d.value[s]=a:d.value.unshift(a)},l=async(t,r)=>{const a=d.value.find(o=>o.id===t);if(a&&a.messages.length>0){v.value=t,g.value=[...a.messages];return}const{data:s}=await R({session_id:t,sessions_dir:r||"skill_agent_sessions"});if(s.data&&Array.isArray(s.data)){const o=n(s.data),u=d.value.findIndex(c=>c.id===t);u>=0&&(d.value[u].messages=o),v.value=t,g.value=o}},f=async(t,r)=>{(await U({session_id:t,sessions_dir:r})).status&&(d.value=d.value.filter(s=>s.id!==t),v.value===t&&m())},m=()=>{v.value=null,y.value=null,g.value=[],O.value=[]};return{inputMessage:Q,currentMessages:g,conversations:d,currentConversationId:v,currentSkillAgentId:y,currentAssistantId:_,currentAssistantName:w,currentSessionDir:V,currentTimeStr:z,currentAssistantPresetQuestions:S,historyPanelVisible:E,isTyping:G,isSending:F,streamingContentBlocks:O,streamingThinkCollapsed:K,modelsList:X,currentModel:Y,toolsList:Z,selectedTools:tt,showModelPopover:et,showToolPopover:st,showUploadPopover:nt,modelsLoading:ot,toolsLoading:at,webSearchEnabled:lt,smartMode:it,saveConversation:i,loadConversation:l,deleteConversation:f,createNewConversation:m,getTimeAgo:t=>{const a=new Date().getTime()-t.getTime(),s=Math.floor(a/6e4),o=Math.floor(a/36e5),u=Math.floor(a/864e5);return s<1?"刚刚":s<60?"".concat(s,"分钟前"):o<24?"".concat(o,"小时前"):u<7?"".concat(u,"天前"):t.toLocaleDateString("zh-CN",{month:"numeric",day:"numeric"})},setAssistantInfo:t=>{_.value=t.id,w.value=t.name,S.value=t.preset_questions||[],t.skill_agent_id&&(y.value=t.skill_agent_id)},clearAssistantInfo:()=>{_.value=null,w.value="",S.value=[],y.value=null}}}const ct=J(),p=L([]),M=e(""),N=L([]),T=L([]),x=e("all"),P=e([]),b=e(!1),{mainWidth:$}=B(),yt=n=>n==="all"?"全部":n,j=()=>Math.floor(($.value-420)/80),At=D(()=>{const n=Math.max(0,j()),l=["all"].concat(p.value);return l.slice(0,Math.min(l.length,n+1))}),Ct=D(()=>{const n=Math.max(1,Math.floor(($.value-100)/300));return{gridTemplateColumns:"repeat(".concat(n,", minmax(280px, 1fr))")}}),ut=async()=>{b.value=!0;const{status:n,data:i}=await W();n&&(T.value=i.data.list||[],p.value=i.data.categories||[],P.value=p.value.slice(j(),p.value.length),I()),b.value=!1},I=()=>{const n=M.value.trim().toLowerCase(),i=x.value;let l=T.value;i!=="all"&&(l=l.filter(f=>f.category===i)),n&&(l=l.filter(f=>{var m;return f.name.toLowerCase().includes(n)||((m=f.description)==null?void 0:m.toLowerCase().includes(n))||f.id.toLowerCase().includes(n)})),N.value=l},_t=async n=>{x.value=n,M.value="",I()},wt=async(n=!1)=>{n?(await ut(),ct.success("刷新成功")):I()},St=()=>{N.value=[],T.value=[],p.value=[],P.value=[],M.value="",x.value="all"},Lt=(n,i)=>{const{setAssistantInfo:l}=rt();l({id:n.id,name:n.name,preset_questions:n.preset_questions,skill_agent_id:n.id}),i.push({path:"/ai/chat"})};export{yt as a,P as b,x as c,Ct as d,Lt as e,T as f,ut as g,_t as h,rt as i,ht as j,b as l,H as p,wt as r,M as s,N as t,St as u,At as v};