@customize-agent/server 4.0.31 → 4.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +34 -46
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +0 -6
- package/.next/server/chunks/1928.js +1 -1
- package/.next/server/chunks/1936.js +1 -1
- package/.next/server/chunks/3298.js +101 -0
- package/.next/server/chunks/8204.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/assets/generated/preview.js +1 -1
- package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -1
- package/.next/server/pages/api/assets/generated.js +1 -1
- package/.next/server/pages/api/assets/generated.js.nft.json +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js +1 -1
- package/.next/server/pages/api/documents/chapter/regenerate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/export.js +1 -1
- package/.next/server/pages/api/documents/export.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generate.js +2 -2
- package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated/[id].js +1 -1
- package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -1
- package/.next/server/pages/api/documents/generated.js +1 -1
- package/.next/server/pages/api/documents/generated.js.nft.json +1 -1
- package/.next/server/pages/api/documents/roles.js +1 -1
- package/.next/server/pages/api/documents/templates.js +1 -1
- package/.next/server/pages/api/documents/templates.js.nft.json +1 -1
- package/.next/server/pages/api/kb/files.js +1 -1
- package/.next/server/pages/api/prompt.js +1 -1
- package/.next/server/pages/asset-library.html +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages-manifest.json +22 -24
- package/.next/static/chunks/289-30e7c55f49a896b7.js +38 -0
- package/.next/static/chunks/455-97ad88d6604f54b7.js +6 -0
- package/.next/static/chunks/496-4fb9a063790e65ff.js +1 -0
- package/.next/static/chunks/53-d534407b1397d66a.js +1 -0
- package/.next/static/chunks/647-d5e08fda405f7059.js +1 -0
- package/.next/static/chunks/694-2d545cfbb9779f2c.js +1 -0
- package/.next/static/chunks/795-d8fb7a0420512701.js +1 -0
- package/.next/static/chunks/861-91cbdd34b8e23151.js +1 -0
- package/.next/static/chunks/pages/{_app-8abe93a007ab30a7.js → _app-2df1181f6609ae11.js} +2 -2
- package/.next/static/chunks/pages/context/{long-term-2e6a30a8f879df47.js → long-term-6b9a9683a4d6ea86.js} +1 -1
- package/.next/static/chunks/pages/context/{short-term-730211234fa3add6.js → short-term-6078efae6e3a905c.js} +1 -1
- package/.next/static/chunks/pages/document-roles-cb222be93cfd561d.js +1 -0
- package/.next/static/chunks/pages/documents-fc1a4fdb681f49a2.js +1 -0
- package/.next/static/chunks/pages/guide-7d15d3d3ddb0205e.js +1 -0
- package/.next/static/chunks/pages/{index-591c5acdff8d0690.js → index-a2a24e9602e7ea52.js} +1 -1
- package/.next/static/chunks/pages/knowledge/{file-detail-0a5e267f77f4e8b3.js → file-detail-97c77dfaf472a4b6.js} +1 -1
- package/.next/static/chunks/pages/knowledge/files-75a33100a1b3b5b5.js +1 -0
- package/.next/static/chunks/pages/models-d5e80645dc4a61b1.js +1 -0
- package/.next/static/chunks/pages/{overview-8d8ba5a1c0aa39ea.js → overview-1260176045ed5f7a.js} +1 -1
- package/.next/static/chunks/pages/prompt-9b869fbe3463020d.js +1 -0
- package/.next/static/chunks/pages/system/{logs-f4e222140dc7b30c.js → logs-3826fa44a76b12fc.js} +1 -1
- package/.next/static/trRaWc1ebFq78iuTpvU9H/_buildManifest.js +1 -0
- package/package.json +13 -13
- package/.next/server/chunks/3445.js +0 -76
- package/.next/server/pages/api/documents/specs.js +0 -1
- package/.next/server/pages/api/documents/specs.js.nft.json +0 -1
- package/.next/server/pages/document-specs.html +0 -1
- package/.next/server/pages/document-specs.js.nft.json +0 -1
- package/.next/static/0HB7cANSrxY1wLaf736r0/_buildManifest.js +0 -1
- package/.next/static/chunks/130-c1e5c14958fcba2b.js +0 -1
- package/.next/static/chunks/131-e2f0164f12b82496.js +0 -1
- package/.next/static/chunks/265-32ec272a49cfacef.js +0 -1
- package/.next/static/chunks/289-6bf8af72114aefd5.js +0 -38
- package/.next/static/chunks/455-e04e99d9e242de44.js +0 -6
- package/.next/static/chunks/512-12bd409cebeca05b.js +0 -1
- package/.next/static/chunks/698-5f16390243596219.js +0 -1
- package/.next/static/chunks/795-67a87e03d67ed908.js +0 -1
- package/.next/static/chunks/pages/document-roles-4293f5fae599ff83.js +0 -1
- package/.next/static/chunks/pages/document-specs-0fa19a0e348efc80.js +0 -1
- package/.next/static/chunks/pages/documents-3b87f1bf389b2f18.js +0 -1
- package/.next/static/chunks/pages/guide-74f0f7f42bc211b0.js +0 -1
- package/.next/static/chunks/pages/knowledge/files-4b0132dd66e57085.js +0 -1
- package/.next/static/chunks/pages/models-b5f68c4c70257495.js +0 -1
- package/.next/static/chunks/pages/prompt-3468fb841f4c5c8c.js +0 -1
- /package/.next/static/{0HB7cANSrxY1wLaf736r0 → trRaWc1ebFq78iuTpvU9H}/_ssgManifest.js +0 -0
|
@@ -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:()=>q});var o=r(65321),l=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),m=r(88762),u=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),F=r(46082),N=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 R(e,t,r){let o=await fetch("/api/prompt",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:e,content:t,name:r})});if(!o.ok)throw Error("Failed");return o.json()}async function O(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 P(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,o=new URLSearchParams({limit:String(r)});e.trim()&&o.set("q",e.trim()),t||o.set("includeContent","0");let l=await fetch("/api/kb/files/search?".concat(o));return l.ok&&(await l.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("custom:")}function U(e){return M(e)?"custom":e.isCurrent?"current":"project"}function $(e){return"custom"===e?"我的提示词":"current"===e?"当前项目":"project"===e?"其他项目":"全部"}function G(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 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(e){let t=e.match(/(^|\s)@([^\s@]*)$/);return t?t[2]:null}function q(){let e=(0,i.Vr)(),{message:t}=n.A.useApp(),[r,q]=(0,l.useState)(!0),[K,V]=(0,l.useState)([]),[Q,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(null),[eo,el]=(0,l.useState)(""),[ei,en]=(0,l.useState)(""),[ea,es]=(0,l.useState)(!1),[ec,ed]=(0,l.useState)(!1),[ep,eh]=(0,l.useState)("custom"),[em,eu]=(0,l.useState)("all"),[ex,ey]=(0,l.useState)("mtime"),[ef,eg]=(0,l.useState)("list"),[ej,ev]=(0,l.useState)(""),[ew,eS]=(0,l.useState)(null),[eA,eb]=(0,l.useState)([]),[eC,ek]=(0,l.useState)(!1),[ez,eT]=(0,l.useState)([]),[eF,eN]=(0,l.useState)(""),[eB,eE]=(0,l.useState)(""),[eI,eR]=(0,l.useState)(!1),[eO,eP]=(0,l.useState)([]),[eW,eD]=(0,l.useState)([]),[eH,e_]=(0,l.useState)([]),[eJ,eL]=(0,l.useState)(!1),[eM,eU]=(0,l.useState)(!1),[e$,eG]=(0,l.useState)(!1),eX=(0,l.useRef)(null),eY=(0,l.useRef)(null),eZ=Z(eB),eq=async()=>{q(!0);try{V(await I())}catch(r){t.error(e("common.error"))}finally{q(!1)}};(0,l.useEffect)(()=>{eq()},[]),(0,l.useEffect)(()=>{let e=window.localStorage.getItem("customize-agent:prompt-view-mode");("list"===e||"card"===e)&&eg(e)},[]),(0,l.useEffect)(()=>{window.localStorage.setItem("customize-agent:prompt-view-mode",ef)},[ef]),(0,l.useEffect)(()=>{let e=eY.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),eF&&window.localStorage.setItem(eF,JSON.stringify(ez.slice(-30)))},[ez,eI,eF]),(0,l.useEffect)(()=>{!Q||eO.length>0||eJ||(eL(!0),H().then(eP).catch(()=>void 0).finally(()=>eL(!1)))},[Q,eO.length,eJ]),(0,l.useEffect)(()=>{let e=null==eZ?void 0:eZ.trim();if(!Q||!e){eD([]),eU(!1);return}let t=!1;eU(!0);let r=window.setTimeout(()=>{J(e).then(e=>{t||eD(e)}).catch(()=>{t||eD([])}).finally(()=>{t||eU(!1)})},250);return()=>{t=!0,window.clearTimeout(r)}},[Q,eZ]);let eK=K.find(e=>e.isCurrent),eV=K.filter(M),eQ={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,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},e0=K.filter(e=>{var t;let r=U(e);return("all"===ep||r===ep)&&("selected"!==em||!!e.selected)&&("unselected"!==em||!e.selected)&&("hasFile"!==em||!!e.hasFile)&&("missingFile"!==em||!e.hasFile)&&(!ej.trim()||(t=ej.trim(),!!"".concat(e.projectName,"\n").concat(e.projectRoot||"","\n").concat(e.customizePath||"","\n").concat(e.content||"").toLowerCase().includes(t.toLowerCase())))}).sort((e,t)=>"name"===ex?e.projectName.localeCompare(t.projectName):"source"===ex?["custom","current","project"].indexOf(U(e))-["custom","current","project"].indexOf(U(t)):"selected"===ex&&Number(t.selected)-Number(e.selected)||Date.parse(t.mtime||"")-Date.parse(e.mtime||"")),e1=e0.find(e=>e.id===ew)||e0[0]||null,e2=eA.filter(e=>e0.some(t=>t.id===e)),e8=(null==eZ?void 0:eZ.trim())?eW:eO,e4=(e,t,r)=>{let o=G(e,t,r);eN(o),eT(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[]}}(o)),eE(""),eR(!1),e_([]),eG(!1)},e6=r=>{if(null==r?void 0:r.projectRoot)return void O(r.projectRoot).then(()=>{t.success(e("common.success")),eq()}).catch(()=>t.error(e("common.error")));let o="new:".concat(Date.now());er(null),ed(!0),en(""),el(""),e4(null,"new",o),ee(!0)},e7=async()=>{if(!ei.trim())return void t.error("请输入名称");es(!0);try{if(et)await R(et.customizePath,eo,M(et)?ei.trim():void 0),t.success(e("common.success"));else{let r=await P(ei.trim(),eo||"# ".concat(ei.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,G({id:r.id,projectId:r.id,projectName:ei.trim(),customizePath:r.id,content:eo,mtime:"",hasFile:!0,isCurrent:!1,selected:!1,source:"custom"},ei.trim())),t.success(e("common.success"))}ee(!1),await eq()}catch(r){t.error(e("common.error"))}finally{es(!1)}},e3=async e=>{let t=Array.from(new Set([...eH,...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},e5=async()=>{let e=eB.trim();if(!e||eI)return;let r=[...ez,{role:"user",content:e}];eT(r),eE(""),eG(!1),eR(!0);try{let t=await e3(e),o=await L({name:ei||(null==et?void 0:et.projectName)||"未命名提示词",content:eo,message:e,history:ez,references:t});eT([...r,{role:"assistant",content:o.content||"AI 未返回内容"}])}catch(e){t.error(e instanceof Error?e.message:"AI 对话失败,请检查模型配置"),eT(r)}finally{eR(!1)}},e9=async(r,o)=>{let l=o?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(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)})))}catch(r){t.error(e("common.error"))}},te=async r=>{let o=K.filter(e=>e.selected).map(e=>e.id),l=r?Array.from(new Set([...o,...e2])):o.filter(e=>!e2.includes(e));try{await W(l),V(e=>e.map(e=>({...e,selected:l.includes(e.id)}))),eb([]),t.success(e("common.success"))}catch(r){t.error(e("common.error"))}},tt=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")),eb(e=>e.filter(e=>e!==r.id)),await eq()}catch(r){t.error(e("common.error"))}},tr=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"custom",r="checked"===e?K.filter(e=>e2.includes(e.id)):"filtered"===e?e0:eV;!function(e,t){let r=new Blob([t],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(r),l=document.createElement("a");l.href=o,l.download=e,l.click(),URL.revokeObjectURL(o)}("customize-prompts-".concat(new Date().toISOString().slice(0,10),".txt"),r.map(e=>["# Prompt: ".concat(e.projectName),"Source: ".concat($(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," 条提示词"))},to=async e=>{if(e){ek(!0);try{let r=await e.text(),o=JSON.parse(r),l=await D(o);t.success("已导入 ".concat(l.imported," 条提示词")),await eq()}catch(e){t.error("导入失败,请确认 JSON 文件格式正确")}finally{ek(!1),eX.current&&(eX.current.value="")}}},tl=e=>{let t=U(e);return(0,o.jsxs)(a.A,{size:4,wrap:!0,children:[(0,o.jsx)(s.A,{color:"custom"===t?"cyan":"current"===t?"green":"project"===t?"blue":"default",style:{margin:0},children:$(t)}),e.selected&&(0,o.jsx)(s.A,{color:"purple",style:{margin:0},children:"已选中"}),!e.hasFile&&(0,o.jsx)(s.A,{style:{margin:0},children:"无文件"})]})},ti=e=>(0,o.jsxs)(a.A,{size:6,children:[e.hasFile&&(0,o.jsx)(c.A,{checked:e.selected,onChange:t=>{e9(e,t.target.checked)},children:"选中"}),!e.hasFile&&e.projectRoot&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(w.A,{}),onClick:()=>e6(e),children:"创建"}),e.hasFile&&(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(S.A,{}),onClick:()=>{er(e),ed(!1),en(e.projectName),el(e.content||""),e4(e,e.projectName),ee(!0)},children:"编辑"}),(0,o.jsx)(p.A,{title:M(e)?"删除自定义提示词?":"删除项目记录及文件?",onConfirm:()=>{tt(e)},children:(0,o.jsx)(d.Ay,{size:"small",danger:!0,icon:(0,o.jsx)(A.A,{})})})]});return r?(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsx)(m.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:12},children:Array.from({length:4}).map((e,t)=>(0,o.jsx)(h.A,{size:"small",children:(0,o.jsx)(m.A,{active:!0,paragraph:{rows:4}})},t))})]}):(0,o.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:12},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"pageTitle",children:e("nav.promptManagement")}),(0,o.jsx)("p",{className:"pageDesc",children:e("prompt.description")})]}),(0,o.jsxs)(a.A,{wrap:!0,children:[eK&&(0,o.jsxs)(s.A,{color:"green",style:{lineHeight:"22px"},children:[(0,o.jsx)(C.A,{})," ",eK.projectRoot]}),(0,o.jsx)("input",{ref:eX,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:e=>{var t;to(null==(t=e.target.files)?void 0:t[0])}}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(k.A,{}),loading:eC,onClick:()=>{var e;return null==(e=eX.current)?void 0:e.click()},children:"导入"}),(0,o.jsx)(d.Ay,{icon:(0,o.jsx)(z.A,{}),disabled:0===e0.length,onClick:()=>tr("filtered"),children:"导出筛选"}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(w.A,{}),onClick:()=>e6(),children:"创建提示词"})]})]}),(0,o.jsxs)(h.A,{size:"small",styles:{body:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"}},children:[(0,o.jsx)(u.A,{prefix:(0,o.jsx)(T.A,{}),allowClear:!0,placeholder:"搜索名称、内容、路径...",value:ej,onChange:e=>ev(e.target.value),style:{width:280}}),(0,o.jsx)(x.A,{value:ep,onChange:eh,style:{width:150},options:[{label:"全部 (".concat(eQ.all,")"),value:"all"},{label:"我的提示词 (".concat(eQ.custom,")"),value:"custom"},{label:"当前项目 (".concat(eQ.current,")"),value:"current"},{label:"其他项目 (".concat(eQ.project,")"),value:"project"}]}),(0,o.jsx)(x.A,{value:em,onChange:eu,style:{width:130},options:[{label:"全部状态",value:"all"},{label:"已选中 (".concat(eQ.selected,")"),value:"selected"},{label:"未选中 (".concat(eQ.unselected,")"),value:"unselected"},{label:"有文件 (".concat(eQ.hasFile,")"),value:"hasFile"},{label:"无文件 (".concat(eQ.missingFile,")"),value:"missingFile"}]}),(0,o.jsx)(x.A,{value:ex,onChange:ey,style:{width:140},options:[{label:"最近修改优先",value:"mtime"},{label:"名称 A-Z",value:"name"},{label:"来源优先",value:"source"},{label:"已选中优先",value:"selected"}]}),(0,o.jsx)(y.A,{value:ef,onChange:e=>eg(e),options:[{label:(0,o.jsx)(F.A,{}),value:"list"},{label:(0,o.jsx)(N.A,{}),value:"card"}]}),(0,o.jsx)("div",{style:{flex:1}}),(0,o.jsxs)("span",{style:{color:"var(--colorTextSecondary)",fontSize:13},children:["已显示 ",e0.length," / ",K.length]})]}),(0,o.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"260px minmax(0, 1fr)",gap:14,alignItems:"start"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[(0,o.jsxs)(h.A,{size:"small",title:"分组导航",styles:{body:{padding:8}},children:[[["all","全部",eQ.all],["custom","我的提示词",eQ.custom],["current","当前项目",eQ.current],["project","其他项目",eQ.project]].map(e=>{let[t,r,l]=e;return(0,o.jsxs)("button",{onClick:()=>eh(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,o.jsx)("span",{children:r}),(0,o.jsx)("span",{children:l})]},t)}),(0,o.jsx)(f.A,{style:{margin:"8px 0"}}),[["selected","已选中",eQ.selected],["unselected","未选中",eQ.unselected]].map(e=>{let[t,r,l]=e;return(0,o.jsxs)("button",{onClick:()=>eu(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,o.jsx)("span",{children:r}),(0,o.jsx)("span",{children:l})]},t)})]}),(0,o.jsx)(h.A,{size:"small",title:"详情预览",styles:{body:{height:300,display:"flex",flexDirection:"column",gap:10,overflow:"hidden"}},children:e1?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[(0,o.jsx)(b.A,{style:{color:"var(--colorAccent)",flexShrink:0}}),(0,o.jsx)("strong",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e1.projectName})]}),(0,o.jsx)("div",{style:{minWidth:0,overflow:"hidden"},children:tl(e1)}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,minWidth:0},children:[(0,o.jsxs)("div",{children:["更新时间:",Y(e1.mtime)]}),(0,o.jsxs)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["文件路径:",e1.customizePath||"-"]}),(0,o.jsxs)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["项目路径:",e1.projectRoot||"-"]})]}),(0,o.jsx)("div",{style:{flex:1,minHeight:0,padding:10,borderRadius:8,background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)",fontSize:12,lineHeight:1.7,overflow:"auto",whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word"},children:X(e1,800)||"暂无内容预览"}),(0,o.jsx)("div",{children:ti(e1)})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"请选择一个提示词"})})]}),(0,o.jsxs)("div",{style:{minWidth:0},children:[e2.length>0&&(0,o.jsxs)(h.A,{size:"small",style:{marginBottom:12},styles:{body:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},children:[(0,o.jsxs)("span",{style:{fontWeight:600},children:["已选择 ",e2.length," 项"]}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!0)},children:"批量选中"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>{te(!1)},children:"取消选中"}),(0,o.jsx)(d.Ay,{size:"small",icon:(0,o.jsx)(z.A,{}),onClick:()=>tr("checked"),children:"导出选中"}),(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eb([]),children:"清空选择"})]}),0===e0.length?(0,o.jsx)(h.A,{children:(0,o.jsx)(g.A,{description:ej||"all"!==em?"没有找到匹配的提示词,请尝试更换关键词或清空筛选条件":"当前分组没有提示词"})}):"list"===ef?(0,o.jsx)(a.A,{direction:"vertical",size:10,style:{width:"100%"},children:e0.map(e=>{let t=X(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)("div",{onClick:()=>eS(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,o.jsx)(c.A,{checked:eA.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eb(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,o.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.projectName}),tl(e)]}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:6*!!t},children:[(0,o.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"," \xb7 ",Y(e.mtime)]}),t&&(0,o.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,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:ti(e)})]},e.id)})}):(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:12},children:e0.map(e=>{let t=X(e,180),r=(null==e1?void 0:e1.id)===e.id;return(0,o.jsxs)(h.A,{size:"small",hoverable:!0,onClick:()=>eS(e.id),style:{borderColor:r?"var(--colorAccent)":void 0},styles:{body:{display:"flex",flexDirection:"column",minHeight:210}},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,o.jsx)(c.A,{checked:eA.includes(e.id),onClick:e=>e.stopPropagation(),onChange:t=>eb(r=>t.target.checked?Array.from(new Set([...r,e.id])):r.filter(t=>t!==e.id))}),(0,o.jsx)(b.A,{style:{color:e.isCurrent?"var(--colorOk)":"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e.projectName})]}),(0,o.jsx)("div",{style:{marginBottom:8},children:tl(e)}),(0,o.jsxs)("div",{style:{color:"var(--colorTextSecondary)",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:[(0,o.jsx)(C.A,{style:{marginRight:4}}),e.projectRoot||e.customizePath||"本地提示词"]}),(0,o.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,o.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,o.jsx)("span",{style:{color:"var(--colorTextSecondary)",fontSize:12},children:Y(e.mtime)}),ti(e)]})]},e.id)})})]})]}),(0,o.jsxs)(j.A,{title:ec?"创建提示词":et&&M(et)?"编辑我的提示词 — ".concat(ei||et.projectName):"编辑项目提示词 — ".concat((null==et?void 0:et.projectName)||""),open:Q,onClose:()=>ee(!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,o.jsxs)(a.A,{children:[(0,o.jsx)(d.Ay,{onClick:()=>ee(!1),children:e("common.cancel")}),(0,o.jsx)(d.Ay,{type:"primary",loading:ea,onClick:()=>{e7()},children:e("common.save")})]}),children:[(0,o.jsxs)("div",{style:{minHeight:0,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{marginBottom:12},children:ec||et&&M(et)?(0,o.jsxs)(a.A,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,o.jsx)(u.A,{placeholder:"提示词名称",value:ei,onChange:e=>en(e.target.value),style:{maxWidth:520}}),!ec&&(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==et?void 0:et.customizePath})]}):(0,o.jsx)("div",{style:{fontSize:12,color:"var(--colorTextSecondary)"},children:null==et?void 0:et.customizePath})}),(0,o.jsx)(u.A.TextArea,{value:eo,onChange:e=>el(e.target.value),style:{flex:1,minHeight:280,fontFamily:"SF Mono, Monaco, Consolas, monospace",fontSize:13,resize:"none"}})]}),(0,o.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,o.jsxs)("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--colorBorderSecondary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,o.jsxs)(a.A,{size:6,children:[(0,o.jsx)(B.A,{style:{color:"var(--colorAccent)"}}),(0,o.jsx)("span",{style:{fontWeight:600},children:"AI 提示词助手"})]}),(0,o.jsxs)(a.A,{size:6,children:[ez.length>0&&(0,o.jsx)(d.Ay,{size:"small",onClick:()=>eT([]),children:"清空历史"}),eI?(0,o.jsx)(s.A,{color:"processing",style:{margin:0},children:"生成中"}):(0,o.jsx)(s.A,{color:"blue",style:{margin:0},children:"可对话优化"})]})]}),(0,o.jsx)("div",{ref:eY,style:{flex:1,minHeight:0,overflowY:"auto",padding:14,background:"var(--colorFillAlter)"},children:0!==ez.length||eI?(0,o.jsxs)(a.A,{direction:"vertical",size:12,style:{width:"100%"},children:[ez.map((e,r)=>{let l="user"===e.role;return(0,o.jsx)("div",{style:{display:"flex",justifyContent:l?"flex-end":"flex-start"},children:(0,o.jsxs)("div",{style:{maxWidth:"78%",padding:"10px 12px",borderRadius:12,background:l?"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,!l&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:8},children:(0,o.jsx)(d.Ay,{size:"small",type:"primary",onClick:()=>{el(e.content),t.success("已应用到编辑内容,请确认后保存")},children:"应用"})})]})},"".concat(e.role,"-").concat(r))}),eI&&(0,o.jsx)("div",{style:{display:"flex",justifyContent:"flex-start"},children:(0,o.jsxs)("div",{style:{padding:"10px 12px",borderRadius:12,background:"var(--colorBgContainer)",border:"1px solid var(--colorBorderSecondary)",color:"var(--colorTextSecondary)",fontSize:13},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"AI 正在分析并生成内容..."]})})]}):(0,o.jsx)(g.A,{image:g.A.PRESENTED_IMAGE_SIMPLE,description:"输入 @ 召回知识库文件,再描述你的优化目标"})}),(0,o.jsx)(f.A,{style:{margin:0}}),(0,o.jsxs)("div",{style:{padding:12},children:[eH.length>0&&(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:8},children:eH.map(e=>(0,o.jsxs)(s.A,{closable:!0,onClose:()=>e_(t=>t.filter(t=>t!==e)),style:{margin:0,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},children:["@",e]},e))}),e$&&(0,o.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,o.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,o.jsxs)("div",{children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",fontSize:13,fontWeight:700},children:"召回知识库文件"}),(0,o.jsx)("div",{style:{color:"var(--colorTextSecondary)",fontSize:11},children:"支持文件名与知识库内容检索,最多召回 3 个文件"})]}),(0,o.jsx)(s.A,{color:eZ?"blue":"default",style:{margin:0,maxWidth:240,overflow:"hidden",textOverflow:"ellipsis"},children:eZ?"@".concat(eZ):"输入 @关键词"})]}),eJ?(0,o.jsxs)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在加载知识库文件..."]}):0===eO.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:"暂无可召回的知识库文件"}):0===e8.length?(0,o.jsx)("div",{style:{padding:14,color:"var(--colorTextSecondary)",fontSize:12},children:eM?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在检索知识库内容..."]}):"没有匹配的知识库文件,请换个关键词"}):(0,o.jsxs)(o.Fragment,{children:[eM&&(0,o.jsxs)("div",{style:{padding:"8px 12px",color:"var(--colorTextSecondary)",fontSize:12,borderBottom:"1px solid var(--colorBorderSecondary)"},children:[(0,o.jsx)(v.A,{size:"small",style:{marginRight:8}}),"正在继续检索内容匹配..."]}),e8.slice(0,30).map(e=>(0,o.jsxs)("div",{onMouseDown:t=>{var r;t.preventDefault(),r=e.relativePath,e_(e=>e.includes(r)?e:[...e,r]),eE(e=>e.replace(/(^|\s)@([^\s@]*)$/,"$1@".concat(r," "))),eG(!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,o.jsx)("div",{style:{width:22,height:22,borderRadius:7,background:"var(--colorFillSecondary)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(b.A,{style:{color:"var(--colorAccent)"}})}),(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsx)("div",{style:{color:"var(--colorText)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:700},children:e.relativePath}),(0,o.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,o.jsxs)(a.A,{size:4,children:[(0,o.jsx)(s.A,{color:"content"===e.matchedBy?"purple":"disk"===e.matchedBy?"orange":"blue",style:{margin:0},children:"content"===e.matchedBy?"内容匹配":"disk"===e.matchedBy?"磁盘文件":"文件匹配"}),(0,o.jsx)(s.A,{style:{margin:0},children:e.status})]})]},e.relativePath))]})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[(0,o.jsx)(u.A.TextArea,{value:eB,onChange:e=>{let t=e.target.value;eE(t),eG(null!==Z(t))},onFocus:()=>eG(null!==Z(eB)),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),e5())},disabled:eI,placeholder:"输入 @ 召回知识库文件,再描述优化目标...",autoSize:{minRows:2,maxRows:5},style:{fontSize:13,lineHeight:1.6}}),(0,o.jsx)(d.Ay,{type:"primary",icon:(0,o.jsx)(E.A,{}),loading:eI,disabled:!eB.trim(),onClick:()=>{e5()},children:"发送"})]})]})]})]})]})}}},e=>{e.O(0,[433,787,576,195,985,525,636,593,792],()=>e(e.s=27549)),_N_E=e.O()}]);
|
|
File without changes
|