import{E as A}from"./el-alert-DBfM1mZE.js";import{a as N,E as T}from"./el-form-item-Ct_zBuY0.js";import{E as B}from"./index-CbmPSBt0.js";import{E as I}from"./index-CCavIuTY.js";import{E as R}from"./el-tag-C_D80BPW.js";import{d as P,z as q,G as D,e as r,w as t,j as y,y as E,o as n,s as a,f as F,ar as U,x as m,aa as W,c as j,g as z,A as M,v as G,ac as H}from"./index-CGB0A5x_.js";import{P as L}from"./PageCard-D1lOaeEG.js";import{a as O,m as S}from"./model-xlHsHa68.js";import{_ as J}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./vnode-DFpZw5lG.js";import"./castArray-Cgg396Sr.js";import"./_baseClone-CX1E8HTZ.js";import"./raf-CCivjDro.js";import"./index-D2-3cnGo.js";import"./index-DMVRI44M.js";import"./el-card-BWcR1iD2.js";const K={key:0,class:"model-status"},Q=P({__name:"MergeWeightsView",setup(X){const v=H(),b=G(),s=E(!1),u=y(()=>v.query.model||""),w=y(()=>v.query.method||"lora"),i=E([]),_=y(()=>i.value.find(l=>l.name===u.value)),o=q({model_name:u.value,train_method:w.value,base_model_path:""});async function V(){try{const l=await O();i.value=(l==null?void 0:l.models)||[];const e=i.value.find(p=>p.name===u.value);o.base_model_path=(e==null?void 0:e.base_model_path)||""}catch{}}async function k(){if(!o.model_name||!o.base_model_path){M.warning("缺少模型信息");return}s.value=!0;try{await S({model_name:o.model_name,train_method:o.train_method,base_model_path:o.base_model_path}),M.success("合并成功"),b.push("/model-manage")}catch{}finally{s.value=!1}}function x(){b.back()}return D(V),(l,e)=>{const p=A,f=B,d=N,h=I,C=T,c=R;return n(),r(L,{title:"合并权重"},{default:t(()=>[a(p,{type:"info",closable:!1,"show-icon":"",title:"将 LoRA 适配器权重合并到基座模型，合并后可直接用于推理部署。",style:{"margin-bottom":"20px"}}),a(C,{"label-width":"120px",style:{"max-width":"600px"}},{default:t(()=>[a(d,{label:"模型名称"},{default:t(()=>[a(f,{modelValue:o.model_name,"onUpdate:modelValue":e[0]||(e[0]=g=>o.model_name=g),disabled:""},null,8,["modelValue"])]),_:1}),a(d,{label:"训练方法"},{default:t(()=>[a(f,{"model-value":F(U)[o.train_method]||o.train_method,disabled:""},null,8,["model-value"])]),_:1}),a(d,{label:"基座模型路径"},{default:t(()=>[a(f,{modelValue:o.base_model_path,"onUpdate:modelValue":e[1]||(e[1]=g=>o.base_model_path=g),placeholder:"基座模型路径"},null,8,["modelValue"])]),_:1}),a(d,null,{default:t(()=>[a(h,{type:"primary",loading:s.value,onClick:k},{default:t(()=>[m(W(s.value?"合并中...":"开始合并"),1)]),_:1},8,["loading"]),a(h,{onClick:x},{default:t(()=>[...e[2]||(e[2]=[m("取消",-1)])]),_:1})]),_:1})]),_:1}),_.value?(n(),j("div",K,[_.value.merging?(n(),r(c,{key:0,type:"warning"},{default:t(()=>[...e[3]||(e[3]=[m("合并中",-1)])]),_:1})):_.value.merged?(n(),r(c,{key:1,type:"success"},{default:t(()=>[...e[4]||(e[4]=[m("已合并",-1)])]),_:1})):(n(),r(c,{key:2,type:"info"},{default:t(()=>[...e[5]||(e[5]=[m("未合并",-1)])]),_:1}))])):z("",!0)]),_:1})}}}),pe=J(Q,[["__scopeId","data-v-2d4f1cb8"]]);export{pe as default};
