2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
|
|
import{cf as Z,aE as t,aW as x,aI as o,ay as ie,aQ as ce,aO as L,aP as me,aB as h,aC as P,b6 as ue,cY as ye,aD as r,aF as d,bV as fe,aG as e,aH as a,aS as O,aK as M,aJ as p,b1 as $,b2 as V,c4 as he,b_ as ge,bW as ke,cE as we,c0 as $e,aT as Y,b3 as be,aV as Ce,b7 as pe,bG as Me,bH as Se,ce as re,dz as se,b8 as ne,aA as Te,dA as xe,aX as X,aY as q,c3 as Le,dB as Ie,dC as De}from"./admin-DgPvPHD7.js";import{E as Ae,_ as Re}from"./ParamSettingDialog.vue_vue_type_script_setup_true_lang-BObAWV4i.js";import{_ as Ne}from"./AuthorizedWorkspaceDialog.vue_vue_type_script_setup_true_lang-BZwUYFPH.js";import"./permission-api-KeGpSf5X.js";import"./workspace-D2rVZOhW.js";const Be={},Ee={class:"loading-container loader"};function Ve(n,I){return t(),x("div",Ee,[...I[0]||(I[0]=[o("div",{class:"download-loading"},[o("div"),o("div"),o("div"),o("div"),o("div"),o("div"),o("div"),o("div")],-1)])])}const ze=Z(Be,[["render",Ve],["__scopeId","data-v-91938551"]]),Oe=["innerHTML"],Pe={class:"flex",style:{height:"22px"}},Fe=["title"],We={key:0},He={key:1},Ge={class:"flex mb-4"},Ue={class:"ellipsis ml-16"},Xe={class:"flex"},Ye={class:"ellipsis-1 ml-16",style:{height:"20px",width:"70%"}},je={key:0,class:"progress-mask"},Je={class:"percentage-label flex-center"},Ke=ie({__name:"ModelCard",props:{model:{},provider_list:{},updateModelById:{type:Function},isShared:{type:Boolean},isSystemShare:{type:Boolean},apiType:{}},emits:["change","update:model"],setup(n,{emit:I}){ce();const m=n,D=L(()=>m.apiType==="systemShare"),k=L(()=>me.model[m.apiType]),A=l=>k.value.modify(l)||k.value.delete(l)||k.value.auth(l)||D.value,S=h();function W(l){S.value.open(l.id)}const f=h(),i=L(()=>f.value?f.value:m.model),y=L(()=>i.value.meta&&i.value.meta.message?i.value.meta.message==="pull model manifest: file does not exist"?`${i.value.model_name} ${P("views.model.tip.noModel")}`:i.value.meta.message:""),v=I,g=h();let R;const F=()=>{$e(`${P("views.model.delete.confirmTitle")}${m.model.name} ?`,P("views.model.delete.confirmMessage"),{confirmButtonText:P("common.confirm"),confirmButtonClass:"danger"}).then(()=>{Y({type:"model",systemType:m.apiType}).deleteModel(m.model.id).then(()=>{v("change"),be(P("common.deleteSuccess"))})}).catch(()=>{})},N=()=>{Y({type:"model",systemType:m.apiType}).pauseDownload(m.model.id).then(()=>{f.value=void 0,v("change")})},B=()=>{var w;const l=m.provider_list.find(c=>c.provider===m.model.provider);l&&((w=g.value)==null||w.open(l,m.model))},T=L(()=>{var l;return(l=m.provider_list.find(w=>w.provider===m.model.provider))==null?void 0:l.icon}),C=()=>{R=setInterval(()=>{i.value.status==="DOWNLOAD"?Y({type:"model",systemType:m.apiType}).getModelMetaById(m.model.id).then(l=>{f.value=l.data}):f.value&&(m.updateModelById(m.model.id,f.value),f.value=void 0)},6e3)},j=()=>{R&&clearInterval(R)},H=h(),J=()=>{var l;(l=H.value)==null||l.open(m.model)},G=h();function U(l){G.value&&G.value.open(l,"Model")}return ue(()=>{C()}),ye(()=>{j()}),(l,w)=>{const c=r("WarningFilled"),s=r("el-icon"),u=r("el-tooltip"),b=r("el-text"),ee=r("el-tag"),K=r("el-button"),E=r("AppIcon"),z=r("el-dropdown-item"),le=r("el-dropdown-menu"),oe=r("el-dropdown"),te=r("card-box");return t(),d(te,{title:n.model.name,shadow:"hover",class:"model-card"},fe({icon:e(()=>[o("span",{style:{height:"32px",width:"32px"},innerHTML:T.value},null,8,Oe)]),title:e(()=>[o("div",Pe,[o("span",{class:"ellipsis-1 mb-4",title:n.model.name,style:{"max-width":"80%"}},p(n.model.name),9,Fe),i.value.status==="ERROR"?(t(),x("span",We,[a(u,{effect:"dark",content:y.value,placement:"top"},{default:e(()=>[a(s,{class:"color-danger ml-4",size:"18"},{default:e(()=>[a(c)]),_:1})]),_:1},8,["content"])])):$("",!0),i.value.status==="PAUSE_DOWNLOAD"?(t(),x("span",He,[a(u,{effect:"dark",content:`${l.$t("views.model.modelForm.base_model.label")}: ${m.model.model_name} ${l.$t("views.model.tip.downloadError")}`,placement:"top"},{default:e(()=>[a(s,{class:"color-danger ml-4",size:"18"},{default:e(()=>[a(c)]),_:1})]),_:1},8,["content"])])):$("",!0)])]),subTitle:e(()=>[a(b,{class:"color-secondary lighter",size:"small"},{default:e(()=>[M(p(l.$t
|