1 line
2.8 KiB
JavaScript
1 line
2.8 KiB
JavaScript
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,Ht as n,On as r,gn as i,k as a,mt as o,qt as s,v as c,vn as l,y as u}from"./runtime-core.esm-bundler-DkysjgTd.js";import{t as d}from"./objectSpread2-BmonrgTA.js";import{n as f}from"./objectWithoutProperties-BjoYlK0I.js";import{t as p}from"./form-CZK1ilUa.js";import{a as m}from"./config-provider-D1kcLCP5.js";import{t as h}from"./alert-CkUknOsQ.js";import{t as g}from"./modal-Ju-U4s3Q.js";import{p as _,t as v}from"./knowledge-roQbw_jw.js";import{t as y}from"./model-fields-BCrJLCzI.js";var b=a({__name:`job-config`,props:{open:{type:Boolean},accountId:{},job:{}},emits:[`update:open`,`finished`],setup(e,{emit:a}){let b=e,x=a,S=l(!1),C=i({engine:`model`,model_provider_id:``,model_timeout_seconds:90,max_model_calls:100});n(()=>b.open,e=>{!e||!b.job||Object.assign(C,{engine:b.job.options.engine,model_provider_id:b.job.options.model_provider_id||``,model_timeout_seconds:b.job.options.model_timeout_seconds||90,max_model_calls:b.job.options.max_model_calls||100})});function w(){return T.apply(this,arguments)}function T(){return T=f(function*(){if(S.value||!b.job)return;let e=b.accountId,t=b.job.id;S.value=!0;try{yield v(e,t,d({},C)),yield _(e,t,`resume`),m.success(`配置已保存,任务将从断点继续`),x(`update:open`,!1)}finally{S.value=!1,x(`finished`)}}),T.apply(this,arguments)}return(n,i)=>{var a;return o(),c(r(g),{"destroy-on-close":!0,open:e.open,title:`调整配置并继续任务`,"ok-text":`保存并继续`,"confirm-loading":S.value,closable:!S.value,keyboard:!S.value,"mask-closable":!1,"cancel-button-props":{disabled:S.value},"ok-button-props":{disabled:C.engine===`model`&&(!C.model_provider_id||C.max_model_calls<=(((a=e.job)==null?void 0:a.model_calls)||0))},onOk:w,onCancel:i[4]||(i[4]=e=>x(`update:open`,!1))},{default:s(()=>{var n,a,l;return[t(r(h),{class:`mb-4`,type:`info`,"show-icon":``,message:`已生成 ${((n=e.job)==null?void 0:n.created_items)||0} 条草稿,已调用模型 ${((a=e.job)==null?void 0:a.model_calls)||0} 次。继续任务会保留已完成结果;新配置用于剩余内容。`},null,8,[`message`]),(l=e.job)!=null&&l.error?(o(),c(r(h),{key:0,class:`mb-4`,type:`warning`,message:e.job.error},null,8,[`message`])):u(``,!0),t(r(p),{layout:`vertical`},{default:s(()=>[t(y,{engine:C.engine,"onUpdate:engine":i[0]||(i[0]=e=>C.engine=e),provider:C.model_provider_id,"onUpdate:provider":i[1]||(i[1]=e=>C.model_provider_id=e),timeout:C.model_timeout_seconds,"onUpdate:timeout":i[2]||(i[2]=e=>C.model_timeout_seconds=e),calls:C.max_model_calls,"onUpdate:calls":i[3]||(i[3]=e=>C.max_model_calls=e),"account-id":e.accountId,disabled:S.value},null,8,[`engine`,`provider`,`timeout`,`calls`,`account-id`,`disabled`])]),_:1})]}),_:1},8,[`open`,`confirm-loading`,`closable`,`keyboard`,`cancel-button-props`,`ok-button-props`])}}}),x=e({default:()=>S}),S=b;export{x as n,S as t}; |