@aalis/plugin-webui-client 0.12.0 → 0.12.2
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/dist/assets/{AuthorityPage-l-Jt-tyM.js → AuthorityPage-moleXD4t.js} +1 -1
- package/dist/assets/DynamicPage-Dmz4Tfnd.js +19 -0
- package/dist/assets/{FilesPage-CRUIl6Xj.js → FilesPage-DUh-AYCa.js} +1 -1
- package/dist/assets/{MarketplacePage-DoOvuOTU.js → MarketplacePage-DzmqvEhm.js} +1 -1
- package/dist/assets/{PlatformPage-D4EF93zF.js → PlatformPage-Cl_2WBBf.js} +1 -1
- package/dist/assets/PluginConfigPage-Bda8iLH6.js +23 -0
- package/dist/assets/SessionsPage-Dmw9u5-k.js +1 -0
- package/dist/assets/{arc-D900bUwz.js → arc-CvZyeOr3.js} +1 -1
- package/dist/assets/{architectureDiagram-3BPJPVTR-HCWDD2g-.js → architectureDiagram-3BPJPVTR-BM0rAG6h.js} +1 -1
- package/dist/assets/{blockDiagram-GPEHLZMM-B-dSbRFF.js → blockDiagram-GPEHLZMM-C1sdysUR.js} +1 -1
- package/dist/assets/{c4Diagram-AAUBKEIU-CxBH28wM.js → c4Diagram-AAUBKEIU-CYJ-GB21.js} +1 -1
- package/dist/assets/channel-DwGWzMQA.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-CKFQywNP.js → chunk-2J33WTMH-BkC9TJZK.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-u70MbS7S.js → chunk-4BX2VUAB-C1A8aFsP.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-C4x7Ajeo.js → chunk-55IACEB6-eTVfuioZ.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-Tw-HZebR.js → chunk-727SXJPM-xrA_1fYt.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-CYks0_-5.js → chunk-AQP2D5EJ-BcR6_Tcf.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-Di13fFRw.js → chunk-FMBD7UC4-DpTtNcWD.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-CMECQpX8.js → chunk-ND2GUHAM-DmI-7NxM.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-B8p6IhNt.js → chunk-QZHKN3VN-D1fOOvmu.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-mGzw7eqs.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-mGzw7eqs.js +1 -0
- package/dist/assets/{clock-DSh1391_.js → clock-AfKIpZ6h.js} +1 -1
- package/dist/assets/{cose-bilkent-S5V4N54A-BcikHe1E.js → cose-bilkent-S5V4N54A-0Zvy1yik.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-BiUpQ7Wt.js → dagre-BM42HDAG-CbDOMSTD.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-DPQ1SZjc.js → diagram-2AECGRRQ-B6c-LIf_.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-BlgpZGKe.js → diagram-5GNKFQAL-DPmLgFlo.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-BoXrc2M5.js → diagram-KO2AKTUF-smABeten.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-CvoHVnad.js → diagram-LMA3HP47-DAnV-Eg9.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-qPnM1YXt.js → diagram-OG6HWLK6-Cfojf2jW.js} +1 -1
- package/dist/assets/{erDiagram-TEJ5UH35-BFpk7X-M.js → erDiagram-TEJ5UH35-DzDyUJju.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-iv7orfgc.js → flowDiagram-I6XJVG4X-BAgnVKAG.js} +1 -1
- package/dist/assets/{ganttDiagram-6RSMTGT7-BKO2HS21.js → ganttDiagram-6RSMTGT7-BU0cDMt_.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-BV2mZ73c.js → gitGraphDiagram-PVQCEYII-Bt_u2cFR.js} +1 -1
- package/dist/assets/{globe-CT0XtR4-.js → globe-BKJqBqHF.js} +1 -1
- package/dist/assets/{index-Lxc_JKBO.js → index-8Eh5USJy.js} +3 -3
- package/dist/assets/{infoDiagram-5YYISTIA-BPkphYvC.js → infoDiagram-5YYISTIA-D8phaHgc.js} +1 -1
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-B-oLVWH5.js → ishikawaDiagram-YF4QCWOH-CSaAlITY.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-BJ8l-DFT.js → journeyDiagram-JHISSGLW-Bhyae5kY.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-B2ZbfdxW.js → kanban-definition-UN3LZRKU-ClO_qokD.js} +1 -1
- package/dist/assets/{linear-DBd1vZMm.js → linear-D7VBgJ46.js} +1 -1
- package/dist/assets/{mermaid.core-BynBM-Vs.js → mermaid.core-_uubCxEH.js} +4 -4
- package/dist/assets/{mindmap-definition-RKZ34NQL-BuGZb3vZ.js → mindmap-definition-RKZ34NQL-BOojGeyt.js} +1 -1
- package/dist/assets/{pieDiagram-4H26LBE5-wIN8wfaj.js → pieDiagram-4H26LBE5-D3W4xNDm.js} +1 -1
- package/dist/assets/{quadrantDiagram-W4KKPZXB-D1LdeZtI.js → quadrantDiagram-W4KKPZXB-DmE0WMKQ.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-DXuzTZNi.js → requirementDiagram-4Y6WPE33-Ci15zBQo.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP-OvqOJ5EX.js → sankeyDiagram-5OEKKPKP-CZvJCqzF.js} +1 -1
- package/dist/assets/{sequenceDiagram-3UESZ5HK-CV7R-br2.js → sequenceDiagram-3UESZ5HK-DImxZlZU.js} +1 -1
- package/dist/assets/{stateDiagram-AJRCARHV-Bhyzx7mz.js → stateDiagram-AJRCARHV-upGvcZz4.js} +1 -1
- package/dist/assets/{stateDiagram-v2-BHNVJYJU-D1jNH0Dq.js → stateDiagram-v2-BHNVJYJU-CiXgli4u.js} +1 -1
- package/dist/assets/{timeline-definition-PNZ67QCA-QzuD8t4J.js → timeline-definition-PNZ67QCA-DtnFAsZJ.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-Dh_7y7dp.js → vennDiagram-CIIHVFJN-5XoGoPhA.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-uwZ17gTk.js → wardley-L42UT6IY-D2ahyUpa.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-D0aj6wG2.js → wardleyDiagram-YWT4CUSO-DVuBRlrH.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-BpySZYJb.js → xychartDiagram-2RQKCTM6-CcTPMI_A.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/DynamicPage-Cb9bnTmR.js +0 -19
- package/dist/assets/PluginConfigPage-IAuDP0tZ.js +0 -23
- package/dist/assets/SessionsPage-DaYw4pcv.js +0 -1
- package/dist/assets/channel-CKm-LJj0.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-Bs8lA-Wx.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-Bs8lA-Wx.js +0 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{r as d,j as e}from"./react-vendor-BPQixOLZ.js";import{c as q,a as k,T as Ae}from"./index-Lxc_JKBO.js";import{b as H,S as Se,f as ke,u as Re}from"./SchemaForm-BcYxH5r1.js";import{u as Je}from"./ConfirmDialog-DbV-E1Nd.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-B2G8c9k5.js";/**
|
|
2
|
-
* @license lucide-react v1.7.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ge=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Ke=q("link-2",Ge);/**
|
|
7
|
-
* @license lucide-react v1.7.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Ze=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],He=q("loader-circle",Ze);/**
|
|
12
|
-
* @license lucide-react v1.7.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const We=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Qe=q("radio",We);/**
|
|
17
|
-
* @license lucide-react v1.7.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Xe=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Ye=q("workflow",Xe);function W({label:u,value:r,depth:x=0,secret:M,description:N,defaultValue:v}){const[$,L]=d.useState(x<1);if(Array.isArray(r))return r.length===0?e.jsxs("div",{className:"config-item",style:{paddingLeft:x*12},children:[e.jsxs("span",{className:"key",children:[e.jsx("code",{className:"field-key",children:u}),N&&e.jsxs("span",{className:"field-hint",children:[" / ",N]})]}),e.jsx("span",{className:"val",children:"(空)"})]}):e.jsxs("div",{className:"config-nested",style:{paddingLeft:x*12},children:[e.jsxs("div",{className:"config-nested-header",onClick:()=>L(g=>!g),children:[e.jsx("span",{className:`config-block-toggle ${$?"open":""}`,children:"▶"}),e.jsxs("span",{className:"key",children:[e.jsx("code",{className:"field-key",children:u}),N&&e.jsxs("span",{className:"field-hint",children:[" / ",N]})]}),e.jsxs("span",{className:"config-nested-count",children:[r.length," 项"]})]}),$&&e.jsx("div",{className:"config-nested-body",children:r.map((g,j)=>e.jsx(W,{label:`#${j+1}`,value:g,depth:x+1,secret:M},j))})]});if(r==null||typeof r!="object"){const g=M||typeof r=="string"&&/(apiKey|password|secret|token)(?![a-zA-Z])/i.test(u),j=r==null,C=j&&v!==void 0&&v!==null,S=j?C?typeof v=="object"?JSON.stringify(v):String(v):"-":String(r),P=g&&S.length>4?S.slice(0,4)+"••••••":S;return e.jsxs("div",{className:"config-item",style:{paddingLeft:x*12},children:[e.jsxs("span",{className:"key",children:[e.jsx("code",{className:"field-key",children:u}),N&&e.jsxs("span",{className:"field-hint",children:[" / ",N]})]}),e.jsxs("span",{className:"val",title:g?"••••••":S,children:[P,C&&e.jsx("span",{className:"field-hint",children:" (默认)"})]})]})}const b=Object.entries(r);return e.jsxs("div",{className:"config-nested",style:{paddingLeft:x*12},children:[e.jsxs("div",{className:"config-nested-header",onClick:()=>L(g=>!g),children:[e.jsx("span",{className:`config-block-toggle ${$?"open":""}`,children:"▶"}),e.jsx("span",{className:"key",children:u}),e.jsxs("span",{className:"config-nested-count",children:[b.length," 项"]})]}),$&&e.jsx("div",{className:"config-nested-body",children:b.map(([g,j])=>e.jsx(W,{label:g,value:j,depth:x+1,secret:M},g))})]})}function cs({plugins:u,config:r,onRefresh:x,onConfigSaved:M,onRestart:N}){const{confirm:v,dialog:$}=Je(),[L,b]=d.useState(new Set),g=d.useRef(u),[j,C]=d.useState(null),[S,P]=d.useState({}),[Q,B]=d.useState({}),[D,X]=d.useState({}),[F,Y]=d.useState(void 0),[V,ee]=d.useState(null),[se,ne]=d.useState(!1),[Ce,we]=d.useState(new Set),[U,ae]=d.useState(""),[$e,Le]=d.useState(new Set),[te,A]=d.useState(null),[R,J]=d.useState("");d.useEffect(()=>{g.current!==u&&L.size>0&&b(new Set),g.current=u},[u,L]);const T=s=>b(t=>new Set(t).add(s)),w=s=>L.has(s),p=s=>{ee(s),setTimeout(()=>ee(null),2500)},Oe=async s=>{if(s.core)return;T(s.instanceId);const t=s.state==="disabled"?"enable":"disable",i=await k(`/api/plugins/${encodeURIComponent(s.instanceId)}/${t}`,{method:"POST"});i.ok?(p(`${s.instanceId} 已${t==="enable"?"启用":"禁用"}`),x()):(p(i.error??"未知错误"),b(l=>{const m=new Set(l);return m.delete(s.instanceId),m}))},Ie=s=>{const t=s.config??{};s.configSchema?B(H(s.configSchema,t)):P(ke(t)),C(s.instanceId)},ie=d.useCallback(async s=>{if(!D[s])try{const t=await k(`/api/models/${encodeURIComponent(s)}`),i=t.providers&&t.providers.length>0?t.providers.map(l=>({label:`${l.provider} / ${l.model}`,value:l.value})):(t.models??[]).map(l=>({label:l,value:l}));X(l=>({...l,[s]:i}))}catch{X(t=>({...t,[s]:[]}))}},[D]),ce=d.useCallback(async()=>{if(!F)try{const s=await k("/api/llm-providers");Y(s.providers??[])}catch{Y([])}},[F]),le=s=>{const t=s.defaultConfig??{};s.configSchema?B(H(s.configSchema,t)):P(ke(t))},oe=async(s,t)=>{const i=t?Q:Re(S);T(s);const l=await k(`/api/plugins/${encodeURIComponent(s)}/config`,{method:"PUT",body:JSON.stringify({config:i})});if(l.error){p(l.error),b(m=>{const _=new Set(m);return _.delete(s),_});return}p(`${s} 配置已更新,正在重载…`),C(null),x()},re=async s=>{const t=R.trim();if(!t)return;T(s);const i=await k(`/api/plugins/${encodeURIComponent(s)}/instances`,{method:"POST",body:JSON.stringify({suffix:t})});i.ok?(p(`已创建实例 ${i.instanceId}`),A(null),J(""),x()):(p(i.error??"创建失败"),b(l=>{const m=new Set(l);return m.delete(s),m}))},Me=async s=>{if(!await v({title:`删除实例「${s}」`,body:"该实例的配置将一并移除。",confirmLabel:"删除",danger:!0}))return;T(s);const i=await k(`/api/plugins/${encodeURIComponent(s)}/instance`,{method:"DELETE"});i.ok?(p(`已删除实例 ${s}`),x()):(p(i.error??"删除失败"),b(l=>{const m=new Set(l);return m.delete(s),m}))},Pe=async s=>{if(!await v({title:`卸载插件「${s.displayName??s.name}」`,body:`${s.name}
|
|
22
|
-
|
|
23
|
-
将删除其代码目录并清除残留配置。不可恢复,但可从插件市场重新安装。`,confirmLabel:"卸载",danger:!0}))return;T(s.instanceId);const i=await k("/api/marketplace/uninstall",{method:"POST",body:JSON.stringify({name:s.name})});i.ok?(p(i.message??`${s.name} 已卸载`),x()):(p(i.error??"卸载失败"),b(l=>{const m=new Set(l);return m.delete(s.instanceId),m}))},Te=s=>s.instanceId!==s.name,ze={active:"运行中",disabled:"已禁用",pending:"等待中",disposed:"已释放",error:"运行错误"},Ee={active:"active",disabled:"disposed",pending:"pending",error:"error"},De=s=>{we(t=>{const i=new Set(t);return i.has(s)?i.delete(s):i.add(s),i})},[de,G]=d.useState(!1),[me,he]=d.useState({}),O=r&&r._schema?r._schema:void 0;d.useEffect(()=>{r&&O&&he(H(O,r))},[r,O]);const Fe=async()=>{ne(!0);const s=await k("/api/config",{method:"PUT",body:JSON.stringify(me)});ne(!1),s.ok?(G(!1),M(),s.restart?N():p("全局配置已保存")):p(s.error??"未知错误")};return e.jsxs("div",{className:"page-content page-plugin-config",children:[$,V&&e.jsx("div",{className:"toast",children:V}),e.jsxs("div",{className:"config-header-row",children:[e.jsx("div",{className:"section-label",style:{marginBottom:0},children:"全局配置"}),e.jsx("div",{style:{display:"flex",gap:6},children:de?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-primary btn-sm",onClick:Fe,disabled:se,children:se?"保存中...":"保存"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>G(!1),children:"取消"})]}):e.jsx("button",{className:"btn btn-sm",onClick:()=>G(!0),children:"编辑"})})]}),r&&O&&e.jsx("div",{className:"config-block",style:{marginTop:8,marginBottom:20},children:e.jsx("div",{className:"config-block-body",style:{paddingTop:10},children:de?e.jsx(Se,{schema:O,draft:me,onChange:he,modelCache:D,onFetchModels:ie,llmProviders:F,onFetchLLMProviders:ce}):e.jsx(e.Fragment,{children:Object.entries(O).map(([s,t])=>{const i=r[s],l=t,m=l.description||l.label;return e.jsxs("div",{className:"config-item",children:[e.jsxs("span",{className:"key",children:[e.jsx("code",{className:"field-key",children:s}),m&&e.jsxs("span",{className:"field-hint",children:[" / ",m]})]}),e.jsx("span",{className:"val",children:l.type==="boolean"?i?"✓ 开启":"✗ 关闭":i===""||i==null?"(空)":String(i)})]},s)})})})}),e.jsx("div",{className:"section-label",style:{marginBottom:0},children:"插件管理"}),e.jsxs("div",{className:"plugin-search-row",children:[e.jsx("input",{className:"plugin-search-input",placeholder:"搜索插件 / 工具名 / 指令名...",value:U,onChange:s=>ae(s.target.value)}),U&&e.jsx("button",{className:"plugin-search-clear",onClick:()=>ae(""),children:"✕"})]}),u.length===0&&e.jsx("div",{className:"empty-hint",children:"无插件"}),(()=>{const s=U.toLowerCase(),t=s?u.filter(c=>c.name.toLowerCase().includes(s)||c.instanceId.toLowerCase().includes(s)||c.displayName&&c.displayName.toLowerCase().includes(s)||c.provides.some(o=>o.toLowerCase().includes(s))||(c.tools??[]).some(o=>o.toLowerCase().includes(s))||(c.commands??[]).some(o=>o.toLowerCase().includes(s))):u,i={},l=["系统","LLM 模型","智能体","存储","嵌入模型","向量存储","工具","界面","适配器","自动化","其他"];for(const c of t){const o=c.name,y=c.core?"系统":/^(@aalis\/)?plugin-(openai|deepseek|ollama)$/.test(o)?"LLM 模型":/^(@aalis\/)?plugin-agent/.test(o)||/^(@aalis\/)?plugin-persona$/.test(o)?"智能体":/^(@aalis\/)?plugin-memory-/.test(o)?"存储":/^(@aalis\/)?plugin-embedding-/.test(o)?"嵌入模型":/^(@aalis\/)?plugin-vectorstore-/.test(o)?"向量存储":/^(@aalis\/)?plugin-(tool-|tools-|websearch-)/.test(o)?"工具":/^(@aalis\/)?plugin-(webui-|cli)/.test(o)?"界面":/^(@aalis\/)?plugin-adapter-/.test(o)?"适配器":/^(@aalis\/)?plugin-(scheduler|skills)$/.test(o)?"自动化":/^(@aalis\/)?plugin-(commands|authority)$/.test(o)?"系统":"其他";i[c.instanceId]=y}const m=new Map;for(const c of l)m.set(c,[]);for(const c of t){const o=i[c.instanceId]||"其他";m.get(o).push(c)}const _=c=>{Le(o=>{const y=new Set(o);return y.has(c)?y.delete(c):y.add(c),y})};return Array.from(m.entries()).filter(([,c])=>c.length>0).map(([c,o])=>{const y=$e.has(c);return e.jsxs("div",{className:"plugin-category",children:[e.jsxs("div",{className:"plugin-category-header",onClick:()=>_(c),children:[e.jsx("span",{className:`config-block-toggle ${y?"":"open"}`,children:"▶"}),e.jsx("span",{className:"plugin-category-name",children:c}),e.jsx("span",{className:"plugin-category-count",children:o.length})]}),!y&&o.map(n=>{var ue,xe,pe,be,je,ye,Ne;const f=n.instanceId,_e=j===f,z=Ce.has(f),I=Te(n),ge=I?f.slice(n.name.length+1):void 0,fe=n.extends&&(((ue=n.extends.events)==null?void 0:ue.length)||((xe=n.extends.hooks)==null?void 0:xe.length)||n.extends.mixins&&Object.keys(n.extends.mixins).length),K=fe||n.config&&Object.keys(n.config).length>0||!!n.configSchema,Z=!!n.configSchema;return e.jsxs("div",{className:`plugin-card ${n.state==="disabled"?"disabled":""} ${n.state==="error"?"errored":""}`,style:{position:"relative"},children:[w(f)&&e.jsxs("div",{className:"plugin-reload-overlay",children:[e.jsx(He,{size:20,className:"plugin-reload-spinner"}),e.jsx("span",{children:"重载中…"})]}),e.jsxs("div",{className:"plugin-card-header",children:[e.jsxs("div",{className:"plugin-card-info",style:{cursor:K?"pointer":"default"},onClick:()=>K&&De(f),children:[K&&e.jsx("span",{className:`config-block-toggle ${z?"open":""}`,children:"▶"}),e.jsxs("span",{className:"plugin-card-name",children:[n.displayName??n.name,n.displayName&&e.jsx("span",{className:"plugin-card-module-name",children:n.name}),ge&&e.jsxs("span",{className:"plugin-instance-suffix",children:[":",ge]})]}),e.jsx("span",{className:`badge ${Ee[n.state]??"pending"}`,children:ze[n.state]??n.state}),n.core&&e.jsx("span",{className:"badge core-badge",children:"核心"}),n.reusable&&!I&&e.jsx("span",{className:"badge",style:{background:"#7c5cfc",color:"#fff",fontSize:10},children:"多实例"}),n.provides.length>0&&e.jsx("span",{className:"plugin-provides-inline",children:n.provides.map(a=>e.jsx("span",{className:"provides-chip",children:a},a))})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[I&&e.jsx("button",{className:"btn btn-sm",style:{color:"#e55",fontSize:11},onClick:()=>Me(f),disabled:w(f),children:"删除"}),!I&&e.jsx("button",{className:"btn btn-sm",style:{color:"#e55",fontSize:11},onClick:()=>Pe(n),disabled:w(f),title:"卸载插件(删包 + 清配置)",children:"卸载"}),n.reusable&&!I&&e.jsx("button",{className:"btn btn-sm",style:{fontSize:11},onClick:()=>{A(te===n.name?null:n.name),J("")},children:"+ 实例"}),e.jsxs("label",{className:`toggle-switch ${n.core?"core-locked":""}`,children:[e.jsx("input",{type:"checkbox",checked:n.state!=="disabled",onChange:()=>Oe(n),disabled:n.core||w(f)}),e.jsx("span",{className:"toggle-slider"})]})]})]}),te===n.name&&!I&&e.jsxs("div",{className:"plugin-new-instance-row",style:{display:"flex",gap:6,padding:"6px 12px",alignItems:"center"},children:[e.jsxs("span",{style:{fontSize:12,opacity:.7},children:[n.name,":"]}),e.jsx("input",{style:{flex:1,fontSize:12},className:"plugin-search-input",placeholder:"输入实例后缀(如 vision)",value:R,onChange:a=>J(a.target.value),onKeyDown:a=>a.key==="Enter"&&re(n.name)}),e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>re(n.name),disabled:!R.trim()||w(n.name),children:"创建"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>A(null),children:"取消"})]}),n.state==="error"&&n.error&&e.jsxs("div",{className:"plugin-error-msg",children:[e.jsx(Ae,{size:14})," ",n.error]}),z&&n.provides.length>0&&e.jsx("div",{className:"plugin-card-provides",children:n.provides.map(a=>e.jsx("span",{className:"tool-chip",children:a},a))}),z&&((((pe=n.requiredServices)==null?void 0:pe.length)??0)>0||(((be=n.optionalServices)==null?void 0:be.length)??0)>0||(((je=n.capabilities)==null?void 0:je.length)??0)>0)&&e.jsxs("div",{className:"plugin-card-caps",children:[(n.requiredServices??[]).map(a=>e.jsxs("span",{className:"cap-chip dep-required",title:"必需依赖的服务",children:["需 ",a]},`req-${a}`)),(n.optionalServices??[]).map(a=>e.jsxs("span",{className:"cap-chip dep-optional",title:"可选依赖的服务",children:["可选 ",a]},`opt-${a}`)),(n.capabilities??[]).map(a=>e.jsx("span",{className:`cap-chip ${a==="safety:dangerous"?"cap-danger":"cap-sensitive"}`,title:"触达的敏感能力",children:a==="safety:dangerous"?"⚠ 高危操作":a},`cap-${a}`))]}),z&&fe&&e.jsxs("div",{className:"plugin-card-extends",children:[e.jsx("span",{className:"extends-label",children:"扩展 Core:"}),(ye=n.extends.events)==null?void 0:ye.map(a=>e.jsxs("span",{className:"extends-chip event",children:[e.jsx(Qe,{size:12})," ",a]},`e-${a}`)),(Ne=n.extends.hooks)==null?void 0:Ne.map(a=>e.jsxs("span",{className:"extends-chip hook",children:[e.jsx(Ye,{size:12})," ",a]},`h-${a}`)),n.extends.mixins&&Object.entries(n.extends.mixins).map(([a,E])=>E.map(h=>e.jsxs("span",{className:"extends-chip mixin",children:[e.jsx(Ke,{size:12})," ctx.",h,"()"]},`m-${a}-${h}`)))]}),z&&(n.config&&Object.keys(n.config).length>0||Z)&&e.jsx("div",{className:"plugin-card-config",children:_e?Z?e.jsxs(e.Fragment,{children:[e.jsx(Se,{schema:n.configSchema,draft:Q,onChange:B,modelCache:D,onFetchModels:ie,llmProviders:F,onFetchLLMProviders:ce}),e.jsxs("div",{className:"config-edit-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>oe(f,!0),disabled:w(f),children:"保存"}),n.defaultConfig&&Object.keys(n.defaultConfig).length>0&&e.jsx("button",{className:"btn btn-warn btn-sm",onClick:()=>le(n),children:"恢复默认"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>C(null),children:"取消"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"config-edit-form",children:Object.keys(S).map(a=>e.jsxs("div",{className:"config-edit-row",children:[e.jsx("label",{className:"config-edit-label",children:a}),e.jsx("input",{className:"config-edit-input",type:/(apiKey|password|secret|token)(?![a-zA-Z])/i.test(a)?"password":"text",value:S[a],onChange:E=>P(h=>({...h,[a]:E.target.value}))})]},a))}),e.jsxs("div",{className:"config-edit-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>oe(f,!1),disabled:w(f),children:"保存"}),n.defaultConfig&&Object.keys(n.defaultConfig).length>0&&e.jsx("button",{className:"btn btn-warn btn-sm",onClick:()=>le(n),children:"恢复默认"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>C(null),children:"取消"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"config-block-body",style:{paddingTop:6},children:(Z?Object.keys(n.configSchema).map(a=>[a,n.config[a]]):Object.entries(n.config)).map(([a,E])=>{var ve;const h=(ve=n.configSchema)==null?void 0:ve[a],qe=h&&"secret"in h?h.secret:void 0,Be=h&&"description"in h?h.description:h&&"label"in h?h.label:void 0,Ue=h&&"default"in h?h.default:void 0;return e.jsx(W,{label:a,value:E,secret:qe,description:Be,defaultValue:Ue},a)})}),e.jsx("button",{className:"btn btn-sm",onClick:()=>Ie(n),children:"编辑配置"})]})})]},f)})]},c)})})()]})}export{cs as PluginConfigPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as u,j as e}from"./react-vendor-BPQixOLZ.js";import{p as w,b as xe,B as V,M as _,R,d as z,e as B,W as ge}from"./index-Lxc_JKBO.js";import{M as F}from"./markdown-B2G8c9k5.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";function pe(s,x){const[N,l]=u.useState({segments:[],isStreaming:!1,done:!1}),o=u.useRef(null),d=!!(s&&(x==="active"||x==="waiting"));u.useEffect(()=>{if(!d||!s){l({segments:[],isStreaming:!1,done:!1});return}const v=location.protocol==="https:"?"wss:":"ws:",c=new WebSocket(`${v}//${location.host}/ws`);return o.current=c,c.onopen=()=>{c.send(JSON.stringify({type:"subscribe_session",sessionId:s}))},c.onmessage=m=>{try{const n=JSON.parse(m.data);if(n.type==="stream_resume"){let j=[];if(Array.isArray(n.segments)&&n.segments.length>0)j=n.segments;else{const p=n.reasoningContent??"",y=n.content??"";p&&j.push({type:"reasoning_text",content:p}),y&&j.push({type:"text",content:y})}l({segments:j,isStreaming:!n.done,done:!!n.done})}else n.type==="stream"?n.done?l(j=>({...j,isStreaming:!1,done:!0})):l(j=>{const p=[...j.segments],y=(C,$)=>{const S=p[p.length-1];S&&S.type===C?p[p.length-1]={type:C,content:S.content+$}:p.push({type:C,content:$})};return n.reasoningDelta&&y("reasoning_text",n.reasoningDelta),n.contentDelta&&y("text",n.contentDelta),{...j,segments:p,isStreaming:!0}}):n.type==="tool_call"?l(j=>{const p=[...j.segments];if(n.toolPhase==="start")p.push({type:"tool_call",name:n.toolName,args:n.toolArgs??{},startTime:Date.now()});else if(n.toolPhase==="end"&&n.toolResult!==void 0){const y=p.findLastIndex(C=>C.type==="tool_call"&&C.name===n.toolName&&C.result==null);if(y>=0){const C=p[y];p[y]={...C,result:n.toolResult,endTime:Date.now()}}}return{...j,segments:p,isStreaming:!0}}):n.type==="message"&&l(j=>({...j,done:!0,isStreaming:!1}))}catch{}},c.onclose=()=>{o.current=null},()=>{c.close(),o.current=null}},[s,d]);const a=u.useCallback(()=>{l({segments:[],isStreaming:!1,done:!1})},[]);return[N,a]}const Y={active:"进行中",waiting:"等待中",completed:"已完成",error:"错误",archived:"已归档"},q={active:"#4caf50",waiting:"#ff9800",completed:"#2196f3",error:"#f44336",archived:"#888"};function X(s,x){return s?s.length>x?s.slice(0,x)+"…":s:""}function M(s){return new Date(s).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Q(s){const x=[];for(const N of s)x.push(N.session.id),x.push(...Q(N.children));return x}function je({config:s,resolvedConfig:x,inheritedConfig:N,options:l,onSave:o,onCancel:d}){var T,A;const[a,v]=u.useState({...s}),c=x||{},m=N||{},n=(t,g)=>{v(f=>({...f,[t]:g}))},j=t=>{var g,f;return(g=a.enabledToolGroups)!=null&&g.includes(t)?"explicit":(f=m.enabledToolGroups)!=null&&f.includes(t)&&!a.enabledToolGroups?"inherited":"off"},p=t=>{if(j(t)==="inherited"){const f=[...m.enabledToolGroups||[]];n("enabledToolGroups",f.filter(E=>E!==t))}else{const f=a.enabledToolGroups||m.enabledToolGroups||[],E=f.includes(t)?f.filter(I=>I!==t):[...f,t];n("enabledToolGroups",E.length>0?E:void 0)}},y=()=>{v(t=>{const{enabledToolGroups:g,...f}=t;return f})};if(!l)return e.jsx("div",{className:"session-config-editor",children:e.jsx("span",{className:"session-config-loading",children:"加载配置选项…"})});const C=(t,g)=>!a[t]&&g?` (继承: ${g})`:"",$=(T=a.llm)!=null&&T.provider&&((A=a.llm)!=null&&A.model)?`${a.llm.provider}/${a.llm.model}`:"",S=l.models.filter(t=>!!t.provider).map(t=>({key:`${t.provider}/${t.id}`,provider:t.provider,model:t.id,label:`${t.provider} / ${t.id}${t.capabilities.length>0?` [${t.capabilities.join(",")}]`:""}`}));$&&!S.some(t=>t.key===$)&&S.unshift({key:$,provider:a.llm.provider,model:a.llm.model,label:`${a.llm.provider} / ${a.llm.model} (已离线)`});const b=m.llm?`${m.llm.provider} / ${m.llm.model}`:void 0;return e.jsxs("div",{className:"session-config-editor",onClick:t=>t.stopPropagation(),children:[e.jsxs("label",{className:"session-config-field",children:[e.jsxs("span",{children:["模型",!a.llm&&b?` (继承: ${b})`:""]}),e.jsxs("select",{value:$,onChange:t=>{const g=t.target.value;if(!g){n("llm",void 0);return}const f=S.find(E=>E.key===g);f&&n("llm",{provider:f.provider,model:f.model})},children:[e.jsx("option",{value:"",children:b?`继承 (${b})`:"继承默认"}),S.map(t=>e.jsx("option",{value:t.key,children:t.label},t.key))]})]}),e.jsxs("label",{className:"session-config-field",children:[e.jsxs("span",{children:["人设",C("persona",m.persona)]}),e.jsxs("select",{value:a.persona||"",onChange:t=>n("persona",t.target.value||void 0),children:[e.jsx("option",{value:"",children:m.persona?`继承 (${m.persona})`:"继承默认"}),l.personas.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),l.toolGroups.length>0&&e.jsxs("div",{className:"session-config-field",children:[e.jsxs("span",{children:["工具分组",a.enabledToolGroups?"":" (继承)"]}),e.jsxs("div",{className:"session-config-chips",children:[l.toolGroups.map(t=>{const g=j(t.name);return e.jsx("button",{className:`session-config-chip ${g==="explicit"?"active":g==="inherited"?"active inherited":""}`,onClick:()=>p(t.name),title:`${t.name}${g==="inherited"?" (继承)":g==="explicit"?" (已覆盖)":""}`,children:t.label||t.name},t.name)}),a.enabledToolGroups&&e.jsx("button",{className:"session-config-chip reset",onClick:y,title:"恢复为继承",children:"↺ 重置"})]})]}),e.jsxs("label",{className:"session-config-field",children:[e.jsx("span",{children:"额外提示"}),e.jsx("textarea",{rows:2,value:a.systemPromptExtra||"",onChange:t=>n("systemPromptExtra",t.target.value||void 0),placeholder:"追加到系统提示之后…"})]}),e.jsxs("label",{className:"session-config-field",children:[e.jsx("span",{children:"工具迭代上限"}),e.jsx("input",{type:"number",min:0,max:50,value:a.maxToolIterations??"",onChange:t=>n("maxToolIterations",t.target.value?Number(t.target.value):void 0),placeholder:m.maxToolIterations?`继承 (${m.maxToolIterations})`:"默认"})]}),e.jsxs("div",{className:"session-config-toggles",children:[e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:a.disableOutputFormat??c.disableOutputFormat??!1,onChange:t=>n("disableOutputFormat",t.target.checked||void 0)}),e.jsxs("span",{children:["禁用结构化输出",a.disableOutputFormat===void 0&&m.disableOutputFormat?" (继承)":""]})]}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:a.clientSideJsonRendering??c.clientSideJsonRendering??!1,onChange:t=>n("clientSideJsonRendering",t.target.checked||void 0)}),e.jsxs("span",{children:["客户端 JSON 渲染",a.clientSideJsonRendering===void 0&&m.clientSideJsonRendering?" (继承)":""]})]})]}),e.jsxs("div",{className:"session-config-actions",children:[e.jsx("button",{className:"session-config-btn save",onClick:()=>o(a),children:"保存"}),e.jsx("button",{className:"session-config-btn cancel",onClick:d,children:"取消"})]})]})}function Se({pluginName:s,activeSessionId:x,onSwitchSession:N,onStartNewChat:l,refreshSignal:o}){const[d,a]=u.useState([]),[v,c]=u.useState(null),[m,n]=u.useState(null),[j,p]=u.useState(!1),[y,C]=u.useState(null),[$,S]=u.useState(!1),[b,T]=u.useState(new Set),[A,t]=u.useState(null),[g,f]=u.useState(""),[E,I]=u.useState(null),[G,r]=u.useState(null),[L,K]=u.useState(null),[W,O]=u.useState(null),[U,h]=u.useState(null),P=u.useCallback(()=>{w(s,"getSessionTree").then(i=>{Array.isArray(i)&&a(i)}).catch(()=>C("无法加载会话树"))},[s]);u.useEffect(()=>{P();const i=setInterval(P,3e4);return()=>clearInterval(i)},[P]),u.useEffect(()=>{o&&(P(),G&&Promise.all([w(s,"getResolvedConfig",{sessionId:G,platform:"webui"}),w(s,"getInheritedDefaults",{sessionId:G,platform:"webui"})]).then(([i,k])=>{i&&O(i),k&&h(k)}).catch(()=>{}))},[o]);const H=u.useCallback(i=>{c(i),p(!0),w(s,"getSessionDetail",{id:i}).then(k=>n(k)).catch(()=>n(null)).finally(()=>p(!1))},[s]),se=async()=>{try{await w(s,"createSession",{}),P()}catch{}},te=async i=>{try{await w(s,"createSession",{parentId:i}),P()}catch{}},ne=async i=>{if(!g.trim()){t(null);return}try{await w(s,"renameSession",{id:i,title:g.trim()}),P()}catch{}t(null)},le=async i=>{try{await w(s,"archiveSession",{id:i}),P()}catch{}},ie=async i=>{try{const k=i===x;await w(s,"deleteSession",{id:i}),P(),v===i&&(c(null),n(null)),k&&l&&l()}catch{}I(null)},ae=async i=>{if(G===i){r(null),O(null),h(null);return}r(i),O(null),h(null);try{const[k,D,J]=await Promise.all([L?Promise.resolve(L):w(s,"getConfigOptions"),w(s,"getResolvedConfig",{sessionId:i,platform:"webui"}),w(s,"getInheritedDefaults",{sessionId:i,platform:"webui"})]);k&&!L&&K(k),D&&O(D),J&&h(J)}catch{}},re=async(i,k)=>{try{await w(s,"updateSessionConfig",{id:i,config:k}),P(),r(null)}catch(D){const J=D instanceof Error?D.message:String(D);alert(`保存会话配置失败:${J}`)}},ce=i=>{T(k=>{const D=new Set(k);return D.has(i)?D.delete(i):D.add(i),D})},oe=()=>{const i=Q(d);T(new Set(i))},de=()=>T(new Set),he=async()=>{if(b.size!==0)try{await w(s,"batchArchive",{ids:[...b]}),T(new Set),P()}catch{}},me=async()=>{if(b.size!==0&&confirm(`确认删除选中的 ${b.size} 个会话?此操作不可恢复。`))try{await w(s,"batchDelete",{ids:[...b]}),T(new Set),v&&b.has(v)&&(c(null),n(null)),P()}catch{}},ue=()=>{S(!1),T(new Set)};return y?e.jsx("div",{className:"tree-page-error",children:y}):e.jsxs("div",{className:"session-tree-page",children:[e.jsxs("div",{className:"tree-visual-panel",children:[e.jsxs("div",{className:"tree-visual-header",children:[e.jsx("h3",{children:"会话"}),e.jsx("div",{className:"tree-header-actions",children:$?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"tree-batch-btn",onClick:oe,title:"全选",children:"全选"}),e.jsx("button",{className:"tree-batch-btn",onClick:de,title:"取消全选",children:"取消"}),e.jsxs("button",{className:"tree-batch-btn archive",onClick:he,disabled:b.size===0,children:["归档 (",b.size,")"]}),e.jsxs("button",{className:"tree-batch-btn danger",onClick:me,disabled:b.size===0,children:["删除 (",b.size,")"]}),e.jsx("button",{className:"tree-batch-btn",onClick:ue,children:"退出批量"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"tree-action-btn",onClick:se,title:"新建会话",children:"+"}),e.jsx("button",{className:"tree-action-btn",onClick:()=>S(!0),title:"批量管理",children:"☐"}),e.jsx("button",{className:"tree-refresh-btn",onClick:P,children:"⟳"})]})})]}),e.jsx("div",{className:"tree-visual-body",children:d.length===0?e.jsx("div",{className:"tree-empty",children:"暂无会话"}):d.map(i=>e.jsx(Z,{node:i,selectedId:v,activeSessionId:x,onSelect:H,depth:0,batchMode:$,selected:b,onToggleSelect:ce,onCreateChild:te,onRename:(k,D)=>{t(k),f(D)},onArchive:le,onDelete:k=>I(k),onOpenConfig:ae,editingId:A,editTitle:g,onEditTitleChange:f,onCommitRename:ne,onCancelEdit:()=>t(null),configEditingId:G,configOptions:L,resolvedConfig:W,inheritedConfig:U,onSaveConfig:re,onCancelConfig:()=>r(null)},i.session.id))})]}),e.jsx("div",{className:"tree-detail-panel",children:v?j?e.jsx("div",{className:"tree-detail-placeholder",children:"加载中…"}):m?e.jsx(fe,{detail:m,onSwitchSession:N,onRefresh:()=>H(m.session.id)}):e.jsx("div",{className:"tree-detail-placeholder",children:"无法加载会话信息"}):e.jsx("div",{className:"tree-detail-placeholder tree-detail-placeholder-idle",children:"点击会话节点查看详情"})}),E&&e.jsx("div",{className:"delete-confirm-overlay",onClick:()=>I(null),children:e.jsxs("div",{className:"delete-confirm-dialog",onClick:i=>i.stopPropagation(),children:[e.jsx("p",{children:"确定要删除此会话吗?子会话也会被一并删除,此操作无法撤销。"}),e.jsxs("div",{className:"delete-confirm-actions",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>ie(E),children:"删除"}),e.jsx("button",{className:"btn btn-sm",onClick:()=>I(null),children:"取消"})]})]})})]})}function Z({node:s,selectedId:x,activeSessionId:N,onSelect:l,depth:o,batchMode:d,selected:a,onToggleSelect:v,onCreateChild:c,onRename:m,onArchive:n,onDelete:j,onOpenConfig:p,editingId:y,editTitle:C,onEditTitleChange:$,onCommitRename:S,onCancelEdit:b,configEditingId:T,configOptions:A,resolvedConfig:t,inheritedConfig:g,onSaveConfig:f,onCancelConfig:E}){const[I,G]=u.useState(!0),r=s.session,L=s.children.length>0,K=r.id===x,W=r.id===N,O=y===r.id,U=a.has(r.id);return e.jsxs("div",{className:"tree-node-group",children:[e.jsxs("div",{className:`tree-node ${K?"selected":""} ${W?"active-chat":""} status-${r.status}`,style:{marginLeft:o*24},onClick:()=>d?v(r.id):l(r.id),children:[d&&e.jsx("input",{type:"checkbox",className:"tree-node-checkbox",checked:U,onChange:()=>v(r.id),onClick:h=>h.stopPropagation()}),e.jsx("button",{className:"tree-node-toggle",onClick:h=>{h.stopPropagation(),G(!I)},style:{visibility:L?"visible":"hidden"},children:I?"▾":"▸"}),e.jsx("span",{className:"tree-node-status",style:{background:q[r.status]||"#888"}}),e.jsx("div",{className:"tree-node-info",children:O?e.jsx("input",{className:"tree-node-rename-input",value:C,onChange:h=>$(h.target.value),onBlur:()=>S(r.id),onKeyDown:h=>{h.key==="Enter"&&S(r.id),h.key==="Escape"&&b()},onClick:h=>h.stopPropagation(),autoFocus:!0}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tree-node-title",children:r.title||r.name}),e.jsxs("span",{className:"tree-node-meta",children:[Y[r.status]||r.status,r.createdBy&&r.createdBy!=="user"&&` · ${r.createdBy}`,` · ${M(r.createdAt)}`]})]})}),L&&e.jsx("span",{className:"tree-node-badge",children:s.children.length}),!d&&e.jsxs("div",{className:"tree-node-actions",onClick:h=>h.stopPropagation(),children:[e.jsx("button",{className:"tree-node-action-btn",title:"新建子会话",onClick:()=>c(r.id),children:"➕"}),e.jsx("button",{className:"tree-node-action-btn",title:"配置",onClick:()=>p(r.id),children:"⚙"}),e.jsx("button",{className:"tree-node-action-btn",title:"重命名",onClick:()=>m(r.id,r.title||r.name),children:"✎"}),r.status==="active"&&e.jsx("button",{className:"tree-node-action-btn",title:"归档",onClick:()=>n(r.id),children:"▪"}),e.jsx("button",{className:"tree-node-action-btn danger",title:"删除",onClick:()=>j(r.id),children:"✕"})]})]}),T===r.id&&e.jsx("div",{style:{marginLeft:o*24+24},children:e.jsx(je,{config:r.config||{},resolvedConfig:t,inheritedConfig:g,options:A,onSave:h=>f(r.id,h),onCancel:E})}),L&&I&&e.jsx("div",{className:"tree-node-children",children:s.children.map(h=>e.jsxs("div",{className:"tree-child-wrapper",children:[h.session.inputContext&&e.jsxs("div",{className:"tree-flow-label",style:{marginLeft:(o+1)*24},children:[e.jsx("span",{className:"tree-flow-arrow",children:"↓"}),e.jsx("span",{className:"tree-flow-text",children:X(h.session.inputContext,80)})]}),e.jsx(Z,{node:h,selectedId:x,activeSessionId:N,onSelect:l,depth:o+1,batchMode:d,selected:a,onToggleSelect:v,onCreateChild:c,onRename:m,onArchive:n,onDelete:j,onOpenConfig:p,editingId:y,editTitle:C,onEditTitleChange:$,onCommitRename:S,onCancelEdit:b,configEditingId:T,configOptions:A,resolvedConfig:t,inheritedConfig:g,onSaveConfig:f,onCancelConfig:E}),h.session.result&&e.jsxs("div",{className:"tree-flow-label result",style:{marginLeft:(o+1)*24},children:[e.jsx("span",{className:"tree-flow-arrow",children:"↑"}),e.jsx("span",{className:"tree-flow-text",children:X(h.session.result,80)})]})]},h.session.id))})]})}function fe({detail:s,onSwitchSession:x,onRefresh:N}){const l=s.session,o=xe(s.messages),[d,a]=pe(l.id,l.status);return u.useEffect(()=>{d.done&&(a(),N==null||N())},[d.done,a,N]),e.jsxs("div",{className:"session-detail",children:[e.jsxs("div",{className:"session-detail-header",children:[e.jsx("h3",{children:l.title||l.name}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[x&&e.jsx("button",{className:"btn btn-sm btn-primary",onClick:()=>x(l.id),children:"进入对话"}),e.jsx("span",{className:"session-detail-status",style:{color:q[l.status]},children:Y[l.status]})]})]}),e.jsxs("div",{className:"session-detail-meta",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"ID:"})," ",l.id]}),e.jsxs("div",{children:[e.jsx("strong",{children:"创建时间:"})," ",new Date(l.createdAt).toLocaleString("zh-CN")]}),l.parentId&&e.jsxs("div",{children:[e.jsx("strong",{children:"父会话:"})," ",l.parentId]}),l.createdBy&&e.jsxs("div",{children:[e.jsx("strong",{children:"创建者:"})," ",l.createdBy]}),l.children.length>0&&e.jsxs("div",{children:[e.jsx("strong",{children:"子会话数:"})," ",l.children.length]})]}),l.inputContext&&e.jsxs("div",{className:"session-detail-context",children:[e.jsx("div",{className:"context-label",children:"来自父会话的指令"}),e.jsx("div",{className:"context-content",children:l.inputContext})]}),l.result&&e.jsxs("div",{className:"session-detail-result",children:[e.jsx("div",{className:"context-label",children:"给父会话的结果"}),e.jsx("div",{className:"context-content",children:l.result})]}),e.jsxs("div",{className:"session-detail-messages",children:[e.jsxs("h4",{children:["消息记录 (",s.messages.length,")"]}),o.length===0&&!d.isStreaming?e.jsx("div",{className:"no-messages",children:"暂无消息记录"}):e.jsxs("div",{className:"message-list",children:[o.map((v,c)=>e.jsx(ve,{msg:v},c)),d.isStreaming&&d.segments.length>0&&e.jsxs("div",{className:"detail-message assistant streaming",children:[e.jsxs("div",{className:"detail-msg-role",children:["助手 ",e.jsx("span",{className:"streaming-indicator",children:"●"})]}),e.jsx("div",{className:"detail-msg-content detail-msg-md",children:(()=>{const v=[];let c=0;for(;c<d.segments.length;){const m=d.segments[c];if(m.type==="reasoning_text"){let n="";for(;c<d.segments.length&&d.segments[c].type==="reasoning_text";)n+=d.segments[c].content,c++;n&&v.push(e.jsxs("details",{className:"thinking-block",open:!0,children:[e.jsxs("summary",{className:"thinking-summary",children:[e.jsx(V,{size:14})," 思考过程"]}),e.jsx("div",{className:"thinking-content",children:e.jsx(F,{remarkPlugins:z,rehypePlugins:R,components:_,children:B(n)})})]},`r-${c}`));continue}v.push(e.jsx(ee,{seg:m},c)),c++}return v})()})]})]})]})]})}function ee({seg:s}){return s.type==="text"||s.type==="reasoning_text"?s.content?e.jsx("div",{className:"detail-text-segment",children:e.jsx(F,{remarkPlugins:z,rehypePlugins:R,components:_,children:B(s.content)})}):null:e.jsxs("details",{className:"tool-call-block",children:[e.jsxs("summary",{className:"tool-call-summary",children:[e.jsx(ge,{size:14})," ",s.name,s.result==null?" …":""]}),e.jsxs("div",{className:"tool-call-content",children:[e.jsxs("div",{className:"tool-call-args",children:[e.jsx("strong",{children:"参数"}),e.jsx("pre",{children:JSON.stringify(s.args,null,2)})]}),s.result!=null&&e.jsxs("div",{className:"tool-call-result",children:[e.jsx("strong",{children:"结果"}),e.jsx("pre",{children:s.result})]})]})]})}function ve({msg:s}){const x=s.role==="user"?"用户":"助手";if(s.role==="user")return e.jsxs("div",{className:`detail-message ${s.role}`,children:[e.jsx("div",{className:"detail-msg-role",children:x}),e.jsx("div",{className:"detail-msg-content",children:s.content}),s.timestamp>0&&e.jsx("div",{className:"detail-msg-time",children:M(s.timestamp)})]});if(s.role==="assistant"&&s.segments&&s.segments.length>0){const l=[];let o=0;for(;o<s.segments.length;){const d=s.segments[o];if(d.type==="reasoning_text"){let a="";for(;o<s.segments.length&&s.segments[o].type==="reasoning_text";)a+=s.segments[o].content,o++;a&&l.push(e.jsxs("details",{className:"thinking-block",children:[e.jsxs("summary",{className:"thinking-summary",children:[e.jsx(V,{size:14})," 思考过程"]}),e.jsx("div",{className:"thinking-content",children:e.jsx(F,{remarkPlugins:z,rehypePlugins:R,components:_,children:B(a)})})]},`r-${o}`));continue}l.push(e.jsx(ee,{seg:d},o)),o++}return e.jsxs("div",{className:`detail-message ${s.role}`,children:[e.jsx("div",{className:"detail-msg-role",children:x}),e.jsx("div",{className:"detail-msg-content detail-msg-md",children:l}),s.timestamp>0&&e.jsx("div",{className:"detail-msg-time",children:M(s.timestamp)})]})}const N=s.role==="assistant"&&s.reasoningContent?e.jsxs("details",{className:"thinking-block",children:[e.jsxs("summary",{className:"thinking-summary",children:[e.jsx(V,{size:14})," 思考过程"]}),e.jsx("div",{className:"thinking-content",children:e.jsx(F,{remarkPlugins:z,rehypePlugins:R,components:_,children:B(s.reasoningContent)})})]}):null;return e.jsxs("div",{className:`detail-message ${s.role}`,children:[e.jsx("div",{className:"detail-msg-role",children:x}),N,e.jsx("div",{className:"detail-msg-content detail-msg-md",children:e.jsx(F,{remarkPlugins:z,rehypePlugins:R,components:_,children:B(s.content)})}),s.timestamp>0&&e.jsx("div",{className:"detail-msg-time",children:M(s.timestamp)})]})}export{Se as SessionsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ai as o,aj as n}from"./mermaid.core-BynBM-Vs.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as t,C as e}from"./chunk-727SXJPM-Tw-HZebR.js";import{_ as i}from"./mermaid.core-BynBM-Vs.js";import"./chunk-FMBD7UC4-Di13fFRw.js";import"./chunk-ND2GUHAM-CMECQpX8.js";import"./chunk-55IACEB6-C4x7Ajeo.js";import"./chunk-2J33WTMH-CKFQywNP.js";import"./index-Lxc_JKBO.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-B2G8c9k5.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as t,C as e}from"./chunk-727SXJPM-Tw-HZebR.js";import{_ as i}from"./mermaid.core-BynBM-Vs.js";import"./chunk-FMBD7UC4-Di13fFRw.js";import"./chunk-ND2GUHAM-CMECQpX8.js";import"./chunk-55IACEB6-C4x7Ajeo.js";import"./chunk-2J33WTMH-CKFQywNP.js";import"./index-Lxc_JKBO.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-B2G8c9k5.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|