2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
|
|
import{ce as Z,aE as t,bf as x,aI as o,ay as ie,b7 as ce,b8 as L,b9 as me,aB as h,aC as O,br as ue,cY as fe,aD as r,aF as d,b$ as ye,aG as e,aH as a,bb as F,aK as M,aJ as p,bm as b,bn as z,ca as he,c4 as ge,c0 as ke,cE as we,c6 as be,bc as j,bo as $e,be as Ce,bs as pe,bW as Me,bX as Se,cf as re,dz as se,bt as ne,aA as Te,dA as xe,bg as X,bh as Q,c9 as Le,dB as Ie,dC as De}from"./chat-u6cKkSMp.js";import{E as Ae,_ as Re}from"./ParamSettingDialog.vue_vue_type_script_setup_true_lang-pO0d729l.js";import{_ as Ne}from"./AuthorizedWorkspaceDialog.vue_vue_type_script_setup_true_lang-CRFB1yPI.js";import"./permission-api-BCzde5j1.js";import"./workspace--1HHfS5D.js";const Be={},Ee={class:"loading-container loader"};function ze(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 Ve=Z(Be,[["render",ze],["__scopeId","data-v-91938551"]]),Fe=["innerHTML"],Oe={class:"flex",style:{height:"22px"}},Pe=["title"],We={key:0},He={key:1},Ue={class:"flex mb-4"},Ge={class:"ellipsis ml-16"},Xe={class:"flex"},je={class:"ellipsis-1 ml-16",style:{height:"20px",width:"70%"}},Je={key:0,class:"progress-mask"},Ke={class:"percentage-label flex-center"},Ye=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 y=h(),i=L(()=>y.value?y.value:m.model),f=L(()=>i.value.meta&&i.value.meta.message?i.value.meta.message==="pull model manifest: file does not exist"?`${i.value.model_name} ${O("views.model.tip.noModel")}`:i.value.meta.message:""),v=I,g=h();let R;const P=()=>{be(`${O("views.model.delete.confirmTitle")}${m.model.name} ?`,O("views.model.delete.confirmMessage"),{confirmButtonText:O("common.confirm"),confirmButtonClass:"danger"}).then(()=>{j({type:"model",systemType:m.apiType}).deleteModel(m.model.id).then(()=>{v("change"),$e(O("common.deleteSuccess"))})}).catch(()=>{})},N=()=>{j({type:"model",systemType:m.apiType}).pauseDownload(m.model.id).then(()=>{y.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"?j({type:"model",systemType:m.apiType}).getModelMetaById(m.model.id).then(l=>{y.value=l.data}):y.value&&(m.updateModelById(m.model.id,y.value),y.value=void 0)},6e3)},J=()=>{R&&clearInterval(R)},H=h(),K=()=>{var l;(l=H.value)==null||l.open(m.model)},U=h();function G(l){U.value&&U.value.open(l,"Model")}return ue(()=>{C()}),fe(()=>{J()}),(l,w)=>{const c=r("WarningFilled"),s=r("el-icon"),u=r("el-tooltip"),$=r("el-text"),ee=r("el-tag"),Y=r("el-button"),E=r("AppIcon"),V=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"},ye({icon:e(()=>[o("span",{style:{height:"32px",width:"32px"},innerHTML:T.value},null,8,Fe)]),title:e(()=>[o("div",Oe,[o("span",{class:"ellipsis-1 mb-4",title:n.model.name,style:{"max-width":"80%"}},p(n.model.name),9,Pe),i.value.status==="ERROR"?(t(),x("span",We,[a(u,{effect:"dark",content:f.value,placement:"top"},{default:e(()=>[a(s,{class:"color-danger ml-4",size:"18"},{default:e(()=>[a(c)]),_:1})]),_:1},8,["content"])])):b("",!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"])])):b("",!0)])]),subTitle:e(()=>[a($,{class:"color-secondary lighter",size:"small"},{default:e(()=>[M(p(l.$t(
|