7 lines
13 KiB
Java
7 lines
13 KiB
Java
|
|
var L=(T,k,p)=>new Promise((c,u)=>{var o=m=>{try{C(p.next(m))}catch(y){u(y)}},x=m=>{try{C(p.throw(m))}catch(y){u(y)}},C=m=>m.done?c(m.value):Promise.resolve(m.value).then(o,x);C((p=p.apply(T,k)).next())});import{M as pe}from"./BasicModal-xH56XuRZ.js";import"./index-BDvqZ5j4.js";import{bg as ce,F as z,aB as fe,bR as ge,T as ve,aQ as _e,v as Ce,bn as U,d as ye,au as be}from"./index-X7Y8jykP.js";import we from"./JDictSelectTag-DqzD0_k1.js";import Ie from"./AiAppParamsSettingModal-Y8bekrPn.js";import Le from"./AiAppGeneratedPromptModal-CMPfVKhY.js";import{A as xe}from"./AiragExtDataModal-BEtOm6SJ.js";import Me from"./EvaluatorDebug-DXD6HRcB.js";import{d as ke}from"./ailogo-D9r5yA-q.js";import{s as he,b as Se}from"./AiragExtData.api-DmLB6bmK.js";import{a as Ae,u as V}from"./useModal-DaJ3Bflg.js";import{T as Oe}from"./index-J2mOtM3w.js";import{e as Ve,r as g,b as Re,C as Pe,z as M,f as s,A as l,u as _,K as q,Q as a,y as R,H as P,B as j,E as i,G as Te}from"./vue-vendor-DNhG1Cve.js";import{O as Ee}from"./index-CuWaQdlK.js";import{A as Fe}from"./index-DO7ZhK45.js";import"./ModalHeader-Sr8KwhJJ.js";import"./useTimeout-D5AmIBZw.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./index-BzChaRPg.js";import"./useWindowSizeFn-C-0M9_Ul.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./useAppInject-DPZGPcR3.js";import"./index-Cq6YxX27.js";import"./useFormItem-b_EqFlJz.js";import"./CompTypeEnum-Dk5ke9k4.js";import"./index-DfHu-LAS.js";import"./Group-DBzJABA_.js";import"./Checkbox-Dbxs4we4.js";import"./RadioButton-DRBix2Fq.js";import"./BasicForm-ClUSoD_-.js";import"./helper-DcLcf4v6.js";import"./BasicForm.vue_vue_type_style_index_0_lang-B29PWQy0.js";import"./index-saD4h7VJ.js";import"./useBreakpoint-DXhPW7nV.js";import"./useEventListener-BRXjwk7A.js";import"./breakpointEnum-BhAg6bcX.js";import"./uniqBy--vsL0WVB.js";import"./index-C9_hfRup.js";import"./onMountedOrActivated-DhSdLlqP.js";import"./AiModelSeniorForm-Bic3Uet9.js";import"./index-DsixALRt.js";import"./index--p9d2PTL.js";import"./index-DklMb9Qc.js";import"./UpOutlined-B1UMbtrP.js";import"./AiApp.api-CJyVZaoW.js";import"./AiAppPromptMarketModal-BB4sBJvi.js";import"./AiragPrompts.api-CMJu92vx.js";import"./index-BwqG9R3y.js";import"./useForm-D61zovon.js";const Ne={class:"p-2"},$e={style:{display:"flex",width:"100%","justify-content":"space-between","align-items":"center"}},Be={style:{display:"flex"}},ze=["src"],Ue={class:"header-name"},qe={style:{display:"flex"}},je={style:{height:"100%",width:"100%"}},De={class:"prologue-chunk"},Je={style:{display:"flex","justify-content":"space-between",width:"100%","margin-right":"2px"}},He={class:"prompt-back"},Qe={class:"prompt-title-padding item-title space-between"},Ge={class:"variable-container"},Ke={class:"variable-container-header"},We={class:"variable-container-content"},Xe={class:"variable-tag-wrapper"},Ye={class:"output-format-card"},Ze={class:"output-format-header"},et=Ve({__name:"AiEvaluatorSettingModal",emits:["success","register"],setup(T,{emit:k}){const p=g(!1);g(ce(16));const c=g(!0),u=g(null),o=Re({id:"",name:"",dataValue:"",descr:"",modelId:"",metadata:""}),x=g({dataValue:[{required:!0,message:"请输入提示词!"}],modelId:[{required:!0,message:"请选择AI模型!"}]}),C=z.useForm,{resetFields:m,validate:y,validateInfos:E}=C(o,x,{immediate:!1}),F=g({span:24}),N=g({span:24}),r=g({}),h=k,[D,{closeModal:$,setModalProps:S}]=Ae(t=>L(null,null,function*(){p.value=!!(t!=null&&t.isUpdate),le(),m(),p.value&&B(t.record),S({bodyStyle:{padding:"10px"}})})),[J,{openModal:H}]=V(),[Q,{openModal:G}]=V(),[K,{openModal:W}]=V();function X(){W(!0,{isUpdate:!0,showFooter:!0,record:{id:o.id,name:o.name,descr:o.descr}})}function Y(){return L(this,null,function*(){try{let t=yield y();r.value.modelId=t.modelId,t.metadata=JSON.stringify(_e(r.value)),t=Object.assign(o,t),yield he(t,p.value),S({confirmLoading:!0}),$(),h("success")}finally{S({confirmLoading:!1})}})}funct
|
|||
|
|
\r
|
|||
|
|
${e}:{{${t}}}`,setTimeout(()=>{const n=document.querySelector("textarea.ant-input");n&&(n.scrollTop=n.scrollHeight)},0)):o.dataValue=`${e}:{{${t}}}`}function ee(t){t||h("success")}function te(t){B(t),h("success")}function ae(t){H(!0,{type:t,metadata:r.value})}function oe(t){Object.assign(r.value,t)}function se(){return o.icon?Ce(o.icon):ke}function le(){o.id="",o.name="",o.dataValue="",o.descr="",o.modelId="",o.metadata=""}function B(t){Object.assign(o,t),t!=null&&t.metadata&&(r.value=t.metadata?JSON.parse(t.metadata):{},o.modelId=t.metadata&&JSON.parse(t.metadata).modelId||"")}function ne(){G(!0,{})}function ie(t){o.dataValue=t}function re(t){return L(this,null,function*(){var v;let e=o.dataValue,n="输入的内容:";if(t.forEach(I=>{n+=`${I.name}:${I.value}`}),e+=`定义返回格式:
|
|||
|
|
|
|||
|
|
得分:最终的得分,必须输出,必须输出一个数字,表示满足Prompt中评分标准的程度。得分范围从 0.0 到 1.0,1.0 表示完全满足评分标准,0.0 表示完全不满足评分标准。
|
|||
|
|
原因:(对得分的可读解释)。最后,必须用一句话结束理由,该句话为:因此,应该给出的分数是(你前面得出的评分)。`,!o.modelId){U.warning("请选择AI模型");return}if((v=u.value)==null?void 0:v.loading)return;u.value.loading=!0;let w={prompts:e,content:n,modelId:o.modelId,modelParam:JSON.stringify(o.metadata)},d=yield Se(w).catch(()=>u.value.loading=!1);u.value.loading=!1,d.success?u.value.result=d.result:U.error(d.message)})}function de(t){return L(this,null,function*(){if(!t){r.value.modelInfo&&delete r.value.modelInfo;return}try{const e=yield ye.get({url:"/airag/airagModel/queryById",params:{id:t}},{isTransformResponse:!1});if(e.success&&e.result){const n=e.result;r.value||(r.value={}),r.value.modelInfo={provider:n.provider||"",modelType:n.modelType||"",modelName:n.modelName||""}}}catch(e){}})}return(t,e)=>{const n=q("Icon"),b=ve,w=q("a-button"),d=Fe,v=Ee,I=fe,ue=ge,O=Oe,me=z;return M(),Pe("div",Ne,[s(pe,{wrapClassName:"ai-prompt-edit-modal",destroyOnClose:"",onRegister:_(D),canFullscreen:!1,defaultFullscreen:"",width:"800px",footer:null,onVisibleChange:ee,onCancel:Z},{title:l(()=>[a("div",$e,[a("div",Be,[a("img",{src:se(),class:"header-img"},null,8,ze),a("div",Ue,Te(o.name),1),s(b,{title:"提示词评估器"},{default:l(()=>[s(n,{icon:"ant-design:edit-outlined",style:{"margin-left":"4px",cursor:"pointer"},color:"#354052",size:"20",onClick:X})]),_:1})]),a("div",qe,[s(w,{onClick:Y,style:{"margin-right":"30px"},type:"primary"},{default:l(()=>[...e[7]||(e[7]=[i("保存",-1)])]),_:1})])])]),default:l(()=>[a("div",je,[s(v,{span:24},{default:l(()=>[s(d,{span:c.value?12:24},{default:l(()=>[...e[8]||(e[8]=[a("div",{class:"orchestration"},"提示词评估器",-1)])]),_:1},8,["span"]),c.value?(M(),R(d,{key:0,span:12},{default:l(()=>[...e[9]||(e[9]=[a("div",{class:"view"},"构造测试数据",-1)])]),_:1})):P("",!0)]),_:1}),s(v,{span:24},{default:l(()=>[s(d,{span:c.value?12:24,class:"setting-left"},{default:l(()=>[s(me,{class:"antd-modal-form",ref:"formRef",model:o,rules:x.value},{default:l(()=>[s(v,null,{default:l(()=>[s(d,{span:24},{default:l(()=>[a("div",De,[s(I,j({labelCol:F.value,wrapperCol:N.value},_(E).modelId),{label:l(()=>[a("div",Je,[e[11]||(e[11]=a("div",{class:"item-title"},"AI模型",-1)),a("div",{onClick:e[0]||(e[0]=f=>ae("model")),class:"knowledge-txt"},[s(n,{icon:"ant-design:setting-outlined",size:"13",style:{"margin-right":"2px"}}),e[10]||(e[10]=i("参数配置 ",-1))])])]),default:l(()=>[s(we,{value:o.modelId,"onUpdate:value":e[1]||(e[1]=f=>o.modelId=f),placeholder:"请选择AI模型","dict-code":"airag_model where model_type = 'LLM' and activate_flag = 1,name,id",style:{width:"100%"},onChange:de},null,8,["value"])]),_:1},16,["labelCol","wrapperCol"])])]),_:1}),s(d,{span:24,class:"mt-10"},{default:l(()=>[a("div",He,[s(I,j({labelCol:F.value,wrapperCol:N.value},_(E).dataValue,{style:{"margin-bottom":"0"}}),{label:l(()=>[a("div",Qe,[e[13]||(e[13]=a("span",null,"评估器",-1)),s(w,{size:"middle",ghost:""},{default:l(()=>[a("span",{style:{"align-items":"center",display:"flex"},onClick:ne},[...e[12]||(e[12]=[a("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M18.9839 1.85931C19.1612 1.38023 19.8388 1.38023 20.0161 1.85931L20.5021 3.17278C20.5578 3.3234 20.6766 3.44216 20.8272 3.49789L22.1407 3.98392C22.6198 4.1612 22.6198 4.8388 22.1407 5.01608L20.8272 5.50211C20.6766 5.55784 20.5578 5.6766 20.5021 5.82722L20.0161 7.14069C19.8388 7.61977 19.1612 7.61977 18.9839 7.14069L18.4979 5.82722C18.4422 5.6766 18.3234 5.55784 18.1728 5.50211L16.8593 5.01608C16.3802 4.8388 16.3802 4.1612 16.8593 3.98392L18.1728 3.49789C18.3234 3.44216 18.4422 3.3234 18.4979 3.17278L18.9839 1.85931zM13.5482 4.07793C13.0164 2.64069 10.9836 2.64069 10.4518 4.07793L8.99368 8.01834C8.82648 8.47021 8.47021 8.82648 8.01834 8.99368L4.07793 10.4518C2.64069 10.9836 2.64069 13.0164 4.07793 13.5482L8.01834 15.0063C8.47021 15.1735 8.82648 15.5298 8.99368 15.9817L10.4518 19.9221C10.9836 21.3593 13.0164 21.3593 13.5482 19.9221L15.0063 15.
|