@customize-agent/server 4.0.19 → 4.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +6 -6
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/chunks/3328.js +5 -2
  5. package/.next/server/chunks/3445.js +1 -1
  6. package/.next/server/chunks/8204.js +1 -1
  7. package/.next/server/middleware-build-manifest.js +1 -1
  8. package/.next/server/pages/404.html +1 -1
  9. package/.next/server/pages/500.html +1 -1
  10. package/.next/server/pages/api/kb/files/search.js +2 -0
  11. package/.next/server/pages/api/kb/files/search.js.nft.json +1 -0
  12. package/.next/server/pages/api/kb/files.js +1 -1
  13. package/.next/server/pages/asset-library.html +1 -1
  14. package/.next/server/pages/context/long-term.html +1 -1
  15. package/.next/server/pages/context/short-term.html +1 -1
  16. package/.next/server/pages/document-roles.html +1 -1
  17. package/.next/server/pages/document-specs.html +1 -1
  18. package/.next/server/pages/documents.html +1 -1
  19. package/.next/server/pages/guide.html +1 -1
  20. package/.next/server/pages/index.html +1 -1
  21. package/.next/server/pages/knowledge/file-detail.html +1 -1
  22. package/.next/server/pages/knowledge/files.html +1 -1
  23. package/.next/server/pages/knowledge/manage.html +1 -1
  24. package/.next/server/pages/knowledge/search.html +1 -1
  25. package/.next/server/pages/knowledge.html +1 -1
  26. package/.next/server/pages/models.html +1 -1
  27. package/.next/server/pages/overview.html +1 -1
  28. package/.next/server/pages/prompt.html +1 -1
  29. package/.next/server/pages/settings.html +1 -1
  30. package/.next/server/pages/system/logs.html +1 -1
  31. package/.next/server/pages-manifest.json +23 -22
  32. package/.next/static/chunks/pages/{_app-8872f79a787469b6.js → _app-5a15b88340356365.js} +1 -1
  33. package/.next/static/chunks/pages/document-roles-4be647d475d4674b.js +1 -0
  34. package/.next/static/chunks/pages/knowledge/search-afb423fc22eb623b.js +1 -0
  35. package/.next/static/chunks/pages/prompt-714b161b79fcd454.js +1 -0
  36. package/.next/static/{L8VozJMjOhfyjhAlVliVF → wOvN42gzNHJoWogcCE5R4}/_buildManifest.js +1 -1
  37. package/package.json +1 -1
  38. package/.next/static/chunks/pages/document-roles-7197641736843503.js +0 -1
  39. package/.next/static/chunks/pages/knowledge/search-2cee4e8b8792170c.js +0 -1
  40. package/.next/static/chunks/pages/prompt-3be228b7b80373ca.js +0 -1
  41. /package/.next/static/{L8VozJMjOhfyjhAlVliVF → wOvN42gzNHJoWogcCE5R4}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>K});var l=r(65321),o=r(97109),i=r(79059),n=r(17807),a=r(33442),s=r(11702),c=r(56985),d=r(85114),p=r(26171),h=r(68787),u=r(88762),m=r(7576),x=r(57271),y=r(49292),f=r(55122),g=r(84253),j=r(34052),v=r(42700),w=r(54746),S=r(99650),b=r(58209),A=r(26631),C=r(29606),k=r(96091),z=r(81668),T=r(30486),N=r(46082),F=r(42758),B=r(24810),E=r(7492);async function I(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function P(e,t,r){let l=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!l.ok)throw Error("Failed");return l.json()}async function R(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function O(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function W(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}async function D(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"import",...e&&"object"==typeof e?e:{prompts:[]}})});if(!t.ok)throw Error(await t.text());return t.json()}async function H(){return J("",!1,60)}async function _(e){let t=await fetch("/api/kb/files/detail?relativePath=".concat(encodeURIComponent(e)));if(!t.ok)throw Error("Failed");return((await t.json()).chunks||[]).map(e=>e.content||"").filter(Boolean).join("\n\n").slice(0,12e3)}async function J(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,l=new URLSearchParams({limit:String(r)});e.trim()&&l.set("q",e.trim()),t||l.set("includeContent","0");let o=await fetch("/api/kb/files/search?".concat(l));return o.ok&&(await o.json()).files||[]}async function L(e){let t=await fetch("/api/prompt/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);throw Error(t.error||t.message||e||"AI 对话失败")}catch(t){throw Error(e||"AI 对话失败")}}return t.json()}function M(e){return e.id.startsWith("builtin:")}function U(e){return e.id.startsWith("custom:")}function $(e){return M(e)?"builtin":U(e)?"custom":e.isCurrent?"current":"project"}function G(e){return"custom"===e?"我的提示词":"current"===e?"当前项目":"project"===e?"其他项目":"builtin"===e?"内置示例":"全部"}function X(e,t,r){return e?"customize-agent:prompt-chat:".concat(e.id,":").concat(e.customizePath||e.projectName):"customize-agent:prompt-chat:draft:".concat(r||t||"new")}function Y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:220,r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return r.length>t?"".concat(r.slice(0,t),"..."):r}function Z(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function q(e){let t=e.match(/(^|\s)@([^\s@]*)$/);return t?t[2]:null}function K(){let e=(0,i.Vr)(),{message:t}=n.A.useApp(),[r,K]=(0,o.useState)(!0),[V,Q]=(0,o.useState)([]),[ee,et]=(0,o.useState)(!1),[er,el]=(0,o.useState)(null),[eo,ei]=(0,o.useState)(""),[en,ea]=(0,o.useState)(""),[es,ec]=(0,o.useState)(!1),[ed,ep]=(0,o.useState)(!1),[eh,eu]=(0,o.useState)("custom"),[em,ex]=(0,o.useState)("all"),[ey,ef]=(0,o.useState)("mtime"),[eg,ej]=(0,o.useState)("list"),[ev,ew]=(0,o.useState)(""),[eS,eb]=(0,o.useState)(null),[eA,eC]=(0,o.useState)([]),[ek,ez]=(0,o.useState)(!1),[eT,eN]=(0,o.useState)([]),[eF,eB]=(0,o.useState)(""),[eE,eI]=(0,o.useState)(""),[eP,eR]=(0,o.useState)(!1),[eO,eW]=(0,o.useState)([]),[eD,eH]=(0,o.useState)([]),[e_,eJ]=(0,o.useState)([]),[eL,eM]=(0,o.useState)(!1),[eU,e$]=(0,o.useState)(!1),[eG,eX]=(0,o.useState)(!1),eY=(0,o.useRef)(null),eZ=(0,o.useRef)(null),eq=q(eE),eK=async()=>{K(!0);try{Q(await I())}catch(r){t.error(e("common.error"))}finally{K(!1)}};(0,o.useEffect)(()=>{eK()},[]),(0,o.useEffect)(()=>{let e=window.localStorage.getItem("customize-agent:prompt-view-mode");("list"===e||"card"===e)&&ej(e)},[]),(0,o.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",eg)},[eg]),(0,o.useEffect)(()=>{let e=eZ.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),eF&&window.localStorage.setItem(eF,JSON.stringify(eT.slice(-30)))},[eT,eP,eF]),(0,o.useEffect)(()=>{!ee||eO.length>0||eL||(eM(!0),H().then(eW).catch(()=>void 0).finally(()=>eM(!1)))},[ee,eO.length,eL]),(0,o.useEffect)(()=>{let e=null==eq?void 0:eq.trim();if(!ee||!e){eH([]),e$(!1);return}let t=!1;e$(!0);let r=window.setTimeout(()=>{J(e).then(e=>{t||eH(e)}).catch(()=>{t||eH([])}).finally(()=>{t||e$(!1)})},250);return()=>{t=!0,window.clearTimeout(r)}},[ee,eq]);let eV=V.find(e=>e.isCurrent),eQ=V.filter(U),e0={all:V.length,custom:V.filter(e=>"custom"===$(e)).length,current:V.filter(e=>"current"===$(e)).length,project:V.filter(e=>"project"===$(e)).length,builtin:V.filter(e=>"builtin"===$(e)).length,selected:V.filter(e=>e.selected).length,unselected:V.filter(e=>!e.selected).length,hasFile:V.filter(e=>e.hasFile).length,missingFile:V.filter(e=>!e.hasFile).length},e1=V.filter(e=>{var t;let r=$(e);return("all"===eh||r===eh)&&("selected"!==em||!!e.selected)&&("unselected"!==em||!e.selected)&&("hasFile"!==em||!!e.hasFile)&&("missingFile"!==em||!e.hasFile)&&(!ev.trim()||(t=ev.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===ey?e.projectName.localeCompare(t.projectName):"source"===ey?["custom","current","project","builtin"].indexOf($(e))-["custom","current","project","builtin"].indexOf($(t)):"selected"===ey&&Number(t.selected)-Number(e.selected)||Date.parse(t.mtime||"")-Date.parse(e.mtime||"")),e2=e1.find(e=>e.id===eS)||e1[0]||null,e8=eA.filter(e=>e1.some(t=>t.id===e)),e4=(null==eq?void 0:eq.trim())?eD:eO,e6=(e,t,r)=>{let l=X(e,t,r);eB(l),eN(function(e){try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");return Array.isArray(t)?t.filter(e=>("user"===e.role||"assistant"===e.role)&&"string"==typeof e.content).slice(-30):[]}catch(e){return[]}}(l)),eI(""),eR(!1),eJ([]),eX(!1)},e7=r=>{if(null==r?void 0:r.projectRoot)return void R(r.projectRoot).then(()=>{t.success(e("common.success")),eK()}).catch(()=>t.error(e("common.error")));let l="new:".concat(Date.now());el(null),ep(!0),ea(""),ei(""),e6(null,"new",l),et(!0)},e3=async()=>{if(!en.trim())return void t.error("请输入名称");ec(!0);try{if(er)await P(er.customizePath,eo,U(er)?en.trim():void 0),t.success(e("common.success"));else{let r=await O(en.trim(),eo||"# ".concat(en.trim(),"\n"));!function(e,t){if(!e||!t||e===t)return;let r=window.localStorage.getItem(e);r&&!window.localStorage.getItem(t)&&window.localStorage.setItem(t,r)}(eF,X({id:r.id,projectId:r.id,projectName:en.trim(),customizePath:r.id,content:eo,mtime:"",hasFile:!0,isCurrent:!1,selected:!1,source:"custom"},en.trim())),t.success(e("common.success"))}et(!1),await eK()}catch(r){t.error(e("common.error"))}finally{ec(!1)}},e5=async e=>{let t=Array.from(new Set([...e_,...eO.filter(t=>e.includes("@".concat(t.relativePath))).map(e=>e.relativePath)])).slice(0,3),r=[];for(let e of t){let t=await _(e);t&&r.push({relativePath:e,content:t})}return r},e9=async()=>{let e=eE.trim();if(!e||eP)return;let r=[...eT,{role:"user",content:e}];eN(r),eI(""),eX(!1),eR(!0);try{let t=await e5(e),l=await L({name:en||(null==er?void 0:er.projectName)||"未命名提示词",content:eo,message:e,history:eT,references:t});eN([...r,{role:"assistant",content:l.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),eN(r)}finally{eR(!1)}},te=async(r,l)=>{let o=l?Array.from(new Set([...V.filter(e=>e.selected).map(e=>e.id),r.id])):V.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await W(o),Q(e=>e.map(e=>({...e,selected:o.includes(e.id)})))}catch(r){t.error(e("common.error"))}},tt=async r=>{let l=V.filter(e=>e.selected).map(e=>e.id),o=r?Array.from(new Set([...l,...e8])):l.filter(e=>!e8.includes(e));try{await W(o),Q(e=>e.map(e=>({...e,selected:o.includes(e.id)}))),eC([]),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tr=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),eC(e=>e.filter(e=>e!==r.id)),await eK()}catch(r){t.error(e("common.error"))}},tl=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"custom",r="checked"===e?V.filter(e=>e8.includes(e.id)):"filtered"===e?e1:eQ;!function(e,t){let r=new Blob([t],{type:"text/plain;charset=utf-8"}),l=URL.createObjectURL(r),o=document.createElement("a");o.href=l,o.download=e,o.click(),URL.revokeObjectURL(l)}("customize-prompts-".concat(new Date().toISOString().slice(0,10),".txt"),r.map(e=>["# Prompt: ".concat(e.projectName),"Source: ".concat(G($(e))),"Path: ".concat(e.customizePath||"-"),"Project: ".concat(e.projectRoot||"-"),"Selected: ".concat(e.selected?"true":"false"),"Updated: ".concat(Z(e.mtime)),"",e.content||""].join("\n")).join("\n\n---\n\n")),t.success("已导出 ".concat(r.length," 条提示词"))},to=async e=>{if(e){ez(!0);try{let r=await e.text(),l=JSON.parse(r),o=await D(l);t.success("已导入 ".concat(o.imported," 条提示词")),await eK()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{ez(!1),eY.current&&(eY.current.value="")}}},ti=e=>{let t=$(e);return(0,l.jsxs)(a.A,{size:4,wrap:!0,children:[(0,l.jsx)(s.A,{color:"custom"===t?"cyan":"current"===t?"green":"project"===t?"blue":"builtin"===t?"gold":"default",style:{margin:0},children:G(t)}),e.selected&&(0,l.jsx)(s.A,{color:"purple",style:{margin:0},children:"已选中"}),!e.hasFile&&(0,l.jsx)(s.A,{style:{margin:0},children:"无文件"})]})},tn=e=>(0,l.jsxs)(a.A,{size:6,children:[e.hasFile&&(0,l.jsx)(c.A,{checked:e.selected,onChange:t=>{te(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(w.A,{}),onClick:()=>e7(e),children:"创建"}),e.hasFile&&(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(S.A,{}),onClick:()=>(e=>{if(M(e)){let r=e.projectName.replace(/^内置|/,"")+" Copy",l="copy:".concat(e.id,":").concat(e.customizePath||e.projectName);el(null),ep(!0),ea(r),ei(e.content||""),e6(null,r,l),et(!0),t.info("内置提示词不可直接编辑,已为你创建副本");return}el(e),ep(!1),ea(e.projectName),ei(e.content||""),e6(e,e.projectName),et(!0)})(e),children:M(e)?"复制":"编辑"}),(0,l.jsx)(p.A,{title:M(e)?"删除内置提示词?":U(e)?"删除自定义提示词?":"删除项目记录及文件?",disabled:M(e),onConfirm:()=>{tr(e)},children:(0,l.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(b.A,{}),disabled:M(e)})})]});return r?(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsx)(u.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,l.jsx)(h.A,{size:"small",children:(0,l.jsx)(u.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,l.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,l.jsxs)(a.A,{wrap:!0,children:[eV&&(0,l.jsxs)(s.A,{color:"green",style:{lineHeight:"22px"},children:[(0,l.jsx)(C.A,{})," ",eV.projectRoot]}),(0,l.jsx)("input",{ref:eY,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;to(null==(t=e.target.files)?void 0:t[0])}}),(0,l.jsx)(d.Ay,{icon:(0,l.jsx)(k.A,{}),loading:ek,onClick:()=>{var e;return null==(e=eY.current)?void 0:e.click()},children:"导入"}),(0,l.jsx)(d.Ay,{icon:(0,l.jsx)(z.A,{}),disabled:0===e1.length,onClick:()=>tl("filtered"),children:"导出筛选"}),(0,l.jsx)(d.Ay,{type:"primary",icon:(0,l.jsx)(w.A,{}),onClick:()=>e7(),children:"创建提示词"})]})]}),(0,l.jsxs)(h.A,{size:"small",styles:{body:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"}},children:[(0,l.jsx)(m.A,{prefix:(0,l.jsx)(T.A,{}),allowClear:!0,placeholder:"搜索名称、内容、路径...",value:ev,onChange:e=>ew(e.target.value),style:{width:280}}),(0,l.jsx)(x.A,{value:eh,onChange:eu,style:{width:150},options:[{label:"全部 (".concat(e0.all,")"),value:"all"},{label:"我的提示词 (".concat(e0.custom,")"),value:"custom"},{label:"当前项目 (".concat(e0.current,")"),value:"current"},{label:"其他项目 (".concat(e0.project,")"),value:"project"},{label:"内置示例 (".concat(e0.builtin,")"),value:"builtin"}]}),(0,l.jsx)(x.A,{value:em,onChange:ex,style:{width:130},options:[{label:"全部状态",value:"all"},{label:"已选中 (".concat(e0.selected,")"),value:"selected"},{label:"未选中 (".concat(e0.unselected,")"),value:"unselected"},{label:"有文件 (".concat(e0.hasFile,")"),value:"hasFile"},{label:"无文件 (".concat(e0.missingFile,")"),value:"missingFile"}]}),(0,l.jsx)(x.A,{value:ey,onChange:ef,style:{width:140},options:[{label:"最近修改优先",value:"mtime"},{label:"名称 A-Z",value:"name"},{label:"来源优先",value:"source"},{label:"已选中优先",value:"selected"}]}),(0,l.jsx)(y.A,{value:eg,onChange:e=>ej(e),options:[{label:(0,l.jsx)(N.A,{}),value:"list"},{label:(0,l.jsx)(F.A,{}),value:"card"}]}),(0,l.jsx)("div",{style:{flex:1}}),(0,l.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:13},children:["已显示 ",e1.length," / ",V.length]})]}),(0,l.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"190px minmax(0, 1fr) 300px",gap:14,alignItems:"start"},children:[(0,l.jsxs)(h.A,{size:"small",title:"分组导航",styles:{body:{padding:8}},children:[[["all","全部",e0.all],["custom","我的提示词",e0.custom],["current","当前项目",e0.current],["project","其他项目",e0.project],["builtin","内置示例",e0.builtin]].map(e=>{let[t,r,o]=e;return(0,l.jsxs)("button",{onClick:()=>eu(t),style:{width:"100%",border:"none",background:eh===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:eh===t?700:400},children:[(0,l.jsx)("span",{children:r}),(0,l.jsx)("span",{children:o})]},t)}),(0,l.jsx)(f.A,{style:{margin:"8px 0"}}),[["selected","已选中",e0.selected],["unselected","未选中",e0.unselected]].map(e=>{let[t,r,o]=e;return(0,l.jsxs)("button",{onClick:()=>ex(em===t?"all":t),style:{width:"100%",border:"none",background:em===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:em===t?700:400},children:[(0,l.jsx)("span",{children:r}),(0,l.jsx)("span",{children:o})]},t)})]}),(0,l.jsxs)("div",{style:{minWidth:0},children:[e8.length>0&&(0,l.jsxs)(h.A,{size:"small",style:{marginBottom:12},styles:{body:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},children:[(0,l.jsxs)("span",{style:{fontWeight:600},children:["已选择 ",e8.length," 项"]}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>{tt(!0)},children:"批量选中"}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>{tt(!1)},children:"取消选中"}),(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(z.A,{}),onClick:()=>tl("checked"),children:"导出选中"}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>eC([]),children:"清空选择"})]}),0===e1.length?(0,l.jsx)(h.A,{children:(0,l.jsx)(g.A,{description:ev||"all"!==em?"没有找到匹配的提示词,请尝试更换关键词或清空筛选条件":"当前分组没有提示词"})}):"list"===eg?(0,l.jsx)(a.A,{direction:"vertical",size:10,style:{width:"100%"},children:e1.map(e=>{let t=Y(e,180),r=(null==e2?void 0:e2.id)===e.id;return(0,l.jsxs)("div",{onClick:()=>eb(e.id),style:{display:"grid",gridTemplateColumns:"28px minmax(0, 1fr) auto",gap:12,alignItems:"center",padding:14,border:"1px solid ".concat(r?"var(--colorAccent)":"var(--colorBorderSecondary)"),borderRadius:12,background:r?"var(--colorFillSecondary)":"var(--colorBgContainer)",cursor:"pointer",transition:"all .2s ease"},children:[(0,l.jsx)(c.A,{checked:eA.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eC(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,l.jsxs)("div",{style:{minWidth:0},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,l.jsx)(A.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.projectName}),ti(e)]}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:6*!!t},children:[(0,l.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"," \xb7 ",Z(e.mtime)]}),t&&(0,l.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap"},children:t})]}),(0,l.jsx)("div",{onClick:e=>e.stopPropagation(),children:tn(e)})]},e.id)})}):(0,l.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:12},children:e1.map(e=>{let t=Y(e,180),r=(null==e2?void 0:e2.id)===e.id;return(0,l.jsxs)(h.A,{size:"small",hoverable:!0,onClick:()=>eb(e.id),style:{borderColor:r?"var(--colorAccent)":void 0},styles:{body:{display:"flex",flexDirection:"column",minHeight:210}},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,l.jsx)(c.A,{checked:eA.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eC(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,l.jsx)(A.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName})]}),(0,l.jsx)("div",{style:{marginBottom:8},children:ti(e)}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:[(0,l.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,l.jsx)("div",{style:{padding:10,background:"var(--colorFillAlter)",borderRadius:8,color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,minHeight:72,maxHeight:72,overflow:"hidden",whiteSpace:"pre-wrap"},children:t||"暂无内容预览"}),(0,l.jsxs)("div",{style:{marginTop:"auto",paddingTop:10,borderTop:"1px solid var(--colorBorderSecondary)",display:"flex",justifyContent:"space-between",alignItems:"center"},onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:Z(e.mtime)}),tn(e)]})]},e.id)})})]}),(0,l.jsx)(h.A,{size:"small",title:"详情预览",styles:{body:{display:"flex",flexDirection:"column",gap:10}},children:e2?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,l.jsx)(A.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)("strong",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:e2.projectName})]}),(0,l.jsx)("div",{children:ti(e2)}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7},children:[(0,l.jsxs)("div",{children:["更新时间:",Z(e2.mtime)]}),(0,l.jsxs)("div",{children:["文件路径:",e2.customizePath||"-"]}),(0,l.jsxs)("div",{children:["项目路径:",e2.projectRoot||"-"]})]}),(0,l.jsx)("div",{style:{padding:10,borderRadius:8,background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,maxHeight:260,overflow:"auto",whiteSpace:"pre-wrap"},children:Y(e2,1200)||"暂无内容预览"}),(0,l.jsx)("div",{children:tn(e2)})]}):(0,l.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"请选择一个提示词"})})]}),(0,l.jsxs)(j.A,{title:ed?"创建提示词":er&&U(er)?"编辑我的提示词 — ".concat(en||er.projectName):"编辑项目提示词 — ".concat((null==er?void 0:er.projectName)||""),open:ee,onClose:()=>et(!1),width:980,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:14,height:"100%"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.Ay,{onClick:()=>et(!1),children:e("common.cancel")}),(0,l.jsx)(d.Ay,{type:"primary",loading:es,onClick:()=>{e3()},children:e("common.save")})]}),children:[(0,l.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,l.jsx)("div",{style:{marginBottom:12},children:ed||er&&U(er)?(0,l.jsxs)(a.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsx)(m.A,{placeholder:"提示词名称",value:en,onChange:e=>ea(e.target.value),style:{maxWidth:520}}),!ed&&(0,l.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==er?void 0:er.customizePath})]}):(0,l.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==er?void 0:er.customizePath})}),(0,l.jsx)(m.A.TextArea,{value:eo,onChange:e=>ei(e.target.value),style:{flex:1,minHeight:280,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}})]}),(0,l.jsxs)("div",{style:{minHeight:0,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 8px 24px rgba(15, 23, 42, 0.06)"},children:[(0,l.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,l.jsxs)(a.A,{size:6,children:[(0,l.jsx)(B.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:600},children:"AI 提示词助手"})]}),(0,l.jsxs)(a.A,{size:6,children:[eT.length>0&&(0,l.jsx)(d.Ay,{size:"small",onClick:()=>eN([]),children:"清空历史"}),eP?(0,l.jsx)(s.A,{color:"processing",style:{margin:0},children:"生成中"}):(0,l.jsx)(s.A,{color:"blue",style:{margin:0},children:"可对话优化"})]})]}),(0,l.jsx)("div",{ref:eZ,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==eT.length||eP?(0,l.jsxs)(a.A,{direction:"vertical",size:12,style:{width:"100%"},children:[eT.map((e,r)=>{let o="user"===e.role;return(0,l.jsx)("div",{style:{display:"flex",justifyContent:o?"flex-end":"flex-start"},children:(0,l.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:o?"var(--colorFillSecondary)":"var(--colorBgContainer)",color:"var(--colorText)",border:"1px solid var(--colorBorderSecondary)",whiteSpace:"pre-wrap",lineHeight:1.7,fontSize:13,transition:"all .2s ease"},children:[e.content,!o&&(0,l.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,l.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{ei(e.content),t.success("已应用到编辑内容,请确认后保存")},children:"应用"})})]})},"".concat(e.role,"-").concat(r))}),eP&&(0,l.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,l.jsxs)("div",{style:{padding:"10px 12px",borderRadius:12,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"AI 正在分析并生成内容..."]})})]}):(0,l.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"输入 @ 召回知识库文件,再描述你的优化目标"})}),(0,l.jsx)(f.A,{style:{margin:0}}),(0,l.jsxs)("div",{style:{padding:12},children:[e_.length>0&&(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:e_.map(e=>(0,l.jsxs)(s.A,{closable:!0,onClose:()=>eJ(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),eG&&(0,l.jsxs)("div",{style:{maxHeight:260,overflowY:"auto",marginBottom:8,border:"1px solid var(--colorBorderSecondary)",borderRadius:12,background:"var(--colorBgElevated, var(--colorBgContainer))",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.14)"},children:[(0,l.jsxs)("div",{style:{position:"sticky",top:0,zIndex:1,padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",background:"var(--colorBgElevated, var(--colorBgContainer))",display:"flex",justifyContent:"space-between",gap:12,alignItems:"center"},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{color:"var(--colorText)",fontSize:13,fontWeight:700},children:"召回知识库文件"}),(0,l.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11},children:"支持文件名与知识库内容检索,最多召回 3 个文件"})]}),(0,l.jsx)(s.A,{color:eq?"blue":"default",style:{margin:0,maxWidth:240,overflow:"hidden",textOverflow:"ellipsis"},children:eq?"@".concat(eq):"输入 @关键词"})]}),eL?(0,l.jsxs)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在加载知识库文件..."]}):0===eO.length?(0,l.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:"暂无可召回的知识库文件"}):0===e4.length?(0,l.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:eU?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在检索知识库内容..."]}):"没有匹配的知识库文件,请换个关键词"}):(0,l.jsxs)(l.Fragment,{children:[eU&&(0,l.jsxs)("div",{style:{padding:"8px 12px",color:"var(--colorTextSecondary)",fontSize:12,borderBottom:"1px solid var(--colorBorderSecondary)"},children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在继续检索内容匹配..."]}),e4.slice(0,30).map(e=>(0,l.jsxs)("div",{onMouseDown:t=>{var r;t.preventDefault(),r=e.relativePath,eJ(e=>e.includes(r)?e:[...e,r]),eI(e=>e.replace(/(^|\s)@([^\s@]*)$/,"$1@".concat(r," "))),eX(!1)},style:{padding:"10px 12px",cursor:"pointer",borderBottom:"1px solid var(--colorBorderSecondary)",fontSize:12,display:"grid",gridTemplateColumns:"22px minmax(0, 1fr) auto",gap:10,alignItems:"center"},children:[(0,l.jsx)("div",{style:{width:22,height:22,borderRadius:7,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(A.A,{style:{color:"var(--colorAccent)"}})}),(0,l.jsxs)("div",{style:{minWidth:0},children:[(0,l.jsx)("div",{style:{color:"var(--colorText)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:700},children:e.relativePath}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.category||"未分类"," \xb7 ",e.format||"未知格式","number"==typeof e.score?" \xb7 score ".concat(e.score.toFixed(2)):""]})]}),(0,l.jsxs)(a.A,{size:4,children:[(0,l.jsx)(s.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容匹配":"disk"===e.matchedBy?"磁盘文件":"文件匹配"}),(0,l.jsx)(s.A,{style:{margin:0},children:e.status})]})]},e.relativePath))]})]}),(0,l.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,l.jsx)(m.A.TextArea,{value:eE,onChange:e=>{let t=e.target.value;eI(t),eX(null!==q(t))},onFocus:()=>eX(null!==q(eE)),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e9())},disabled:eP,placeholder:"输入 @ 召回知识库文件,再描述优化目标...",autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,l.jsx)(d.Ay,{type:"primary",icon:(0,l.jsx)(E.A,{}),loading:eP,disabled:!eE.trim(),onClick:()=>{e9()},children:"发送"})]})]})]})]})]})}}},e=>{e.O(0,[433,787,576,195,985,525,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST=function(s,e,t,c,a,n,i,d,u,o,r,k,b,f,g,h,l){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:f,bitArray:[]},__routerFilterDynamic:{numItems:u,errorRate:1e-4,numBits:u,numHashes:f,bitArray:[]},"/":["static/chunks/pages/index-c5e0758e6b31deee.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,n,"static/chunks/749-83476f9bcd014a5a.js","static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js"],"/context/long-term":[s,e,t,c,a,n,i,d,g,"static/chunks/pages/context/long-term-2e6a30a8f879df47.js"],"/context/short-term":[s,e,t,c,a,n,i,d,g,"static/chunks/pages/context/short-term-730211234fa3add6.js"],"/document-roles":[s,e,t,c,i,"static/chunks/698-5f16390243596219.js","static/chunks/pages/document-roles-7197641736843503.js"],"/document-specs":[s,e,t,c,i,r,"static/chunks/265-32ec272a49cfacef.js","static/chunks/pages/document-specs-033d848b03b54df3.js"],"/documents":[s,e,t,c,i,o,h,"static/chunks/447-fa0c71b418e19135.js","static/chunks/pages/documents-3b2f23e2d6b27f1b.js"],"/guide":[s,e,h,"static/chunks/20-00147a779147a5a4.js","static/chunks/pages/guide-cdf68a096918c979.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,a,n,d,o,l,k,"static/chunks/pages/knowledge/file-detail-0a5e267f77f4e8b3.js"],"/knowledge/files":[s,e,t,a,n,d,k,"static/chunks/pages/knowledge/files-bc2ad2b01cb1f568.js"],"/knowledge/manage":[s,e,o,"static/chunks/788-7f7359a830e3f4fd.js","static/chunks/pages/knowledge/manage-25eb1a993b155450.js"],"/knowledge/search":[s,e,t,o,r,k,"static/chunks/pages/knowledge/search-2cee4e8b8792170c.js"],"/models":[s,e,t,c,a,i,r,"static/chunks/pages/models-b5f68c4c70257495.js"],"/overview":[s,e,"static/chunks/131-e2f0164f12b82496.js","static/chunks/pages/overview-28c7ceeca56e6a78.js"],"/prompt":[s,e,t,c,a,"static/chunks/525-5d947137d894f5fe.js","static/chunks/pages/prompt-3be228b7b80373ca.js"],"/settings":[s,e,"static/chunks/pages/settings-fa9d6a56898ba678.js"],"/system/logs":[s,t,c,a,n,d,l,"static/chunks/pages/system/logs-f4e222140dc7b30c.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/document-specs","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings","/system/logs"]}}("static/chunks/433-233659be69169c19.js","static/chunks/787-c18af810af3433f6.js","static/chunks/576-6699fed6c88502fe.js","static/chunks/195-2c0168eacab722d2.js","static/chunks/985-4b4a3ed36ada16eb.js","static/chunks/150-134099bf526e9292.js","static/chunks/455-e04e99d9e242de44.js","static/chunks/289-6bf8af72114aefd5.js",0,"static/chunks/506-93f730bc149d0dce.js","static/chunks/938-45efd516bb130bd5.js","static/css/09be1fdeab8595ab.css",1e-4,NaN,"static/chunks/932-2f195f4200ce9378.js","static/chunks/412-b9c854c6a76db67d.js","static/chunks/512-12bd409cebeca05b.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST=function(s,e,t,c,a,n,d,i,u,o,r,k,b,g,f,h,l){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:0,errorRate:1e-4,numBits:0,numHashes:g,bitArray:[]},__routerFilterDynamic:{numItems:u,errorRate:1e-4,numBits:u,numHashes:g,bitArray:[]},"/":["static/chunks/pages/index-c5e0758e6b31deee.js"],"/_error":["static/chunks/pages/_error-282257fbdcc167b4.js"],"/asset-library":[s,e,n,"static/chunks/749-83476f9bcd014a5a.js","static/chunks/pages/asset-library-e9ddfe1cbaac42d9.js"],"/context/long-term":[s,e,t,c,a,n,d,i,f,"static/chunks/pages/context/long-term-2e6a30a8f879df47.js"],"/context/short-term":[s,e,t,c,a,n,d,i,f,"static/chunks/pages/context/short-term-730211234fa3add6.js"],"/document-roles":[s,e,t,c,d,"static/chunks/698-5f16390243596219.js","static/chunks/pages/document-roles-4be647d475d4674b.js"],"/document-specs":[s,e,t,c,d,r,"static/chunks/265-32ec272a49cfacef.js","static/chunks/pages/document-specs-033d848b03b54df3.js"],"/documents":[s,e,t,c,d,o,h,"static/chunks/447-fa0c71b418e19135.js","static/chunks/pages/documents-3b2f23e2d6b27f1b.js"],"/guide":[s,e,h,"static/chunks/20-00147a779147a5a4.js","static/chunks/pages/guide-cdf68a096918c979.js"],"/knowledge":["static/chunks/pages/knowledge-905248d8dcb15453.js"],"/knowledge/file-detail":[s,e,t,a,n,i,o,l,k,"static/chunks/pages/knowledge/file-detail-0a5e267f77f4e8b3.js"],"/knowledge/files":[s,e,t,a,n,i,k,"static/chunks/pages/knowledge/files-bc2ad2b01cb1f568.js"],"/knowledge/manage":[s,e,o,"static/chunks/788-7f7359a830e3f4fd.js","static/chunks/pages/knowledge/manage-25eb1a993b155450.js"],"/knowledge/search":[s,e,t,o,r,k,"static/chunks/pages/knowledge/search-afb423fc22eb623b.js"],"/models":[s,e,t,c,a,d,r,"static/chunks/pages/models-b5f68c4c70257495.js"],"/overview":[s,e,"static/chunks/131-e2f0164f12b82496.js","static/chunks/pages/overview-28c7ceeca56e6a78.js"],"/prompt":[s,e,t,c,a,"static/chunks/525-5d947137d894f5fe.js","static/chunks/pages/prompt-714b161b79fcd454.js"],"/settings":[s,e,"static/chunks/pages/settings-fa9d6a56898ba678.js"],"/system/logs":[s,t,c,a,n,i,l,"static/chunks/pages/system/logs-f4e222140dc7b30c.js"],sortedPages:["/","/_app","/_error","/asset-library","/context/long-term","/context/short-term","/document-roles","/document-specs","/documents","/guide","/knowledge","/knowledge/file-detail","/knowledge/files","/knowledge/manage","/knowledge/search","/models","/overview","/prompt","/settings","/system/logs"]}}("static/chunks/433-233659be69169c19.js","static/chunks/787-c18af810af3433f6.js","static/chunks/576-6699fed6c88502fe.js","static/chunks/195-2c0168eacab722d2.js","static/chunks/985-4b4a3ed36ada16eb.js","static/chunks/150-134099bf526e9292.js","static/chunks/455-e04e99d9e242de44.js","static/chunks/289-6bf8af72114aefd5.js",0,"static/chunks/506-93f730bc149d0dce.js","static/chunks/938-45efd516bb130bd5.js","static/css/09be1fdeab8595ab.css",1e-4,NaN,"static/chunks/932-2f195f4200ce9378.js","static/chunks/412-b9c854c6a76db67d.js","static/chunks/512-12bd409cebeca05b.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customize-agent/server",
3
- "version": "4.0.19",
3
+ "version": "4.0.21",
4
4
  "description": "Customize Agent Web 管理控制台",
5
5
  "exports": {
6
6
  "./package.json": "./package.json"
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[623],{23507:(e,l,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/document-roles",function(){return i(59889)}])},59889:(e,l,i)=>{"use strict";i.r(l),i.d(l,{default:()=>K});var r=i(65321),n=i(97109),s=i(35292),t=i(11702),o=i(17807),a=i(63455),c=i(84253),d=i(68787),p=i(85114),x=i(26171),m=i(33442),h=i(57271),u=i(85493),f=i(34052),y=i(7576),g=i(2256),j=i(38770),A=i(58569),b=i(25345),v=i(43979),I=i(80042),w=i(75548),S=i(26631),T=i(84662),z=i(30486),C=i(99650),k=i(8263),R=i(84742),_=i(43094),F=i(8579),B=i(58209),H=i(54746),W=i(96651),N=i(60470),D=i(6578),E=i(79059);let{Paragraph:P}=s.A,q={rule:(0,r.jsx)(b.A,{}),project_fact:(0,r.jsx)(v.A,{}),table:(0,r.jsx)(I.A,{}),drawing:(0,r.jsx)(w.A,{}),specification:(0,r.jsx)(S.A,{}),reference:(0,r.jsx)(T.A,{})},V={fact_extraction:(0,r.jsx)(z.A,{}),chapter_generation:(0,r.jsx)(C.A,{}),llm_review:(0,r.jsx)(k.A,{}),validation:(0,r.jsx)(R.A,{}),formatting:(0,r.jsx)(_.A,{}),reference:(0,r.jsx)(T.A,{})},O={rule:"#fa8c16",project_fact:"#1677ff",table:"#52c41a",drawing:"#722ed1",specification:"#eb2f96",reference:"#13c2c2"},G={fact_extraction:"#fa8c16",chapter_generation:"#1677ff",llm_review:"#722ed1",validation:"#52c41a",formatting:"#eb2f96",reference:"#13c2c2"},L={rule:"roles.ruleFile",project_fact:"roles.projectFactFile",table:"roles.tableFile",drawing:"roles.drawingFile",specification:"roles.specificationFile",reference:"roles.reference"},Q={fact_extraction:"roles.factExtraction",chapter_generation:"roles.chapterGeneration",llm_review:"roles.llmReview",validation:"roles.validation",formatting:"roles.formatting",reference:"roles.reference"},X=e=>(0,r.jsx)(t.A,{closable:e.closable,onClose:e.onClose,color:"blue",style:{margin:"1px 2px",fontSize:11,lineHeight:"18px"},children:e.label});function K(){let e,l,i=(0,E.Vr)(),{message:s}=o.A.useApp(),[b]=a.A.useForm(),[v]=a.A.useForm(),[I,w]=(0,n.useState)([]),[T,z]=(0,n.useState)([]),[k,R]=(0,n.useState)([]),[_,K]=(0,n.useState)([]),[U,J]=(0,n.useState)(!1),[M,Y]=(0,n.useState)(!1),[Z,$]=(0,n.useState)(!1),[ee,el]=(0,n.useState)("file"),[ei,er]=(0,n.useState)("custom"),en=async()=>{let[e,l,i]=await Promise.all([(0,D.lv)(),(0,D.HT)(),(0,D.dx)()]);w(e.roles),z(e.configs),R(l.files),K(i)};(0,n.useEffect)(()=>{en().catch(()=>s.error(i("common.error")))},[s,i]);let es=I.filter(e=>!e.builtIn),et=I.filter(e=>e.builtIn),eo=T.filter(e=>!e.builtIn),ea=T.filter(e=>e.builtIn),ec=e=>"all"===ei||("builtin"===ei?e.builtIn:!e.builtIn),ed=I.filter(ec),ep=T.filter(ec),ex=ed.filter(e=>"file"===e.type),em=ed.filter(e=>"prompt"===e.type),eh=I.filter(e=>"file"===e.type),eu=I.filter(e=>"prompt"===e.type),ef=async()=>{try{let e=await b.validateFields(),l=await (0,D.dg)(e);w(l.roles),z(l.configs),J(!1),s.success(i("common.success"))}catch(e){s.error(i("common.error"))}},ey=async()=>{try{let e=await v.validateFields(),l=e=>(null!=e?e:[]).map((e,l)=>{var i;return{roleId:e.roleId,order:Number(null!=(i=e.order)?i:l)}}),r=await (0,D.NR)({...e,fileRoles:l(e.fileRoles),promptRoles:l(e.promptRoles)});w(r.roles),z(r.configs),Y(!1),s.success(i("common.success"))}catch(e){s.error(i("common.error"))}},eg=async e=>{let l=await (0,D.FV)(e.type,e.id);w(l.roles),z(l.configs)},ej=async e=>{let l=await (0,D.dw)(e);w(l.roles),z(l.configs)},eA=function(e){var l;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file",r=(null==e?void 0:e.builtIn)?{...e,id:"".concat(e.id,"-copy-").concat(Date.now()),name:"".concat(e.name," Copy"),builtIn:!1}:e;(null==e?void 0:e.builtIn)&&s.info("内置角色不可直接编辑,已为你创建副本"),b.setFieldsValue(r?{...r,resourceIds:(null==(l=r.resourceIds)?void 0:l.length)?r.resourceIds:r.resourceId?[r.resourceId]:[]}:{id:"role-".concat(Date.now()),name:"",description:"",type:i,resourceIds:[],executionType:"prompt"===i?"reference":void 0,processingType:"file"===i?"reference":void 0}),J(!0)},eb=e=>{let l=(null==e?void 0:e.builtIn)?{...e,id:"".concat(e.id,"-copy-").concat(Date.now()),name:"".concat(e.name," Copy"),builtIn:!1}:e;(null==e?void 0:e.builtIn)&&s.info("内置项目配置不可直接编辑,已为你创建副本"),v.setFieldsValue(null!=l?l:{id:"config-".concat(Date.now()),name:"",description:"",fileRoles:[],promptRoles:[],builtIn:!1}),Y(!0)},ev=e=>I.find(l=>l.id===e);return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"pageTitle",children:i("roles.title")}),(0,r.jsx)("p",{className:"pageDesc",children:i("roles.description")})]}),(0,r.jsxs)(m.A,{children:[(0,r.jsx)(h.A,{value:ei,onChange:er,style:{width:170},options:[{label:"我的配置 (".concat(es.length+eo.length,")"),value:"custom"},{label:"内置示例 (".concat(et.length+ea.length,")"),value:"builtin"},{label:"全部来源 (".concat(I.length+T.length,")"),value:"all"}]}),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>eA(void 0,"file"),children:i("roles.newFileRole")}),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>eA(void 0,"prompt"),children:i("roles.newPromptRole")}),(0,r.jsx)(p.Ay,{type:"primary",icon:(0,r.jsx)(H.A,{}),onClick:()=>eb(),children:i("roles.newConfig")})]})]}),(0,r.jsx)(u.A,{type:"info",showIcon:!0,message:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)("span",{children:i("roles.plainGuideTitle")}),(0,r.jsx)(p.Ay,{type:"link",size:"small",icon:Z?(0,r.jsx)(W.A,{}):(0,r.jsx)(N.A,{}),onClick:()=>$(!Z),style:{padding:"0 4px"},children:Z?"收起说明":"展开说明"})]}),description:Z?i("roles.plainGuideDesc"):void 0}),(0,r.jsx)(d.A,{size:"small",tabList:[{key:"file",label:"文件角色 (".concat(ex.length,")")},{key:"prompt",label:"提示词角色 (".concat(em.length,")")},{key:"configs",label:"项目角色配置 (".concat(ep.length,")")}],activeTabKey:ee,onTabChange:el,children:"configs"===ee?0===ep.length?(0,r.jsx)(c.A,{description:i("common.noData")}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:ep.map(e=>{let l=e.fileRoles.map(e=>({...e,role:ev(e.roleId)})).filter(e=>e.role),n=e.promptRoles.map(e=>({...e,role:ev(e.roleId)})).filter(e=>e.role);return(0,r.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:6},children:[(0,r.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.name}),e.builtIn?(0,r.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置示例"}):(0,r.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的配置"}),(0,r.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,r.jsx)(p.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>eb(e),children:e.builtIn?"复制":"编辑"}),(0,r.jsx)(x.A,{title:i("common.confirm"),disabled:e.builtIn,onConfirm:()=>{ej(e.id)},children:(0,r.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(B.A,{}),disabled:e.builtIn})})]})]}),e.description&&(0,r.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,r.jsxs)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:[(0,r.jsxs)("div",{style:{marginBottom:4},children:[(0,r.jsxs)("span",{children:["文件角色 (",e.fileRoles.length,"): "]}),l.length>0?(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[l.slice(0,4).map(e=>(0,r.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),l.length>4&&(0,r.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",l.length-4]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("span",{children:["提示词角色 (",e.promptRoles.length,"): "]}),n.length>0?(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:[n.slice(0,4).map(e=>(0,r.jsx)(t.A,{color:"purple",style:{margin:0,fontSize:10,lineHeight:"16px"},children:e.role.name},e.roleId)),n.length>4&&(0,r.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",n.length-4]})]}):(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"无"})]})]})]},e.id)})}):(e="file"===ee?ex:em,l=i,0===e.length?(0,r.jsx)(c.A,{description:i("common.noData")}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(270px, 1fr))",gap:12},children:e.map((e,n)=>{var s,o,a,c,m,h,u,f,y;let g=(null==(s=e.resourceIds)?void 0:s.length)?e.resourceIds:e.resourceId?[e.resourceId]:[],j=g.slice(0,3),A=g.length-j.length,b="file"===e.type?null!=(a=q[null!=(o=e.processingType)?o:""])?a:(0,r.jsx)(S.A,{}):null!=(m=V[null!=(c=e.executionType)?c:""])?m:(0,r.jsx)(F.A,{}),v="file"===e.type?null!=(u=O[null!=(h=e.processingType)?h:""])?u:"var(--colorAccent)":null!=(y=G[null!=(f=e.executionType)?f:""])?y:"var(--colorWarning)";return(0,r.jsxs)(d.A,{size:"small",hoverable:!0,style:{minWidth:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,marginBottom:8},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flex:1},children:[(0,r.jsx)("span",{style:{color:v,fontSize:16,flexShrink:0,lineHeight:1},children:b}),(0,r.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"20px"},children:e.name})]}),(0,r.jsx)("div",{style:{display:"flex",gap:4,flexShrink:0},children:e.builtIn?(0,r.jsx)(t.A,{color:"gold",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"内置示例"}):(0,r.jsx)(t.A,{color:"cyan",style:{margin:0,fontSize:10,lineHeight:"16px"},children:"我的角色"})})]}),e.description&&(0,r.jsx)(P,{ellipsis:{rows:2},style:{fontSize:12,color:"var(--colorTextSecondary)",marginBottom:8},children:e.description}),(0,r.jsxs)("div",{style:{marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,r.jsx)(t.A,{color:"file"===e.type?"blue":"purple",style:{margin:0},children:function(e,l){var i,r,n;let s="file"===e.type?L[null!=(i=e.processingType)?i:""]:Q[null!=(r=e.executionType)?r:""];return s?l(s):null!=(n="file"===e.type?e.processingType:e.executionType)?n:""}(e,l)}),g.length>0&&(0,r.jsxs)("span",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:["绑定 ",g.length," 个资源"]})]}),j.length>0&&(0,r.jsx)("div",{style:{marginBottom:10},children:(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map(e=>(0,r.jsx)(t.A,{color:"blue",style:{margin:0,fontSize:10,lineHeight:"16px",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"},children:e},e)),A>0&&(0,r.jsxs)(t.A,{style:{margin:0,fontSize:10,lineHeight:"16px"},children:["+",A]})]})}),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:6,paddingTop:4,borderTop:"1px solid var(--colorBorderSecondary)"},children:[(0,r.jsx)(p.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>eA(e),children:e.builtIn?"复制":"编辑"}),(0,r.jsx)(x.A,{title:i("common.confirm"),disabled:e.builtIn,onConfirm:()=>{eg(e)},children:(0,r.jsx)(p.Ay,{size:"small",danger:!0,icon:(0,r.jsx)(B.A,{}),disabled:e.builtIn})})]})]},e.id)})}))}),(0,r.jsx)(f.A,{title:i("roles.roleEditor"),open:U,onClose:()=>J(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,r.jsx)(p.Ay,{type:"primary",onClick:()=>{ef()},children:i("common.save")}),children:(0,r.jsxs)(a.A,{form:b,layout:"vertical",children:[(0,r.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(y.A,{})}),(0,r.jsxs)(g.A,{gutter:16,children:[(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"type",label:i("roles.roleType"),rules:[{required:!0}],children:(0,r.jsx)(h.A,{options:[{label:i("roles.fileRole"),value:"file"},{label:i("roles.promptRole"),value:"prompt"}]})})}),(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"name",label:i("roles.roleName"),rules:[{required:!0}],children:(0,r.jsx)(y.A,{})})})]}),(0,r.jsx)(a.A.Item,{name:"description",label:i("roles.roleDescription"),children:(0,r.jsx)(y.A.TextArea,{rows:2})}),(0,r.jsx)(a.A.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.type!==l.type,children:e=>{let{getFieldValue:l}=e,n="prompt"===l("type");return(0,r.jsx)(d.A,{size:"small",title:n?"提示词角色配置":"文件角色配置",style:{border:"1px solid var(--colorBorderSecondary)"},children:n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.A.Item,{name:"executionType",label:i("roles.executionType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,r.jsx)(h.A,{options:[{label:i("roles.factExtraction"),value:"fact_extraction"},{label:i("roles.chapterGeneration"),value:"chapter_generation"},{label:i("roles.validation"),value:"validation"},{label:i("roles.formatting"),value:"formatting"},{label:i("roles.reference"),value:"reference"}]})}),(0,r.jsx)(a.A.Item,{name:"resourceIds",label:i("roles.bindPrompt"),style:{marginBottom:0},help:(0,r.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:i("roles.multiBindPromptHelp")}),children:(0,r.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:X,placeholder:"选择提示词",options:_.filter(e=>e.hasFile).map(e=>({label:e.projectName,value:e.id}))})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.A.Item,{name:"processingType",label:i("roles.processingType"),rules:[{required:!0}],style:{marginBottom:12},children:(0,r.jsx)(h.A,{options:[{label:i("roles.ruleFile"),value:"rule"},{label:i("roles.projectFactFile"),value:"project_fact"},{label:i("roles.tableFile"),value:"table"},{label:i("roles.drawingFile"),value:"drawing"},{label:i("roles.specificationFile"),value:"specification"},{label:i("roles.reference"),value:"reference"}]})}),(0,r.jsx)(a.A.Item,{name:"resourceIds",label:i("roles.bindFile"),style:{marginBottom:0},help:(0,r.jsx)("span",{style:{fontSize:11,color:"var(--colorTextSecondary)"},children:i("roles.multiBindFileHelp")}),children:(0,r.jsx)(h.A,{mode:"multiple",showSearch:!0,tagRender:X,placeholder:"选择知识库文件",options:k.map(e=>({label:e.relativePath,value:e.relativePath}))})})]})})}})]})}),(0,r.jsx)(f.A,{title:i("roles.configEditor"),open:M,onClose:()=>Y(!1),width:800,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,r.jsx)(p.Ay,{type:"primary",onClick:()=>{ey()},children:i("common.save")}),children:(0,r.jsxs)(a.A,{form:v,layout:"vertical",children:[(0,r.jsx)(a.A.Item,{name:"id",hidden:!0,children:(0,r.jsx)(y.A,{})}),(0,r.jsxs)(g.A,{gutter:16,children:[(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"name",label:i("roles.configName"),rules:[{required:!0}],children:(0,r.jsx)(y.A,{})})}),(0,r.jsx)(j.A,{span:12,children:(0,r.jsx)(a.A.Item,{name:"description",label:i("roles.configDescription"),children:(0,r.jsx)(y.A,{})})})]}),(0,r.jsx)(A.A,{destroyInactiveTabPane:!1,items:[{key:"file",label:"文件角色 (".concat(ex.length,")"),children:(0,r.jsx)(a.A.List,{name:"fileRoles",children:(e,l)=>{let{add:n,remove:s}=l;return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,r.jsx)(c.A,{description:"暂未添加文件角色"}),e.map((e,l)=>(0,r.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,r.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#1677ff",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,r.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,r.jsx)(B.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,r.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,r.jsx)(j.A,{flex:"auto",children:(0,r.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"文件角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,r.jsx)(h.A,{placeholder:"选择文件角色",size:"small",options:eh.map(e=>{var l;return{label:"".concat(e.name," (").concat(i(L[null!=(l=e.processingType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,r.jsx)(j.A,{style:{width:90},children:(0,r.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,r.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>n({order:e.length}),children:i("roles.addRole")})]})}})},{key:"prompt",label:"提示词角色 (".concat(eu.length,")"),children:(0,r.jsx)(a.A.List,{name:"promptRoles",children:(e,l)=>{let{add:n,remove:s}=l;return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[0===e.length&&(0,r.jsx)(c.A,{description:"暂未添加提示词角色"}),e.map((e,l)=>(0,r.jsxs)(d.A,{size:"small",style:{border:"1px solid var(--colorBorderSecondary)",position:"relative"},children:[(0,r.jsxs)("div",{style:{position:"absolute",top:-10,left:12,background:"#722ed1",color:"#fff",fontSize:11,fontWeight:700,padding:"1px 8px",borderRadius:10},children:["#",l+1]}),(0,r.jsx)(p.Ay,{danger:!0,size:"small",icon:(0,r.jsx)(B.A,{}),onClick:()=>s(e.name),style:{position:"absolute",top:8,right:8,zIndex:1}}),(0,r.jsxs)(g.A,{gutter:[16,8],align:"middle",style:{marginTop:4},children:[(0,r.jsx)(j.A,{flex:"auto",children:(0,r.jsx)(a.A.Item,{name:[e.name,"roleId"],label:"提示词角色",rules:[{required:!0}],style:{marginBottom:0},children:(0,r.jsx)(h.A,{placeholder:"选择提示词角色",size:"small",options:eu.map(e=>{var l;return{label:"".concat(e.name," (").concat(i(Q[null!=(l=e.executionType)?l:""]||"roles.reference"),")"),value:e.id}})})})}),(0,r.jsx)(j.A,{style:{width:90},children:(0,r.jsx)(a.A.Item,{name:[e.name,"order"],label:"排序",initialValue:l,style:{marginBottom:0},children:(0,r.jsx)(y.A,{type:"number",size:"small"})})})]})]},e.key)),(0,r.jsx)(p.Ay,{icon:(0,r.jsx)(H.A,{}),onClick:()=>n({order:e.length}),children:i("roles.addRole")})]})}})}]})]})})]})}}},e=>{e.O(0,[433,787,576,195,455,698,636,593,792],()=>e(e.s=23507)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[207],{4184:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>E});var l=t(65321),r=t(43220),i=t.n(r),a=t(97109),n=t(35292),c=t(17807),o=t(85114),u=t(85493),d=t(68787),_=t(33442),h=t(7576),m=t(48318),y=t(76506),p=t(11702),x=t(42700),j=t(84253),w=t(30486),A=t(79059),f=t(6578),g=t(14569),b=t.n(g);let{Paragraph:v}=n.A,S=["keyword","vector","rewrite","hybridBonus"],k=["keywordScore","bm25Score","vectorScore","rerankBoost","hybridScore"];function P(e){return"number"==typeof e?e.toFixed(2):"-"}function C(e,s,t){let l=e(s);return l===s?t:l}function E(){var e,s,t;let{message:r}=c.A.useApp(),n=(0,A.Vr)("knowledge"),[g,E]=(0,a.useState)(""),[I,N]=(0,a.useState)(!1),[R,T]=(0,a.useState)([]),[L,F]=(0,a.useState)(),[B,D]=(0,a.useState)(),[z,M]=(0,a.useState)(""),[V,O]=(0,a.useState)({keyword:1,vector:.9,rewrite:.72,hybridBonus:.35}),H=async e=>{await navigator.clipboard.writeText(e),r.success(n("copyPriorityEvidenceSuccess"))},W=async()=>{let e=g.trim();if(e){N(!0),M("");try{let s=await (0,f.W2)(e,{limit:10,weights:V});T(s.results),F(s.queryTimeMs),D(s.debug)}catch(e){T([]),M(e instanceof Error?e.message:n("searchFailed"))}finally{N(!1)}}};return(0,l.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:n("searchTitle")}),(0,l.jsx)("p",{className:"pageDesc",children:n("searchDesc")})]}),(0,l.jsx)(i(),{href:"/documents",children:(0,l.jsx)(o.Ay,{children:n("goToDocuments")})})]}),(0,l.jsx)(u.A,{type:"info",showIcon:!0,message:n("autoSearchFirst"),description:n("autoSearchFirstDesc")}),(0,l.jsx)(d.A,{size:"small",children:(0,l.jsxs)(_.A.Compact,{className:"w-full",children:[(0,l.jsx)(h.A,{value:g,onChange:e=>E(e.target.value),onPressEnter:()=>{W()},placeholder:n("searchContentPlaceholder")}),(0,l.jsx)(o.Ay,{type:"primary",icon:(0,l.jsx)(w.A,{}),loading:I,onClick:()=>{W()},children:n("searchAction")})]})}),(0,l.jsx)(d.A,{size:"small",title:n("recallWeightTuning"),children:(0,l.jsx)(_.A,{wrap:!0,children:S.map(e=>(0,l.jsxs)("span",{children:[C(n,"weights.".concat(e),e)," ",(0,l.jsx)(m.A,{min:0,max:"hybridBonus"===e?2:5,step:"hybridBonus"===e?.05:.1,value:V[e],onChange:s=>O(t=>({...t,[e]:Number(null!=s?s:t[e])}))})]},e))})}),B&&(0,l.jsx)(d.A,{size:"small",title:n("debugPanel"),children:(0,l.jsxs)(y.A,{size:"small",column:2,bordered:!0,children:[(0,l.jsx)(y.A.Item,{label:n("originalQuery"),children:B.originalQuery}),(0,l.jsx)(y.A.Item,{label:n("reranker"),children:B.reranker}),(0,l.jsx)(y.A.Item,{label:n("rewrittenQueries"),span:2,children:(0,l.jsx)(_.A,{wrap:!0,children:null==(e=B.rewrittenQueries)?void 0:e.map(e=>(0,l.jsx)(p.A,{children:e},e))})}),(0,l.jsx)(y.A.Item,{label:n("recallCounts"),span:2,children:(0,l.jsx)(_.A,{wrap:!0,children:Object.entries(null!=(s=B.recallCounts)?s:{}).map(e=>{let[s,t]=e;return(0,l.jsxs)(p.A,{children:[C(n,"recallSources.".concat(s),s),": ",t]},s)})})}),(0,l.jsx)(y.A.Item,{label:n("recallWeights"),span:2,children:(0,l.jsx)(_.A,{wrap:!0,children:Object.entries(null!=(t=B.weights)?t:{}).map(e=>{let[s,t]=e;return(0,l.jsxs)(p.A,{children:[C(n,"weights.".concat(s),s),": ",t]},s)})})})]})}),(0,l.jsxs)(d.A,{size:"small",title:n("searchResults"),extra:"number"==typeof L?"".concat(L," ms"):void 0,children:[z?(0,l.jsx)(u.A,{type:"error",showIcon:!0,message:n("searchFailed"),description:z,className:"mb-4"}):null,I?(0,l.jsx)(x.A,{}):0===R.length?(0,l.jsx)(j.A,{description:n("noSearchResults")}):(0,l.jsx)("div",{className:b().searchResultList,children:R.map((e,s)=>{var t,r;return(0,l.jsxs)("div",{className:b().searchResultItem,children:[(0,l.jsxs)("div",{className:b().searchResultHeader,children:[(0,l.jsxs)(_.A,{size:8,wrap:!0,children:[(0,l.jsxs)(p.A,{children:[n("resultIndex")," ",s+1]}),(0,l.jsx)(p.A,{color:"hybrid"===e.source?"purple":"vector"===e.source?"blue":"green",children:C(n,"recallSources.".concat(null!=(t=e.source)?t:"keyword"),null!=(r=e.source)?r:"keyword")}),(0,l.jsx)(p.A,{children:C(n,"scopes.".concat(e.scope),e.scope)}),e.chunkKind&&(0,l.jsx)(p.A,{color:"geekblue",children:e.chunkKind}),e.rowRange&&(0,l.jsxs)(p.A,{color:"gold",children:[n("rowRange")," ",e.rowRange]}),e.sectionTitle&&(0,l.jsx)(p.A,{color:"cyan",children:e.sectionTitle})]}),(0,l.jsx)("strong",{children:P(e.score)})]}),(0,l.jsx)("div",{className:b().statusPath,children:(0,l.jsxs)(_.A,{size:8,wrap:!0,children:[(0,l.jsx)(i(),{href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(e.filePath)),children:e.filePath}),"number"==typeof e.chunkIndex?" #".concat(e.chunkIndex):"",(0,l.jsx)(o.Ay,{size:"small",onClick:()=>{H(e.filePath)},children:n("copyAsPriorityEvidence")})]})}),(0,l.jsx)(v,{ellipsis:{rows:6,expandable:!0,symbol:n("expand")},className:b().searchContent,children:function(e,s){let t=[s.trim(),...s.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,s)=>s.length-e.length);if(0===t.length)return e;let r=RegExp("(".concat(t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,s)=>t.some(s=>s.toLowerCase()===e.toLowerCase())?(0,l.jsx)("mark",{children:e},s):e)}(e.content,g)}),e.facets&&Object.keys(e.facets).length>0&&(0,l.jsx)("div",{className:b().statusMeta,children:Object.entries(e.facets).slice(0,8).map(e=>{let[s,t]=e;return(0,l.jsxs)("span",{children:[s," ",(0,l.jsx)("b",{children:Array.isArray(t)?t.join(", "):String(t)})]},s)})}),(0,l.jsx)("div",{className:b().statusMeta,children:k.map(s=>{var t;return(0,l.jsxs)("span",{children:[C(n,"scoreDetails.".concat(s),s)," ",(0,l.jsx)("b",{children:P(null==(t=e.scoreDetails)?void 0:t[s])})]},s)})})]},e.id)})})]})]})}},9208:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/search",function(){return t(4184)}])},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG",drawingPreview:"style_drawingPreview__lkk_L"}}},e=>{e.O(0,[433,787,576,506,938,636,593,792],()=>e(e.s=9208)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{27549:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/prompt",function(){return r(34508)}])},34508:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>Z});var l=r(65321),i=r(97109),o=r(79059),n=r(17807),a=r(33442),s=r(11702),c=r(56985),d=r(85114),p=r(26171),h=r(68787),u=r(88762),m=r(7576),x=r(57271),y=r(49292),f=r(55122),g=r(84253),j=r(34052),v=r(42700),w=r(54746),S=r(99650),A=r(58209),b=r(26631),C=r(29606),k=r(96091),z=r(81668),T=r(30486),N=r(46082),E=r(42758),F=r(24810),P=r(7492);async function R(){let e=await fetch("/api/prompt");if(!e.ok)throw Error("Failed");return e.json()}async function O(e,t,r){let l=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!l.ok)throw Error("Failed");return l.json()}async function I(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",projectRoot:e,content:"# CUSTOMIZE\n"})});if(!t.ok)throw Error("Failed");return t.json()}async function B(e,t){let r=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"createCustom",name:e,content:t})});if(!r.ok)throw Error("Failed");return r.json()}async function W(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"select",selectedIds:e})});if(!t.ok)throw Error("Failed");return t.json()}async function H(e){let t=await fetch("/api/prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"import",...e&&"object"==typeof e?e:{prompts:[]}})});if(!t.ok)throw Error(await t.text());return t.json()}async function D(){let e=await fetch("/api/kb/files?limit=200");if(!e.ok)throw Error("Failed");return(await e.json()).files||[]}async function _(e){let t=await fetch("/api/kb/files/detail?relativePath=".concat(encodeURIComponent(e)));if(!t.ok)throw Error("Failed");return((await t.json()).chunks||[]).map(e=>e.content||"").filter(Boolean).join("\n\n").slice(0,12e3)}async function J(e){let t=await fetch("/api/prompt/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);throw Error(t.error||t.message||e||"AI 对话失败")}catch(t){throw Error(e||"AI 对话失败")}}return t.json()}function L(e){return e.id.startsWith("builtin:")}function M(e){return e.id.startsWith("custom:")}function U(e){return L(e)?"builtin":M(e)?"custom":e.isCurrent?"current":"project"}function G(e){return"custom"===e?"我的提示词":"current"===e?"当前项目":"project"===e?"其他项目":"builtin"===e?"内置示例":"全部"}function X(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:220,r=e.hasFile&&e.content?e.content.replace(/^#.*$/gm,"").replace(/\n{3,}/g,"\n\n").trim():"";return r.length>t?"".concat(r.slice(0,t),"..."):r}function Y(e){let t=Date.parse(e);return Number.isNaN(t)?"-":new Date(t).toLocaleString()}function Z(){let e=(0,o.Vr)(),{message:t}=n.A.useApp(),[r,Z]=(0,i.useState)(!0),[K,V]=(0,i.useState)([]),[$,q]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)(null),[et,er]=(0,i.useState)(""),[el,ei]=(0,i.useState)(""),[eo,en]=(0,i.useState)(!1),[ea,es]=(0,i.useState)(!1),[ec,ed]=(0,i.useState)("custom"),[ep,eh]=(0,i.useState)("all"),[eu,em]=(0,i.useState)("mtime"),[ex,ey]=(0,i.useState)("list"),[ef,eg]=(0,i.useState)(""),[ej,ev]=(0,i.useState)(null),[ew,eS]=(0,i.useState)([]),[eA,eb]=(0,i.useState)(!1),[eC,ek]=(0,i.useState)([]),[ez,eT]=(0,i.useState)(""),[eN,eE]=(0,i.useState)(""),[eF,eP]=(0,i.useState)(!1),[eR,eO]=(0,i.useState)([]),[eI,eB]=(0,i.useState)([]),[eW,eH]=(0,i.useState)(!1),[eD,e_]=(0,i.useState)(!1),eJ=(0,i.useRef)(null),eL=(0,i.useRef)(null),eM=async()=>{Z(!0);try{V(await R())}catch(r){t.error(e("common.error"))}finally{Z(!1)}};(0,i.useEffect)(()=>{eM()},[]),(0,i.useEffect)(()=>{let e=window.localStorage.getItem("customize-agent:prompt-view-mode");("list"===e||"card"===e)&&ey(e)},[]),(0,i.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",ex)},[ex]),(0,i.useEffect)(()=>{let e=eL.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),ez&&window.localStorage.setItem(ez,JSON.stringify(eC.slice(-30)))},[eC,eF,ez]),(0,i.useEffect)(()=>{!$||eR.length>0||eW||(eH(!0),D().then(eO).catch(()=>void 0).finally(()=>eH(!1)))},[$,eR.length,eW]);let eU=K.find(e=>e.isCurrent),eG=K.filter(M),eX={all:K.length,custom:K.filter(e=>"custom"===U(e)).length,current:K.filter(e=>"current"===U(e)).length,project:K.filter(e=>"project"===U(e)).length,builtin:K.filter(e=>"builtin"===U(e)).length,selected:K.filter(e=>e.selected).length,unselected:K.filter(e=>!e.selected).length,hasFile:K.filter(e=>e.hasFile).length,missingFile:K.filter(e=>!e.hasFile).length},eY=K.filter(e=>{var t;let r=U(e);return("all"===ec||r===ec)&&("selected"!==ep||!!e.selected)&&("unselected"!==ep||!e.selected)&&("hasFile"!==ep||!!e.hasFile)&&("missingFile"!==ep||!e.hasFile)&&(!ef.trim()||(t=ef.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===eu?e.projectName.localeCompare(t.projectName):"source"===eu?["custom","current","project","builtin"].indexOf(U(e))-["custom","current","project","builtin"].indexOf(U(t)):"selected"===eu&&Number(t.selected)-Number(e.selected)||Date.parse(t.mtime||"")-Date.parse(e.mtime||"")),eZ=eY.find(e=>e.id===ej)||eY[0]||null,eK=ew.filter(e=>eY.some(t=>t.id===e)),eV=(e,t)=>{let r="customize-agent:prompt-chat:".concat((null==e?void 0:e.id)||(null==e?void 0:e.customizePath)||t||"new");eT(r),ek(function(e){try{let t=JSON.parse(window.localStorage.getItem(e)||"[]");return Array.isArray(t)?t.filter(e=>("user"===e.role||"assistant"===e.role)&&"string"==typeof e.content).slice(-30):[]}catch(e){return[]}}(r)),eE(""),eP(!1),eB([]),e_(!1)},e$=r=>{if(null==r?void 0:r.projectRoot)return void I(r.projectRoot).then(()=>{t.success(e("common.success")),eM()}).catch(()=>t.error(e("common.error")));ee(null),es(!0),ei(""),er(""),eV(null,"new"),q(!0)},eq=async()=>{if(!el.trim())return void t.error("请输入名称");en(!0);try{Q?await O(Q.customizePath,et,M(Q)?el.trim():void 0):await B(el.trim(),et||"# ".concat(el.trim(),"\n")),t.success(e("common.success")),q(!1),await eM()}catch(r){t.error(e("common.error"))}finally{en(!1)}},eQ=async()=>{let e=Array.from(new Set([...eI,...eR.filter(e=>eN.includes("@".concat(e.relativePath))).map(e=>e.relativePath)])).slice(0,3),t=[];for(let r of e){let e=await _(r);e&&t.push({relativePath:r,content:e})}return t},e0=async()=>{let e=eN.trim();if(!e||eF)return;let r=[...eC,{role:"user",content:e}];ek(r),eE(""),e_(!1),eP(!0);try{let t=await eQ(),l=await J({name:el||(null==Q?void 0:Q.projectName)||"未命名提示词",content:et,message:e,history:eC,references:t});ek([...r,{role:"assistant",content:l.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),ek(r)}finally{eP(!1)}},e1=async(r,l)=>{let i=l?Array.from(new Set([...K.filter(e=>e.selected).map(e=>e.id),r.id])):K.filter(e=>e.selected&&e.id!==r.id).map(e=>e.id);try{await W(i),V(e=>e.map(e=>({...e,selected:i.includes(e.id)})))}catch(r){t.error(e("common.error"))}},e2=async r=>{let l=K.filter(e=>e.selected).map(e=>e.id),i=r?Array.from(new Set([...l,...eK])):l.filter(e=>!eK.includes(e));try{await W(i),V(e=>e.map(e=>({...e,selected:i.includes(e.id)}))),eS([]),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},e8=async r=>{try{if(!(await fetch("/api/prompt",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r.projectId,filePath:r.customizePath})})).ok)throw Error("Failed");t.success(e("common.success")),eS(e=>e.filter(e=>e!==r.id)),await eM()}catch(r){t.error(e("common.error"))}},e6=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"custom",r="checked"===e?K.filter(e=>eK.includes(e.id)):"filtered"===e?eY:eG;!function(e,t){let r=new Blob([t],{type:"text/plain;charset=utf-8"}),l=URL.createObjectURL(r),i=document.createElement("a");i.href=l,i.download=e,i.click(),URL.revokeObjectURL(l)}("customize-prompts-".concat(new Date().toISOString().slice(0,10),".txt"),r.map(e=>["# Prompt: ".concat(e.projectName),"Source: ".concat(G(U(e))),"Path: ".concat(e.customizePath||"-"),"Project: ".concat(e.projectRoot||"-"),"Selected: ".concat(e.selected?"true":"false"),"Updated: ".concat(Y(e.mtime)),"",e.content||""].join("\n")).join("\n\n---\n\n")),t.success("已导出 ".concat(r.length," 条提示词"))},e4=async e=>{if(e){eb(!0);try{let r=await e.text(),l=JSON.parse(r),i=await H(l);t.success("已导入 ".concat(i.imported," 条提示词")),await eM()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{eb(!1),eJ.current&&(eJ.current.value="")}}},e7=e=>{let t=U(e);return(0,l.jsxs)(a.A,{size:4,wrap:!0,children:[(0,l.jsx)(s.A,{color:"custom"===t?"cyan":"current"===t?"green":"project"===t?"blue":"builtin"===t?"gold":"default",style:{margin:0},children:G(t)}),e.selected&&(0,l.jsx)(s.A,{color:"purple",style:{margin:0},children:"已选中"}),!e.hasFile&&(0,l.jsx)(s.A,{style:{margin:0},children:"无文件"})]})},e5=e=>(0,l.jsxs)(a.A,{size:6,children:[e.hasFile&&(0,l.jsx)(c.A,{checked:e.selected,onChange:t=>{e1(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(w.A,{}),onClick:()=>e$(e),children:"创建"}),e.hasFile&&(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(S.A,{}),onClick:()=>(e=>{if(L(e)){let r=e.projectName.replace(/^内置|/,"")+" Copy";ee(null),es(!0),ei(r),er(e.content||""),eV(null,r),q(!0),t.info("内置提示词不可直接编辑,已为你创建副本");return}ee(e),es(!1),ei(e.projectName),er(e.content||""),eV(e,e.projectName),q(!0)})(e),children:L(e)?"复制":"编辑"}),(0,l.jsx)(p.A,{title:L(e)?"删除内置提示词?":M(e)?"删除自定义提示词?":"删除项目记录及文件?",disabled:L(e),onConfirm:()=>{e8(e)},children:(0,l.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,l.jsx)(A.A,{}),disabled:L(e)})})]});return r?(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsx)(u.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,l.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,l.jsx)(h.A,{size:"small",children:(0,l.jsx)(u.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,l.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,l.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,l.jsxs)(a.A,{wrap:!0,children:[eU&&(0,l.jsxs)(s.A,{color:"green",style:{lineHeight:"22px"},children:[(0,l.jsx)(C.A,{})," ",eU.projectRoot]}),(0,l.jsx)("input",{ref:eJ,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;e4(null==(t=e.target.files)?void 0:t[0])}}),(0,l.jsx)(d.Ay,{icon:(0,l.jsx)(k.A,{}),loading:eA,onClick:()=>{var e;return null==(e=eJ.current)?void 0:e.click()},children:"导入"}),(0,l.jsx)(d.Ay,{icon:(0,l.jsx)(z.A,{}),disabled:0===eY.length,onClick:()=>e6("filtered"),children:"导出筛选"}),(0,l.jsx)(d.Ay,{type:"primary",icon:(0,l.jsx)(w.A,{}),onClick:()=>e$(),children:"创建提示词"})]})]}),(0,l.jsxs)(h.A,{size:"small",styles:{body:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"}},children:[(0,l.jsx)(m.A,{prefix:(0,l.jsx)(T.A,{}),allowClear:!0,placeholder:"搜索名称、内容、路径...",value:ef,onChange:e=>eg(e.target.value),style:{width:280}}),(0,l.jsx)(x.A,{value:ec,onChange:ed,style:{width:150},options:[{label:"全部 (".concat(eX.all,")"),value:"all"},{label:"我的提示词 (".concat(eX.custom,")"),value:"custom"},{label:"当前项目 (".concat(eX.current,")"),value:"current"},{label:"其他项目 (".concat(eX.project,")"),value:"project"},{label:"内置示例 (".concat(eX.builtin,")"),value:"builtin"}]}),(0,l.jsx)(x.A,{value:ep,onChange:eh,style:{width:130},options:[{label:"全部状态",value:"all"},{label:"已选中 (".concat(eX.selected,")"),value:"selected"},{label:"未选中 (".concat(eX.unselected,")"),value:"unselected"},{label:"有文件 (".concat(eX.hasFile,")"),value:"hasFile"},{label:"无文件 (".concat(eX.missingFile,")"),value:"missingFile"}]}),(0,l.jsx)(x.A,{value:eu,onChange:em,style:{width:140},options:[{label:"最近修改优先",value:"mtime"},{label:"名称 A-Z",value:"name"},{label:"来源优先",value:"source"},{label:"已选中优先",value:"selected"}]}),(0,l.jsx)(y.A,{value:ex,onChange:e=>ey(e),options:[{label:(0,l.jsx)(N.A,{}),value:"list"},{label:(0,l.jsx)(E.A,{}),value:"card"}]}),(0,l.jsx)("div",{style:{flex:1}}),(0,l.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:13},children:["已显示 ",eY.length," / ",K.length]})]}),(0,l.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"190px minmax(0, 1fr) 300px",gap:14,alignItems:"start"},children:[(0,l.jsxs)(h.A,{size:"small",title:"分组导航",styles:{body:{padding:8}},children:[[["all","全部",eX.all],["custom","我的提示词",eX.custom],["current","当前项目",eX.current],["project","其他项目",eX.project],["builtin","内置示例",eX.builtin]].map(e=>{let[t,r,i]=e;return(0,l.jsxs)("button",{onClick:()=>ed(t),style:{width:"100%",border:"none",background:ec===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:ec===t?700:400},children:[(0,l.jsx)("span",{children:r}),(0,l.jsx)("span",{children:i})]},t)}),(0,l.jsx)(f.A,{style:{margin:"8px 0"}}),[["selected","已选中",eX.selected],["unselected","未选中",eX.unselected]].map(e=>{let[t,r,i]=e;return(0,l.jsxs)("button",{onClick:()=>eh(ep===t?"all":t),style:{width:"100%",border:"none",background:ep===t?"var(--colorFillSecondary)":"transparent",color:"var(--colorText)",padding:"9px 10px",borderRadius:8,display:"flex",justifyContent:"space-between",cursor:"pointer",fontWeight:ep===t?700:400},children:[(0,l.jsx)("span",{children:r}),(0,l.jsx)("span",{children:i})]},t)})]}),(0,l.jsxs)("div",{style:{minWidth:0},children:[eK.length>0&&(0,l.jsxs)(h.A,{size:"small",style:{marginBottom:12},styles:{body:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},children:[(0,l.jsxs)("span",{style:{fontWeight:600},children:["已选择 ",eK.length," 项"]}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>{e2(!0)},children:"批量选中"}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>{e2(!1)},children:"取消选中"}),(0,l.jsx)(d.Ay,{size:"small",icon:(0,l.jsx)(z.A,{}),onClick:()=>e6("checked"),children:"导出选中"}),(0,l.jsx)(d.Ay,{size:"small",onClick:()=>eS([]),children:"清空选择"})]}),0===eY.length?(0,l.jsx)(h.A,{children:(0,l.jsx)(g.A,{description:ef||"all"!==ep?"没有找到匹配的提示词,请尝试更换关键词或清空筛选条件":"当前分组没有提示词"})}):"list"===ex?(0,l.jsx)(a.A,{direction:"vertical",size:10,style:{width:"100%"},children:eY.map(e=>{let t=X(e,180),r=(null==eZ?void 0:eZ.id)===e.id;return(0,l.jsxs)("div",{onClick:()=>ev(e.id),style:{display:"grid",gridTemplateColumns:"28px minmax(0, 1fr) auto",gap:12,alignItems:"center",padding:14,border:"1px solid ".concat(r?"var(--colorAccent)":"var(--colorBorderSecondary)"),borderRadius:12,background:r?"var(--colorFillSecondary)":"var(--colorBgContainer)",cursor:"pointer",transition:"all .2s ease"},children:[(0,l.jsx)(c.A,{checked:ew.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eS(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,l.jsxs)("div",{style:{minWidth:0},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,l.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.projectName}),e7(e)]}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:6*!!t},children:[(0,l.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"," \xb7 ",Y(e.mtime)]}),t&&(0,l.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-wrap"},children:t})]}),(0,l.jsx)("div",{onClick:e=>e.stopPropagation(),children:e5(e)})]},e.id)})}):(0,l.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:12},children:eY.map(e=>{let t=X(e,180),r=(null==eZ?void 0:eZ.id)===e.id;return(0,l.jsxs)(h.A,{size:"small",hoverable:!0,onClick:()=>ev(e.id),style:{borderColor:r?"var(--colorAccent)":void 0},styles:{body:{display:"flex",flexDirection:"column",minHeight:210}},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,l.jsx)(c.A,{checked:ew.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eS(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,l.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName})]}),(0,l.jsx)("div",{style:{marginBottom:8},children:e7(e)}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:[(0,l.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,l.jsx)("div",{style:{padding:10,background:"var(--colorFillAlter)",borderRadius:8,color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.6,minHeight:72,maxHeight:72,overflow:"hidden",whiteSpace:"pre-wrap"},children:t||"暂无内容预览"}),(0,l.jsxs)("div",{style:{marginTop:"auto",paddingTop:10,borderTop:"1px solid var(--colorBorderSecondary)",display:"flex",justifyContent:"space-between",alignItems:"center"},onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:Y(e.mtime)}),e5(e)]})]},e.id)})})]}),(0,l.jsx)(h.A,{size:"small",title:"详情预览",styles:{body:{display:"flex",flexDirection:"column",gap:10}},children:eZ?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,l.jsx)(b.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)("strong",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:eZ.projectName})]}),(0,l.jsx)("div",{children:e7(eZ)}),(0,l.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7},children:[(0,l.jsxs)("div",{children:["更新时间:",Y(eZ.mtime)]}),(0,l.jsxs)("div",{children:["文件路径:",eZ.customizePath||"-"]}),(0,l.jsxs)("div",{children:["项目路径:",eZ.projectRoot||"-"]})]}),(0,l.jsx)("div",{style:{padding:10,borderRadius:8,background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,maxHeight:260,overflow:"auto",whiteSpace:"pre-wrap"},children:X(eZ,1200)||"暂无内容预览"}),(0,l.jsx)("div",{children:e5(eZ)})]}):(0,l.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"请选择一个提示词"})})]}),(0,l.jsxs)(j.A,{title:ea?"创建提示词":Q&&M(Q)?"编辑我的提示词 — ".concat(el||Q.projectName):"编辑项目提示词 — ".concat((null==Q?void 0:Q.projectName)||""),open:$,onClose:()=>q(!1),width:980,maskClosable:!1,style:{borderRadius:"12px 0 0 12px"},styles:{body:{padding:"16px 24px",display:"grid",gridTemplateRows:"minmax(320px, 1fr) 420px",gap:14,height:"100%"},header:{borderRadius:"12px 0 0 0",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.Ay,{onClick:()=>q(!1),children:e("common.cancel")}),(0,l.jsx)(d.Ay,{type:"primary",loading:eo,onClick:()=>{eq()},children:e("common.save")})]}),children:[(0,l.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,l.jsx)("div",{style:{marginBottom:12},children:ea||Q&&M(Q)?(0,l.jsxs)(a.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsx)(m.A,{placeholder:"提示词名称",value:el,onChange:e=>ei(e.target.value),style:{maxWidth:520}}),!ea&&(0,l.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==Q?void 0:Q.customizePath})]}):(0,l.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==Q?void 0:Q.customizePath})}),(0,l.jsx)(m.A.TextArea,{value:et,onChange:e=>er(e.target.value),style:{flex:1,minHeight:280,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}})]}),(0,l.jsxs)("div",{style:{minHeight:0,border:"1px solid var(--colorBorderSecondary)",borderRadius:10,background:"var(--colorBgContainer)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 8px 24px rgba(15, 23, 42, 0.06)"},children:[(0,l.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,l.jsxs)(a.A,{size:6,children:[(0,l.jsx)(F.A,{style:{color:"var(--colorAccent)"}}),(0,l.jsx)("span",{style:{fontWeight:600},children:"AI 提示词助手"})]}),(0,l.jsxs)(a.A,{size:6,children:[eC.length>0&&(0,l.jsx)(d.Ay,{size:"small",onClick:()=>ek([]),children:"清空历史"}),eF?(0,l.jsx)(s.A,{color:"processing",style:{margin:0},children:"生成中"}):(0,l.jsx)(s.A,{color:"blue",style:{margin:0},children:"可对话优化"})]})]}),(0,l.jsx)("div",{ref:eL,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==eC.length||eF?(0,l.jsxs)(a.A,{direction:"vertical",size:12,style:{width:"100%"},children:[eC.map((e,r)=>{let i="user"===e.role;return(0,l.jsx)("div",{style:{display:"flex",justifyContent:i?"flex-end":"flex-start"},children:(0,l.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:i?"var(--colorFillSecondary)":"var(--colorBgContainer)",color:"var(--colorText)",border:"1px solid var(--colorBorderSecondary)",whiteSpace:"pre-wrap",lineHeight:1.7,fontSize:13,transition:"all .2s ease"},children:[e.content,!i&&(0,l.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,l.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{er(e.content),t.success("已应用到编辑内容,请确认后保存")},children:"应用"})})]})},"".concat(e.role,"-").concat(r))}),eF&&(0,l.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,l.jsxs)("div",{style:{padding:"10px 12px",borderRadius:12,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"AI 正在分析并生成内容..."]})})]}):(0,l.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"输入 @ 召回知识库文件,再描述你的优化目标"})}),(0,l.jsx)(f.A,{style:{margin:0}}),(0,l.jsxs)("div",{style:{padding:12},children:[eI.length>0&&(0,l.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:eI.map(e=>(0,l.jsxs)(s.A,{closable:!0,onClose:()=>eB(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),eD&&(0,l.jsx)("div",{style:{maxHeight:150,overflowY:"auto",marginBottom:8,border:"1px solid var(--colorBorderSecondary)",borderRadius:8,background:"var(--colorBgContainer)"},children:eW?(0,l.jsxs)("div",{style:{padding:10,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,l.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在加载知识库文件..."]}):0===eR.length?(0,l.jsx)("div",{style:{padding:10,color:"var(--colorTextSecondary)",fontSize:12},children:"暂无可召回的知识库文件"}):eR.slice(0,30).map(e=>(0,l.jsxs)("div",{onMouseDown:t=>{var r;t.preventDefault(),r=e.relativePath,eB(e=>e.includes(r)?e:[...e,r]),eE(e=>e.endsWith("@")?"".concat(e).concat(r," "):"".concat(e," @").concat(r," ")),e_(!1)},style:{padding:"8px 10px",cursor:"pointer",borderBottom:"1px solid var(--colorBorderSecondary)",fontSize:12},children:[(0,l.jsx)(b.A,{style:{marginRight:6,color:"var(--colorAccent)"}}),e.relativePath]},e.relativePath))}),(0,l.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,l.jsx)(m.A.TextArea,{value:eN,onChange:e=>{eE(e.target.value),e_(e.target.value.endsWith("@"))},onFocus:()=>e_(eN.endsWith("@")),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e0())},disabled:eF,placeholder:"输入 @ 召回知识库文件,再描述优化目标...",autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,l.jsx)(d.Ay,{type:"primary",icon:(0,l.jsx)(P.A,{}),loading:eF,disabled:!eN.trim(),onClick:()=>{e0()},children:"发送"})]})]})]})]})]})}}},e=>{e.O(0,[433,787,576,195,985,525,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);