useSettings-4a774f12-BAxro7J8.js 2.2 KB

1
  1. import{c as N,f as S,e as p}from"./vue-vendor-Be68asQ6.js";import{aC as g,h as b,s as O,bN as y}from"./antd-vue-vendor-DcqS7Wvq.js";var h=(r=>(r.START="start",r.END="end",r.LLM="llm",r.SWITCH="switch",r.CLASSIFIER="classifier",r.KNOWLEDGE="knowledge",r.CODE="code",r.SUBFLOW="subflow",r.ENHANCE_JAVA="enhanceJava",r.HTTP="http",r.REPLY="reply",r))(h||{});function T(r){const m=N("lfRef",S()),u=p(P),f=p(()=>{if(u.value.length===0)return[];const t=[];for(const e of u.value){let s=e.properties.outputParams;e.type===h.START&&(s=e.properties.inputParams),!(!Array.isArray(s)||s.length===0)&&t.push(...s.map(i=>({nodeId:e.id,nodeName:e.properties.text,field:i.field,name:i.name,type:i.type})))}return t}),o=p({get:()=>{const{options:t}=r.properties;return t},set:t=>{r.setProperties({options:t})}}),d=p({get:()=>{const{inputParams:t}=r.properties;return Array.isArray(t)?t:[]},set:t=>{r.setProperties({inputParams:t})}}),n=p({get:()=>{const{outputParams:t}=r.properties;return Array.isArray(t)?t:[]},set:t=>{r.setProperties({outputParams:t})}}),a=p(()=>d.value.filter(t=>!!t.name&&!!t.field).map(t=>c(t))),l=p(()=>n.value.filter(t=>!!t.name&&!!t.field).map(t=>c(t)));function c(t){var e,s;return{type:(s=(e=f.value.find(i=>i.nodeId===t.nodeId&&i.field===t.field))==null?void 0:e.type)!=null?s:"-",name:t.name}}function P(){if(!m.value)return[];const{graphModel:t}=m.value;return t.$J.getAllPrevNodes(r.node)}function E(t){return p({get:()=>g(o.value,t),set:e=>A({[t]:e})})}function A(t){if(Object.entries(t).length===0)return;const e=b(o.value);for(const[s,i]of Object.entries(t))O(e,s,i);o.value=e}return{lfRef:m,prevNodes:u,prevVariables:f,options:o,inputParams:d,outputParams:n,inputVarsOptions:a,outputVarsOptions:l,updateOptions:A,createOptionRef:E}}const v=Symbol();function C(r,m){let u=null;function f(n){return u==null&&(u=m()),g(u,n)}function o(n,a=v){a===v&&(a=f(n)),O(r.properties,n,a)}function d(n="field"){let{inputParams:a,outputParams:l}=r.properties;Array.isArray(a)||(a=[]);const c=f("inputParams");Array.isArray(c)&&(a=y(a,c,n)),o("inputParams",a),Array.isArray(l)||(l=[]);const P=f("outputParams");Array.isArray(P)&&(l=y(l,P,n)),o("outputParams",l)}return{updateProp:o,mergeIOParams:d}}export{C,h as S,T as b};