UnisKB/static/chat/assets/index-CBT8L2dk.js

2 lines
14 KiB
JavaScript
Raw Normal View History

import{ce as Q,b0 as t,bc as x,b5 as o,aW as de,aX as ce,aY as L,a_ as me,aZ as h,aU as O,bp as ue,cZ as fe,a$ as r,b1 as i,b$ as ye,b2 as e,b3 as a,b6 as F,b7 as M,b8 as p,bk as w,bl as V,ca as he,c4 as ge,c0 as ke,cF as be,c6 as we,b9 as j,bm as $e,bb as Ce,bq as pe,bW as Me,bX as Se,cf as re,dA as se,br as ne,bj as Te,dB as xe,bd as X,be as K,c9 as Le,dC as Ie,dD as De}from"./chat-qPBzecKv.js";import{E as Ae,_ as Re}from"./ParamSettingDialog.vue_vue_type_script_setup_true_lang-ChWmnxX3.js";import{_ as Ne}from"./AuthorizedWorkspaceDialog.vue_vue_type_script_setup_true_lang-DH2DKlXp.js";import"./permission-api-DGZfyy6y.js";import"./workspace-CSuuUCkN.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=Q(Be,[["render",Ve],["__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%"}},Ze={key:0,class:"progress-mask"},qe={class:"percentage-label flex-center"},Ye=de({__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(),d=L(()=>y.value?y.value:m.model),f=L(()=>d.value.meta&&d.value.meta.message?d.value.meta.message==="pull model manifest: file does not exist"?`${d.value.model_name} ${O("views.model.tip.noModel")}`:d.value.meta.message:""),v=I,g=h();let R;const P=()=>{we(`${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 b;const l=m.provider_list.find(c=>c.provider===m.model.provider);l&&((b=g.value)==null||b.open(l,m.model))},T=L(()=>{var l;return(l=m.provider_list.find(b=>b.provider===m.model.provider))==null?void 0:l.icon}),C=()=>{R=setInterval(()=>{d.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)},Z=()=>{R&&clearInterval(R)},H=h(),q=()=>{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(()=>{Z()}),(l,b)=>{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"),z=r("el-dropdown-item"),le=r("el-dropdown-menu"),oe=r("el-dropdown"),te=r("card-box");return t(),i(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),d.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"])])):w("",!0),d.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"])])):w("",!0)])]),subTitle:e(()=>[a($,{class:"color-secondary lighter",size:"small"},{default:e(()=>[M(p(l.$t(