AgentDrawer-DrpR1eVS.js 3.1 KB

1
  1. var I=Object.defineProperty;var d=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var f=(t,o,e)=>o in t?I(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,g=(t,o)=>{for(var e in o||(o={}))x.call(o,e)&&f(t,e,o[e]);if(d)for(var e of d(o))_.call(o,e)&&f(t,e,o[e]);return t};var p=(t,o,e)=>new Promise((i,s)=>{var m=r=>{try{n(e.next(r))}catch(c){s(c)}},l=r=>{try{n(e.throw(r))}catch(c){s(c)}},n=r=>r.done?i(r.value):Promise.resolve(r.value).then(m,l);n((e=e.apply(t,o)).next())});import{B as A,u as D}from"./useForm-DYTnyn58.js";import{b as B,aq as P,v as F,_ as T}from"./entry/index-CP6zkLsN-1726190694502.js";import{B as k,a as v}from"./index-Bh1SitHa.js";import{u as C,c as S}from"./agent-CAtQePbh.js";import{d as $,f as y,c as R,u,a6 as w,_ as O,a7 as j,a8 as q,k as L,aa as N}from"./vue-CmlY4eyV.js";const{t:U}=B(),Y=[{title:"角色名称",dataIndex:"name",width:100},{title:"角色设定",dataIndex:"role",width:100},{title:"背景介绍",dataIndex:"background",width:100},{title:"对话案例",dataIndex:"examples",width:100},{title:U("common.createTime"),dataIndex:"createdAt",width:70,customRender:({record:t})=>P(t.createdAt)}],Z=[{field:"name",label:"角色名称",component:"Input",colProps:{span:8}},{field:"role",label:"角色设定",component:"Input",colProps:{span:8}},{field:"background",label:"背景介绍",component:"Input",colProps:{span:8}}],V=[{field:"id",label:"ID",component:"Input",show:!1},{field:"name",label:"角色名称",component:"Input",required:!0,componentProps:{maxlength:20,showCount:!0},rules:[{max:20}]},{field:"role",label:"角色设定",component:"InputTextArea",required:!0,componentProps:{maxlength:1e3,showCount:!0},rules:[{max:1e3}]},{field:"background",label:"背景介绍",component:"InputTextArea",componentProps:{maxlength:1e3,showCount:!0},rules:[{max:1e3}]},{field:"examples",label:"对话案例",component:"InputTextArea",componentProps:{maxlength:5e3,showCount:!0},rules:[{max:5e3}]}],z=$({name:"AgentDrawer",components:{BasicDrawer:k,BasicForm:A},emits:["success","register"],setup(t,{emit:o}){const e=y(!0);F.useI18n();const[i,{resetFields:s,setFieldsValue:m,validate:l}]=D({labelWidth:160,baseColProps:{span:24},layout:"vertical",schemas:V,showActionButtonGroup:!1}),[n,{setDrawerProps:r,closeDrawer:c}]=v(a=>p(this,null,function*(){s(),r({confirmLoading:!1}),e.value=!!(a!=null&&a.isUpdate),u(e)&&m(g({},a.record))})),h=R(()=>u(e)?"编辑AI角色":"添加AI角色");function b(){return p(this,null,function*(){const a=yield l();r({confirmLoading:!0}),a.id=u(e)?Number(a.id):0,(u(e)?yield C(a):yield S(a)).code===0&&(c(),o("success")),r({confirmLoading:!1})})}return{registerDrawer:n,registerForm:i,getTitle:h,handleSubmit:b}}});function G(t,o,e,i,s,m){const l=w("BasicForm"),n=w("BasicDrawer");return O(),j(n,N(t.$attrs,{onRegister:t.registerDrawer,showFooter:"",title:t.getTitle,width:"35%",onOk:t.handleSubmit}),{default:q(()=>[L(l,{onRegister:t.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}const M=T(z,[["render",G]]),ee=Object.freeze(Object.defineProperty({__proto__:null,default:M},Symbol.toStringTag,{value:"Module"}));export{M as A,ee as a,Y as c,Z as s};