import{k as cl,o as wl,w as yl,_ as b,Z as t,Y as i,X as o,N as n,W as M,a1 as K,r as v,c as k,e as Ke,j as p,F as V,R as q,I as Fe,L as Se,$ as w,l as bl,a4 as kl,U as xl,V as m}from"./vendor-vue-Dqr9UV61-aster.js";import{k as De,c as C,g as Cl,m as Tl,d as Al}from"./index-DHt40zKj-aster.js";import{P as Rl}from"./PageTour-CdU2AnnI-aster.js";import{_ as Le}from"./PixelSection.vue_vue_type_script_setup_true_lang-BFSQ9vuX-aster.js";import{l as h}from"./aster-star-logo-q1-S37nl-aster.js";import{u as zl,h as $l,i as Pe,B as c,f as ee,b as Be,p as g,w as Ul,q as Il,r as Me}from"./vendor-ui-SnQwDthD-aster.js";import{p as Kl,s as Fl,x as ge,D as Sl,y as E,z as Dl,u as Ll,A as Pl,M as Bl,E as Ml,j as je}from"./vendor-icons-B2dQ8Ycb-aster.js";import{_ as jl}from"./_plugin-vue_export-helper-DlAUqK2U-aster.js";import"./vendor-DWmN2shr-aster.js";const Ol={class:"view-page agents-page"},El={class:"view-header","data-tour":"agents-actions"},Nl={class:"agents-layout"},Xl={class:"agent-grid"},Ql=["onClick"],Vl=["src","alt"],ql={class:"agent-editor"},Wl=["src","alt"],Gl={key:0,class:"template-row"},Yl={class:"simple-agent-form"},Hl={class:"simple-agent-section"},Jl={class:"simple-grid two"},Zl={class:"simple-agent-section"},_l={class:"simple-agent-section"},hl={class:"upload-row"},et={class:"file-picker"},lt=["accept"],tt={class:"knowledge-console compact-console"},at={class:"console-head"},st={key:0},nt={key:1},it={class:"doc-list"},ot={key:0,class:"empty-inline"},ut={key:0},dt={class:"inline-advanced"},rt={class:"simple-agent-section"},vt={class:"ai-config-card"},pt={class:"advanced-agent-settings"},mt={class:"tab-grid"},ft={class:"editor-row"},gt={class:"editor-row"},ct=["disabled"],wt={key:0,class:"avatar-palette"},yt=["onClick"],bt=["src","alt"],kt={class:"toolset-grid"},xt={class:"inline-check"},Ct={class:"eval-actions"},Tt={class:"editor-actions","data-tour":"agents-save"},At={class:"create-agent-modal"},Rt={class:"simple-grid two"},zt={class:"field-label-row"},$t={class:"create-step"},Ut={class:"create-step-title-row"},It={class:"create-upload-panel"},Kt={class:"create-file-drop"},Ft=["accept"],St={key:0,class:"create-file-list"},Dt={class:"create-step"},Lt={class:"create-step-title-row"},Pt={class:"modal-actions"},Bt={class:"ai-fill-modal"},Mt={class:"modal-actions"},jt="支持 Markdown、TXT、JSON、CSV、YAML、DOCX、文本型 PDF、XLSX、XLS，可一次选择多个文件。",Ot=cl({__name:"AgentsView",setup(Et){const y=zl(),ce=xl(),we=[".md",".markdown",".txt",".json",".jsonl",".csv",".tsv",".yaml",".yml",".docx",".pdf",".xlsx",".xls","application/pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"].join(","),le=v(!1),z=v(!1),$=v("aster"),A=v([]),U=v("aster"),x=v(!1),N=v(!1),j=v(!1),te=v([]),X=v(""),ae=v("profile"),D=v(null),se=v(!1),W=v(!1),ne=v(!1),ie=v(!1),L=v(null),G=v(""),ye=v(null),d=Ke({name:"",title:"",description:"",tasks:"",knowledge:""}),R=v([]),Y=v([]),oe=v(""),O=v(!1),ue=v(!1),F=v("title"),H=v(""),de=v(!1),Oe=[{target:'[data-tour="agents-actions"]',title:"管理助手",text:"这里用来创建不同用途的助手。写清楚它会什么、学什么资料、常帮你做什么即可。"},{target:'[data-tour="agents-list"]',title:"选择助手",text:"左侧是已有助手。点击后右侧可以查看或编辑它的用途和资料。"},{target:'[data-tour="agents-editor"]',title:"填写四件事",text:"按顺序填写用途、解决的问题、学习资料和常做事项。高级参数可以先不管。"},{target:'[data-tour="agents-save"]',title:"保存和试用",text:"保存后可以设为默认，也可以直接进入对话试用。"}],s=Ke({id:"",name:"",title:"",description:"",domain:"",expertiseLevel:"specialist",tone:"",avatarKey:"logo",accent:"#0071e3",systemPrompt:"",knowledge:{retrievalMode:"auto",maxChunks:5,maxChars:8e3,includeSources:!0},knowledgeRefs:[],skillRefs:[],enabledToolsets:[],disabledTools:[],intakeQuestions:[],workflows:[],outputTemplates:[],guardrails:{},testCases:[],enabled:!0,builtin:!1}),re={mira:Tl,logo:h,vesper:h,...Cl},Ee=[{label:"Lex",value:"mira"},{label:"Aster Logo",value:"logo"},...De],Ne=De,Xe=[{label:"文件",value:"files"},{label:"记忆",value:"memory"},{label:"技能",value:"skills"},{label:"委派",value:"delegation"},{label:"调度",value:"schedule"},{label:"联网搜索",value:"web_search"}],Qe=k(()=>te.value.map(l=>({label:l.name,value:l.id}))),I=k(()=>A.value.find(l=>l.id===U.value)||null),f=k(()=>{var l;return!!((l=I.value)!=null&&l.builtin&&!x.value)}),Ve=k(()=>re[s.avatarKey||"logo"]||h),qe=k(()=>[...A.value.filter(l=>l.builtin),...A.value.filter(l=>!l.builtin)]),ve=k({get:()=>(s.knowledgeRefs||[]).map(l=>[l.type||"file",l.name||"",l.value||"",l.description||""].join(" | ")).join(`
`),set:l=>{s.knowledgeRefs=l.split(`
`).map((e,a)=>{const[u="file",r="",S="",B=""]=e.split("|").map(_=>_.trim());return!r&&!S?null:{id:`knowledge-${a+1}`,type:u||"file",name:r||S,value:S,description:B,enabled:!0}}).filter(Boolean)}}),be=k({get:()=>(s.skillRefs||[]).join(`
`),set:l=>{s.skillRefs=P(l)}}),ke=k({get:()=>(s.disabledTools||[]).join(`
`),set:l=>{s.disabledTools=P(l)}}),xe=k({get:()=>(s.intakeQuestions||[]).join(`
`),set:l=>{s.intakeQuestions=P(l)}}),pe=k({get:()=>{var l,e,a;return((a=(e=(l=s.workflows)==null?void 0:l[0])==null?void 0:e.steps)==null?void 0:a.join(`
`))||""},set:l=>{var e,a,u,r,S,B;s.workflows=[{id:((a=(e=s.workflows)==null?void 0:e[0])==null?void 0:a.id)||"workflow-1",name:((r=(u=s.workflows)==null?void 0:u[0])==null?void 0:r.name)||"默认工作流",description:((B=(S=s.workflows)==null?void 0:S[0])==null?void 0:B.description)||"",steps:P(l)}]}}),Ce=k({get:()=>{var l,e;return((e=(l=s.outputTemplates)==null?void 0:l[0])==null?void 0:e.content)||""},set:l=>{var a;const e=((a=s.outputTemplates)==null?void 0:a[0])||{id:"template-1",name:"默认输出",default:!0};s.outputTemplates=[{...e,content:l}]}}),Te=k({get:()=>{var l,e;return((e=(l=s.guardrails)==null?void 0:l.boundaries)==null?void 0:e.join(`
`))||""},set:l=>{s.guardrails={...s.guardrails||{},boundaries:P(l)}}}),Ae=k({get:()=>{var l;return!!((l=s.guardrails)!=null&&l.requireSources)},set:l=>{s.guardrails={...s.guardrails||{},requireSources:l}}}),Re=k(()=>{var l;return((l=D.value)==null?void 0:l.corpus.documents)||[]}),J=k(()=>{var l;return((l=D.value)==null?void 0:l.index)||null});function Z(l){Object.assign(s,{id:l.id,name:l.name,title:l.title,description:l.description||"",domain:l.domain||"",expertiseLevel:l.expertiseLevel||"specialist",tone:l.tone||"",avatarKey:l.avatarKey||"logo",accent:l.accent||"#0071e3",systemPrompt:l.systemPrompt||"",knowledge:l.knowledge||{retrievalMode:"auto",maxChunks:5,maxChars:8e3,includeSources:!0},knowledgeRefs:l.knowledgeRefs||[],skillRefs:l.skillRefs||[],enabledToolsets:l.enabledToolsets||[],disabledTools:l.disabledTools||[],intakeQuestions:l.intakeQuestions||[],workflows:l.workflows||[],outputTemplates:l.outputTemplates||[],guardrails:l.guardrails||{},testCases:l.testCases||[],enabled:l.enabled!==!1,builtin:!!l.builtin})}async function We(l){le.value=!0;try{const e=await C.agents();A.value=e.agents,$.value=e.defaultId||"aster";const a=l||U.value||$.value;U.value=A.value.some(r=>r.id===a)?a:$.value;const u=I.value||A.value[0];u&&Z(u),u&&Q(u.id),x.value=!1}finally{le.value=!1}}function Ge(l){U.value=l.id,x.value=!1,Z(l),Q(l.id)}function Ye(){Object.assign(d,{name:"",title:"",description:"",tasks:"",knowledge:""}),R.value=[]}function He(){Ye(),j.value=!0}function Je(l){const e=l.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48);return e?`${e}-agent`:`custom-agent-${Date.now().toString(36)}`}function Ze(l){const e=l.target,a=Array.from(e.files||[]),u=new Set(R.value.map(r=>`${r.name}-${r.size}-${r.lastModified}`));R.value=[...R.value,...a.filter(r=>!u.has(`${r.name}-${r.size}-${r.lastModified}`))],e.value=""}function _e(l){R.value=R.value.filter((e,a)=>a!==l)}const he=k(()=>F.value==="title"?"AI 帮填一句话职责":F.value==="description"?"AI 帮填问题说明":"AI 帮填常见任务"),el=k(()=>F.value==="title"?"例如：我想做一个合同审阅助手，主要帮我看付款、违约和保密条款。":F.value==="description"?"例如：我经常要看客户合同，希望它能指出风险、给修改建议，不确定的地方列出来。":"例如：平时让它审合同、按模板起草、把风险整理成清单、提醒我要补充哪些材料。");function me(l){F.value=l,H.value=[d.name,d.title,d.description,d.tasks].filter(e=>e.trim()).join(`
`),O.value=!0}async function ll(){const l=H.value.trim();if(!l){y.warning("先输入一段简单描述");return}ue.value=!0;try{const e=await C.agentAssistFill({target:F.value,brief:l,name:d.name,currentTitle:d.title,currentDescription:d.description,currentTasks:d.tasks});F.value==="title"?d.title=e.title||d.title:F.value==="description"?d.description=e.description||d.description:d.tasks=(e.tasks||[]).join(`
`)||d.tasks,O.value=!1,y.success("AI 已帮你填好")}finally{ue.value=!1}}async function tl(){var B,_;const l=d.name.trim();if(!l){y.warning("先填写助手名称");return}const e=d.title.trim()||`${l}助手`,a=P(d.tasks);N.value=!0;let u;try{u=await C.agentGenerateAdvanced({name:l,title:e,description:d.description,tasks:d.tasks,knowledge:d.knowledge})}catch(T){y.error(T instanceof Error?T.message:"AI 高级配置生成失败");return}finally{N.value=!1}const r=P(d.knowledge).map((T,fe)=>({id:`knowledge-${fe+1}`,name:T.length>28?`${T.slice(0,28)}...`:T,type:T.includes("://")?"url":"text",value:T,description:"新建助手时填写的资料说明",enabled:!0})),S=R.value.map((T,fe)=>({id:`upload-${fe+1}`,name:T.name,type:"file",value:T.name,description:d.knowledge.trim()||"新建助手时选择的资料文件",enabled:!0}));Y.value=[...R.value],oe.value=d.knowledge.trim(),x.value=!0,U.value="",Object.assign(s,{id:Je(l),name:l,title:e,description:d.description.trim(),domain:"custom",expertiseLevel:"specialist",tone:"自定义",avatarKey:Al,accent:"#0071e3",systemPrompt:u.systemPrompt,knowledge:{retrievalMode:"auto",maxChunks:5,maxChars:8e3,includeSources:!0},knowledgeRefs:[...r,...S],skillRefs:[],enabledToolsets:["files","memory","skills"],disabledTools:[],intakeQuestions:(B=u.intakeQuestions)!=null&&B.length?u.intakeQuestions:["这个任务的目标是什么？","有哪些必须参考的资料？","期望输出格式是什么？"],workflows:[{...u.workflow,id:u.workflow.id||"workflow-1",steps:(_=u.workflow.steps)!=null&&_.length?u.workflow.steps:a.length?a:["确认目标和边界","检查知识库和必要材料","执行分析或工具调用","按模板输出结果"]}],outputTemplates:[{...u.outputTemplate,id:u.outputTemplate.id||"template-1",default:!0}],guardrails:u.guardrails||{},testCases:u.testCases||[],enabled:!0,builtin:!1}),X.value="",ae.value="profile",D.value=null,ye.value=null,j.value=!1,u.generatedBy==="template"?y.warning("AI 暂未及时返回，已先用专业模板补齐高级配置"):y.success("已创建新助手草稿，并由 AI 补齐高级配置")}async function al(l){if(!Y.value.length)return;const e=[...Y.value],a=oe.value||void 0;for(const u of e)try{D.value=await C.agentKnowledgeUpload(l,{fileName:u.name,contentBase64:await $e(u),mimeType:u.type||void 0,description:a})}catch(r){throw new Error(`${u.name} 上传失败：${ze(r.message)}`)}Y.value=[],oe.value="",y.success(`已上传 ${e.length} 份资料并完成索引`)}async function sl(){if(!s.id.trim()){y.error("Agent ID 不能为空");return}z.value=!0;try{const l={id:s.id,name:s.name,title:s.title,description:s.description,domain:s.domain,expertiseLevel:s.expertiseLevel,tone:s.tone,avatarKey:s.avatarKey,accent:s.accent,systemPrompt:s.systemPrompt,knowledge:s.knowledge,knowledgeRefs:s.knowledgeRefs,skillRefs:s.skillRefs,enabledToolsets:s.enabledToolsets,disabledTools:s.disabledTools,intakeQuestions:s.intakeQuestions,workflows:s.workflows,outputTemplates:s.outputTemplates,guardrails:s.guardrails,testCases:s.testCases,enabled:s.enabled},e=s.id,a=x.value,u=a?await C.agentCreate(l):await C.agentUpdate(e,l);A.value=u.agents,$.value=u.defaultId,U.value=e,x.value=!1;const r=I.value;r&&Z(r),a&&await al(e),await Q(e),y.success("Agent 已保存")}catch(l){y.error(l.message)}finally{z.value=!1}}async function nl(){if(!(!I.value||I.value.builtin)){z.value=!0;try{const l=await C.agentDelete(I.value.id);A.value=l.agents,$.value=l.defaultId,U.value=l.defaultId;const e=I.value||A.value[0];e&&Z(e),y.success("Agent 已删除")}finally{z.value=!1}}}async function il(l=s.id){z.value=!0;try{const e=await C.agentSetDefault(l);A.value=e.agents,$.value=e.defaultId,y.success("默认 Agent 已更新")}finally{z.value=!1}}function ol(){ce.push({name:"chat",query:{agent:s.id}})}function ul(){return["请帮我把这个 Agent 的高级配置补齐，目标是让普通用户不用理解系统提示词、工具、输出模板和边界规则。","",`助手名称：${s.name||"未填写"}`,`一句话职责：${s.title||"未填写"}`,`主要解决的问题：${s.description||"未填写"}`,`常做事项：
${pe.value||"未填写"}`,`已填写的资料路径或链接：
${ve.value||"未填写"}`,"","请你输出：","1. 更适合保存到“更具体的要求”的系统提示词。","2. 建议启用的工具类型。","3. 建议的输出格式。","4. 必须补问的问题。","5. 不能做或必须提醒的边界。","6. 如果我还需要补充资料，请列出资料清单。","","请用可以直接复制回 Agent 配置页的结构输出。不要讲概念，直接给配置内容。"].join(`
`)}function dl(){ce.push({name:"chat",query:{agent:s.id||U.value||$.value,prefill:ul()}})}async function rl(){te.value=await C.agentTemplates()}function vl(){const l=te.value.find(e=>e.id===X.value);l&&(Object.assign(s,{...s,...l.profile,id:s.id||`${l.id}-agent`,name:s.name&&s.name!=="Custom Agent"?s.name:l.name,builtin:!1,enabled:!0}),ae.value="knowledge",y.success(`已套用 ${l.name} 模板`))}async function Q(l=s.id){if(!(!l||x.value)){se.value=!0;try{D.value=await C.agentKnowledge(l)}finally{se.value=!1}}}function pl(l){var a;const e=l.target;L.value=((a=e.files)==null?void 0:a[0])||null}async function ml(){if(!s.id||!L.value){y.warning("先选择一个文档");return}W.value=!0;try{const l=L.value;D.value=await C.agentKnowledgeUpload(s.id,{fileName:l.name,contentBase64:await $e(l),mimeType:l.type||void 0,description:G.value||void 0}),L.value=null,G.value="",y.success("文档已上传并完成索引")}catch(l){y.error(ze(l.message))}finally{W.value=!1}}function ze(l){return/PDF 文本提取失败|PDF text could not be extracted/i.test(l)?"PDF 文本提取失败：当前只支持文本型 PDF。请先用 OCR 或导出为 Markdown/TXT 后再上传。":/Excel 文本提取失败|XLSX|XLS/i.test(l)?"Excel 文本提取失败：请确认文件未加密，且表格里有可读取的正文数据。也可以先另存为 XLSX 或 CSV 后再上传。":/empty/i.test(l)?"资料上传失败：文件内容为空。请换一个有正文内容的文件。":`资料上传失败：${l}`}async function fl(){if(s.id){ne.value=!0;try{D.value=await C.agentKnowledgeIndex(s.id),y.success("向量索引已重建")}finally{ne.value=!1}}}async function gl(){if(s.id){ie.value=!0;try{ye.value=await C.agentEvaluate(s.id),y.success("评测完成")}finally{ie.value=!1}}}function $e(l){return new Promise((e,a)=>{const u=new FileReader;u.onload=()=>{const r=String(u.result||"");e(r.includes(",")?r.slice(r.indexOf(",")+1):r)},u.onerror=()=>a(u.error||new Error("读取文件失败")),u.readAsDataURL(l)})}function Ue(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/1024/1024).toFixed(1)} MB`}function Ie(l){return l?new Date(l).toLocaleString():"-"}function P(l){return l.split(`
`).map(e=>e.trim()).filter(Boolean)}return wl(()=>{We(),rl()}),yl(ae,l=>{l==="knowledge"&&s.id&&!x.value&&Q(s.id)}),(l,e)=>(m(),b("main",Ol,[t("header",El,[e[40]||(e[40]=t("div",null,[t("h1",null,"智能体 Agent"),t("p",null,"把常用工作拆成不同助手：说明它做什么、学哪些资料、以后主要帮你处理哪些事。")],-1)),i(n($l),null,{default:o(()=>[i(n(c),{secondary:"",onClick:e[0]||(e[0]=a=>de.value=!0)},{icon:o(()=>[i(n(Kl),{size:15})]),default:o(()=>[e[38]||(e[38]=p(" 使用教程 ",-1))]),_:1}),i(n(c),{type:"primary",loading:le.value,onClick:He},{icon:o(()=>[i(n(Fl),{size:15})]),default:o(()=>[e[39]||(e[39]=p(" 新建 ",-1))]),_:1},8,["loading"])]),_:1})]),t("div",Nl,[i(Le,{"data-tour":"agents-list",title:"助手列表",subtitle:"选择一个助手查看配置，或新建一个只服务某类工作的助手。"},{default:o(()=>[t("div",Xl,[(m(!0),b(V,null,q(qe.value,a=>(m(),b("button",{key:a.id,class:Se(["agent-card",{active:a.id===U.value,disabled:a.enabled===!1}]),style:Fe({"--agent-accent":a.accent||"#0071e3"}),type:"button",onClick:u=>Ge(a)},[t("img",{src:re[a.avatarKey||a.id]||n(h),alt:a.name},null,8,Vl),t("span",null,[t("strong",null,w(a.name),1),t("small",null,w(a.title),1)]),a.id===$.value?(m(),M(n(ee),{key:0,size:"small",type:"success"},{default:o(()=>[...e[41]||(e[41]=[p("默认",-1)])]),_:1})):a.builtin?(m(),M(n(ee),{key:1,size:"small"},{default:o(()=>[...e[42]||(e[42]=[p("内置",-1)])]),_:1})):(m(),M(n(ee),{key:2,size:"small",type:"warning"},{default:o(()=>[...e[43]||(e[43]=[p("用户",-1)])]),_:1}))],14,Ql))),128))])]),_:1}),i(Le,{"data-tour":"agents-editor",title:"助手配置",subtitle:f.value?"内置助手只能查看和设为默认。":"不用懂提示词，先把四件事写清楚。"},{default:o(()=>[t("div",ql,[t("div",{class:"agent-preview",style:Fe({"--agent-accent":s.accent||"#0071e3"})},[t("img",{src:Ve.value,alt:s.name},null,8,Wl),t("div",null,[t("strong",null,w(s.name||"Agent"),1),t("small",null,w(s.tone||"Profile"),1)])],4),f.value?K("",!0):(m(),b("div",Gl,[t("div",null,[e[44]||(e[44]=t("label",null,"快速套用模板",-1)),i(n(Be),{value:X.value,"onUpdate:value":e[1]||(e[1]=a=>X.value=a),options:Qe.value,placeholder:"可选：法律、财务、工程等模板"},null,8,["value","options"])]),i(n(c),{secondary:"",disabled:!X.value,onClick:vl},{default:o(()=>[...e[45]||(e[45]=[p("套用模板",-1)])]),_:1},8,["disabled"])])),t("div",Yl,[t("section",Hl,[e[48]||(e[48]=t("div",{class:"simple-section-head"},[t("span",null,"1"),t("div",null,[t("strong",null,"它是干什么的？"),t("small",null,"给这个助手起个名字，用一句话说明它负责什么。")])],-1)),t("div",Jl,[t("div",null,[e[46]||(e[46]=t("label",null,"助手名称",-1)),i(n(g),{value:s.name,"onUpdate:value":e[2]||(e[2]=a=>s.name=a),disabled:f.value,placeholder:"例如：合同审阅助手"},null,8,["value","disabled"])]),t("div",null,[e[47]||(e[47]=t("label",null,"一句话职责",-1)),i(n(g),{value:s.title,"onUpdate:value":e[3]||(e[3]=a=>s.title=a),disabled:f.value,placeholder:"例如：帮我看合同风险和修改建议"},null,8,["value","disabled"])])])]),t("section",Zl,[e[49]||(e[49]=t("div",{class:"simple-section-head"},[t("span",null,"2"),t("div",null,[t("strong",null,"主要帮你解决什么问题？"),t("small",null,"写它适合处理的场景，越像你平时会说的话越好。")])],-1)),i(n(g),{value:s.description,"onUpdate:value":e[4]||(e[4]=a=>s.description=a),disabled:f.value,type:"textarea",autosize:{minRows:4,maxRows:7},placeholder:"例如：帮我检查合同里的付款、违约、保密、交付条款；指出风险，给出修改建议，并把不确定的地方列出来。"},null,8,["value","disabled"])]),t("section",_l,[e[54]||(e[54]=t("div",{class:"simple-section-head"},[t("span",null,"3"),t("div",null,[t("strong",null,"上传希望它学习的资料"),t("small",null,"合同模板、制度文档、产品手册、项目资料都可以。它回答时会优先参考这些内容。")])],-1)),t("div",hl,[t("label",et,[i(n(ge),{size:15}),t("span",null,w(L.value?L.value.name:"选择资料"),1),t("input",{type:"file",accept:n(we),onChange:pl},null,40,lt)]),i(n(g),{value:G.value,"onUpdate:value":e[5]||(e[5]=a=>G.value=a),disabled:W.value,placeholder:"这份资料主要用来做什么，例如：合同模板 / 产品手册"},null,8,["value","disabled"]),i(n(c),{type:"primary",loading:W.value,disabled:x.value||!s.id||!L.value,onClick:ml},{icon:o(()=>[i(n(ge),{size:15})]),default:o(()=>[e[50]||(e[50]=p(" 上传 ",-1))]),_:1},8,["loading","disabled"])]),t("div",tt,[t("div",at,[t("div",null,[e[51]||(e[51]=t("strong",null,"已学习的资料",-1)),J.value?(m(),b("small",st,w(J.value.documentCount)+" 个文档 · "+w(J.value.chunkCount)+" 个片段 · "+w(Ie(J.value.updatedAt)),1)):(m(),b("small",nt,"还没有建立资料索引，上传资料后会自动索引。"))]),i(n(c),{secondary:"",loading:ne.value||se.value,disabled:x.value||!s.id,onClick:fl},{icon:o(()=>[i(n(Sl),{size:15})]),default:o(()=>[e[52]||(e[52]=p(" 重新学习 ",-1))]),_:1},8,["loading","disabled"])]),t("div",it,[Re.value.length===0?(m(),b("div",ot,"还没有上传资料。")):K("",!0),(m(!0),b(V,null,q(Re.value,a=>{var u;return m(),b("div",{key:a.id,class:"doc-row"},[t("div",null,[t("strong",null,w(a.name),1),t("small",null,w(a.versions.length)+" 个版本 · "+w(Ue(((u=a.versions.at(-1))==null?void 0:u.bytes)||0)),1),a.description?(m(),b("small",ut,w(a.description),1)):K("",!0)]),i(n(ee),{size:"small"},{default:o(()=>[p(w(Ie(a.updatedAt)),1)]),_:2},1024)])}),128))])]),t("details",dt,[e[53]||(e[53]=t("summary",null,"也可以填写资料路径或链接",-1)),i(n(g),{value:ve.value,"onUpdate:value":e[6]||(e[6]=a=>ve.value=a),disabled:f.value,type:"textarea",autosize:{minRows:4,maxRows:8},placeholder:`file | 合同模板 | C:\\\\docs\\\\contract.md | 审阅条款
url | 产品文档 | https://example.com/docs | 产品资料`},null,8,["value","disabled"])])]),t("section",rt,[e[55]||(e[55]=t("div",{class:"simple-section-head"},[t("span",null,"4"),t("div",null,[t("strong",null,"以后你可能主要喊它做什么？"),t("small",null,"每行写一件常见任务，它会按这些任务习惯来组织回答。")])],-1)),i(n(g),{value:pe.value,"onUpdate:value":e[7]||(e[7]=a=>pe.value=a),disabled:f.value,type:"textarea",autosize:{minRows:5,maxRows:9},placeholder:`例如：
检查合同风险并列出修改建议
根据公司模板生成一版初稿
把资料整理成待办清单
回答前先确认缺少的信息`},null,8,["value","disabled"])]),t("section",vt,[e[57]||(e[57]=t("div",null,[t("strong",null,"高级配置交给 AI"),t("small",null,"工具、输出格式、边界规则和提示词不需要手动理解。让 AI 根据上面四项生成可复制的配置建议。")],-1)),i(n(c),{type:"primary",disabled:!s.id.trim(),onClick:dl},{icon:o(()=>[i(n(E),{size:15})]),default:o(()=>[e[56]||(e[56]=p(" 让 AI 帮我配置 ",-1))]),_:1},8,["disabled"])]),t("details",pt,[e[74]||(e[74]=t("summary",null,"手动查看高级字段",-1)),t("div",mt,[t("div",ft,[t("div",null,[e[58]||(e[58]=t("label",null,"Agent ID",-1)),i(n(g),{value:s.id,"onUpdate:value":e[8]||(e[8]=a=>s.id=a),disabled:!x.value,placeholder:"custom-agent"},null,8,["value","disabled"])]),t("div",null,[e[59]||(e[59]=t("label",null,"领域",-1)),i(n(g),{value:s.domain,"onUpdate:value":e[9]||(e[9]=a=>s.domain=a),disabled:f.value,placeholder:"legal / finance / engineering"},null,8,["value","disabled"])]),t("div",null,[e[60]||(e[60]=t("label",null,"启用",-1)),i(n(Ul),{value:s.enabled,"onUpdate:value":e[10]||(e[10]=a=>s.enabled=a),disabled:f.value},null,8,["value","disabled"])])]),t("div",gt,[t("div",null,[e[61]||(e[61]=t("label",null,"头像",-1)),i(n(Be),{value:s.avatarKey,"onUpdate:value":e[11]||(e[11]=a=>s.avatarKey=a),disabled:f.value,options:Ee},null,8,["value","disabled"])]),t("div",null,[e[62]||(e[62]=t("label",null,"强调色",-1)),bl(t("input",{"onUpdate:modelValue":e[12]||(e[12]=a=>s.accent=a),disabled:f.value,class:"color-input",type:"text"},null,8,ct),[[kl,s.accent]])]),t("div",null,[e[63]||(e[63]=t("label",null,"风格",-1)),i(n(g),{value:s.tone,"onUpdate:value":e[13]||(e[13]=a=>s.tone=a),disabled:f.value,placeholder:"稳重 / 简洁 / 专业"},null,8,["value","disabled"])])]),f.value?K("",!0):(m(),b("div",wt,[(m(!0),b(V,null,q(n(Ne),a=>(m(),b("button",{key:a.value,type:"button",class:Se(["avatar-choice",{active:s.avatarKey===a.value}]),onClick:u=>s.avatarKey=a.value},[t("img",{src:re[a.value],alt:a.label},null,8,bt),t("span",null,w(a.label),1)],10,yt))),128))])),e[67]||(e[67]=t("label",null,"更具体的要求",-1)),i(n(g),{value:s.systemPrompt,"onUpdate:value":e[14]||(e[14]=a=>s.systemPrompt=a),disabled:f.value,type:"textarea",autosize:{minRows:4,maxRows:8},placeholder:"可选。写判断原则、输出偏好、不能做什么。"},null,8,["value","disabled"]),e[68]||(e[68]=t("label",null,"开始前需要问你的问题",-1)),i(n(g),{value:xe.value,"onUpdate:value":e[15]||(e[15]=a=>xe.value=a),disabled:f.value,type:"textarea",autosize:{minRows:3,maxRows:6},placeholder:"每行一个问题，例如：这次输出给谁看？有没有必须使用的模板？"},null,8,["value","disabled"]),e[69]||(e[69]=t("label",null,"绑定技能",-1)),i(n(g),{value:be.value,"onUpdate:value":e[16]||(e[16]=a=>be.value=a),disabled:f.value,type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:"每行一个 skill 名称，例如 contract-review"},null,8,["value","disabled"]),e[70]||(e[70]=t("label",null,"允许使用的工具",-1)),i(n(Il),{value:s.enabledToolsets,"onUpdate:value":e[17]||(e[17]=a=>s.enabledToolsets=a),disabled:f.value},{default:o(()=>[t("div",kt,[(m(),b(V,null,q(Xe,a=>i(n(Me),{key:a.value,value:a.value},{default:o(()=>[p(w(a.label),1)]),_:2},1032,["value"])),64))])]),_:1},8,["value","disabled"]),e[71]||(e[71]=t("label",null,"禁用具体工具名",-1)),i(n(g),{value:ke.value,"onUpdate:value":e[18]||(e[18]=a=>ke.value=a),disabled:f.value,type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:"每行一个工具名，例如 write_file"},null,8,["value","disabled"]),e[72]||(e[72]=t("label",null,"输出格式",-1)),i(n(g),{value:Ce.value,"onUpdate:value":e[19]||(e[19]=a=>Ce.value=a),disabled:f.value,type:"textarea",autosize:{minRows:4,maxRows:8},placeholder:`## 结论

## 依据

## 下一步`},null,8,["value","disabled"]),t("label",xt,[i(n(Me),{checked:Ae.value,"onUpdate:checked":e[20]||(e[20]=a=>Ae.value=a),disabled:f.value},null,8,["checked","disabled"]),e[64]||(e[64]=p("重要判断尽量给出依据",-1))]),e[73]||(e[73]=t("label",null,"不能做或必须提醒的事",-1)),i(n(g),{value:Te.value,"onUpdate:value":e[21]||(e[21]=a=>Te.value=a),disabled:f.value,type:"textarea",autosize:{minRows:3,maxRows:6},placeholder:"例如：不要编造资料；信息不足时先问；高风险事项提醒人工复核。"},null,8,["value","disabled"]),t("div",Ct,[i(n(c),{type:"primary",loading:ie.value,disabled:x.value||!s.id,onClick:gl},{icon:o(()=>[i(n(Dl),{size:15})]),default:o(()=>[e[65]||(e[65]=p(" 试跑 ",-1))]),_:1},8,["loading","disabled"]),i(n(c),{secondary:"",disabled:x.value||!s.id,onClick:e[22]||(e[22]=a=>Q(s.id))},{icon:o(()=>[i(n(Ll),{size:15})]),default:o(()=>[e[66]||(e[66]=p(" 刷新资料状态 ",-1))]),_:1},8,["disabled"])])])])]),t("div",Tt,[i(n(c),{secondary:"",disabled:s.id===$.value,loading:z.value,onClick:e[23]||(e[23]=a=>il())},{icon:o(()=>[i(n(Pl),{size:15})]),default:o(()=>[e[75]||(e[75]=p(" 设为默认 ",-1))]),_:1},8,["disabled","loading"]),i(n(c),{secondary:"",disabled:!s.id.trim(),onClick:ol},{icon:o(()=>[i(n(Bl),{size:15})]),default:o(()=>[e[76]||(e[76]=p(" 对话 ",-1))]),_:1},8,["disabled"]),f.value?K("",!0):(m(),M(n(c),{key:0,type:"primary",loading:z.value,onClick:sl},{icon:o(()=>[i(n(Ml),{size:15})]),default:o(()=>[e[77]||(e[77]=p(" 保存 ",-1))]),_:1},8,["loading"])),I.value&&!I.value.builtin&&!x.value?(m(),M(n(c),{key:1,tertiary:"",type:"error",loading:z.value,onClick:nl},{icon:o(()=>[i(n(je),{size:15})]),default:o(()=>[e[78]||(e[78]=p(" 删除 ",-1))]),_:1},8,["loading"])):K("",!0)])])]),_:1},8,["subtitle"])]),j.value?(m(),M(n(Pe),{key:0,show:j.value,"onUpdate:show":e[33]||(e[33]=a=>j.value=a),preset:"card",title:"新建助手",style:{width:"min(680px, calc(100vw - 32px))"}},{footer:o(()=>[t("div",Pt,[i(n(c),{disabled:N.value,onClick:e[32]||(e[32]=a=>j.value=!1)},{default:o(()=>[...e[93]||(e[93]=[p("取消",-1)])]),_:1},8,["disabled"]),i(n(c),{type:"primary",loading:N.value,onClick:tl},{icon:o(()=>[i(n(E),{size:15})]),default:o(()=>[p(" "+w(N.value?"AI 正在配置":"创建草稿"),1)]),_:1},8,["loading"])])]),default:o(()=>[t("div",At,[t("section",null,[e[82]||(e[82]=t("div",{class:"create-step"},[t("span",null,"1"),t("div",null,[t("strong",null,"它是干什么的？"),t("small",null,"先填名称和一句话职责，用户一眼就能知道该找它做什么。")])],-1)),t("div",Rt,[t("div",null,[e[79]||(e[79]=t("label",null,"助手名称",-1)),i(n(g),{value:d.name,"onUpdate:value":e[24]||(e[24]=a=>d.name=a),placeholder:"例如：合同审阅助手"},null,8,["value"])]),t("div",null,[t("div",zt,[e[81]||(e[81]=t("label",null,"一句话职责",-1)),i(n(c),{size:"tiny",tertiary:"",type:"primary",onClick:e[25]||(e[25]=a=>me("title"))},{icon:o(()=>[i(n(E),{size:13})]),default:o(()=>[e[80]||(e[80]=p(" AI 帮填 ",-1))]),_:1})]),i(n(g),{value:d.title,"onUpdate:value":e[26]||(e[26]=a=>d.title=a),placeholder:"例如：帮我看合同风险和修改建议"},null,8,["value"])])])]),t("section",null,[t("div",$t,[e[86]||(e[86]=t("span",null,"2",-1)),t("div",null,[t("div",Ut,[e[84]||(e[84]=t("strong",null,"主要解决什么问题？",-1)),i(n(c),{size:"tiny",tertiary:"",type:"primary",onClick:e[27]||(e[27]=a=>me("description"))},{icon:o(()=>[i(n(E),{size:13})]),default:o(()=>[e[83]||(e[83]=p(" AI 帮填 ",-1))]),_:1})]),e[85]||(e[85]=t("small",null,"用自然语言写，不需要懂 Agent 或提示词。",-1))])]),i(n(g),{value:d.description,"onUpdate:value":e[28]||(e[28]=a=>d.description=a),type:"textarea",autosize:{minRows:3,maxRows:5},placeholder:"例如：帮我检查合同里的付款、违约、保密、交付条款；指出风险，给出修改建议，并把不确定的地方列出来。"},null,8,["value"])]),t("section",null,[e[88]||(e[88]=t("div",{class:"create-step"},[t("span",null,"3"),t("div",null,[t("strong",null,"希望它学习什么资料？"),t("small",null,"直接上传文件。保存新助手时会自动导入资料库。")])],-1)),t("div",It,[t("label",Kt,[i(n(ge),{size:18}),t("span",null,[e[87]||(e[87]=t("strong",null,"选择资料文件",-1)),t("small",null,w(jt))]),t("input",{type:"file",multiple:"",accept:n(we),onChange:Ze},null,40,Ft)]),R.value.length?(m(),b("div",St,[(m(!0),b(V,null,q(R.value,(a,u)=>(m(),b("div",{key:`${a.name}-${a.size}-${a.lastModified}`,class:"create-file-row"},[t("div",null,[t("strong",null,w(a.name),1),t("small",null,w(Ue(a.size)),1)]),i(n(c),{quaternary:"",circle:"",type:"error",onClick:r=>_e(u)},{icon:o(()=>[i(n(je),{size:15})]),_:1},8,["onClick"])]))),128))])):K("",!0),i(n(g),{value:d.knowledge,"onUpdate:value":e[29]||(e[29]=a=>d.knowledge=a),type:"textarea",autosize:{minRows:2,maxRows:4},placeholder:"可选：说明这些资料主要用来做什么，也可以补充链接或路径。"},null,8,["value"])])]),t("section",null,[t("div",Dt,[e[92]||(e[92]=t("span",null,"4",-1)),t("div",null,[t("div",Lt,[e[90]||(e[90]=t("strong",null,"以后主要喊它做什么？",-1)),i(n(c),{size:"tiny",tertiary:"",type:"primary",onClick:e[30]||(e[30]=a=>me("tasks"))},{icon:o(()=>[i(n(E),{size:13})]),default:o(()=>[e[89]||(e[89]=p(" AI 帮填 ",-1))]),_:1})]),e[91]||(e[91]=t("small",null,"每行写一件常见任务，后面 AI 会据此帮你补齐高级配置。",-1))])]),i(n(g),{value:d.tasks,"onUpdate:value":e[31]||(e[31]=a=>d.tasks=a),type:"textarea",autosize:{minRows:4,maxRows:7},placeholder:`例如：
检查合同风险并列出修改建议
根据公司模板生成一版初稿
把资料整理成待办清单`},null,8,["value"])])])]),_:1},8,["show"])):K("",!0),O.value?(m(),M(n(Pe),{key:1,show:O.value,"onUpdate:show":e[36]||(e[36]=a=>O.value=a),preset:"card",title:he.value,style:{width:"min(560px, calc(100vw - 32px))"}},{footer:o(()=>[t("div",Mt,[i(n(c),{onClick:e[35]||(e[35]=a=>O.value=!1)},{default:o(()=>[...e[95]||(e[95]=[p("取消",-1)])]),_:1}),i(n(c),{type:"primary",loading:ue.value,onClick:ll},{icon:o(()=>[i(n(E),{size:15})]),default:o(()=>[e[96]||(e[96]=p(" 生成并填入 ",-1))]),_:1},8,["loading"])])]),default:o(()=>[t("div",Bt,[e[94]||(e[94]=t("p",null,"随便写一段你的想法，AI 会把它整理成当前字段。",-1)),i(n(g),{value:H.value,"onUpdate:value":e[34]||(e[34]=a=>H.value=a),type:"textarea",autosize:{minRows:5,maxRows:8},placeholder:el.value},null,8,["value","placeholder"])])]),_:1},8,["show","title"])):K("",!0),i(Rl,{show:de.value,"onUpdate:show":e[37]||(e[37]=a=>de.value=a),steps:Oe,"title-id":"agentsTourTitle"},null,8,["show"])]))}}),Jt=jl(Ot,[["__scopeId","data-v-929dba23"]]);export{Jt as default};
