DuyTa's picture
Upload folder using huggingface_hub
bc20498 verified
import{s as V,l as d,i as k,d as f,j as g,p as N,q as O,e as h,c as v,a as E,f as b,g as F,n as q}from"../chunks/scheduler.DB3Sqaa-.js";import{S as U,i as B,a as p,c as D,t as _,g as P,b as I,d as S,m as w,e as y}from"../chunks/index.CidI1d1E.js";import{t as m}from"../chunks/Toaster.svelte_svelte_type_style_lang.C-7zrEBl.js";import{g as W}from"../chunks/entry.JtQ7vg2d.js";import{p as j}from"../chunks/stores.m3IJIQGn.js";import{c as $,f as C,m as M}from"../chunks/index.DPWiq6NR.js";import{u as Q,g as H,a as z}from"../chunks/index.McBTOAZM.js";import{F as A}from"../chunks/FunctionEditor.B4In5SqS.js";import{S as G}from"../chunks/Spinner.zSvxKTtJ.js";import{g as J}from"../chunks/index.BS8UhGmM.js";import{e as K,c as L}from"../chunks/index.DYGdzELC.js";function T(c){let e,n,t,s;return t=new G({}),{c(){e=h("div"),n=h("div"),I(t.$$.fragment),this.h()},l(r){e=v(r,"DIV",{class:!0});var a=E(e);n=v(a,"DIV",{class:!0});var u=E(n);S(t.$$.fragment,u),u.forEach(f),a.forEach(f),this.h()},h(){b(n,"class","pb-16"),b(e,"class","flex items-center justify-center h-full")},m(r,a){k(r,e,a),F(e,n),w(t,n,null),s=!0},p:q,i(r){s||(_(t.$$.fragment,r),s=!0)},o(r){p(t.$$.fragment,r),s=!1},d(r){r&&f(e),y(t)}}}function X(c){let e,n;return e=new A({props:{edit:!0,id:c[0].id,name:c[0].name,meta:c[0].meta,content:c[0].content}}),e.$on("save",c[3]),{c(){I(e.$$.fragment)},l(t){S(e.$$.fragment,t)},m(t,s){w(e,t,s),n=!0},p(t,s){const r={};s&1&&(r.id=t[0].id),s&1&&(r.name=t[0].name),s&1&&(r.meta=t[0].meta),s&1&&(r.content=t[0].content),e.$set(r)},i(t){n||(_(e.$$.fragment,t),n=!0)},o(t){p(e.$$.fragment,t),n=!1},d(t){y(e,t)}}}function Y(c){let e,n,t,s;const r=[X,T],a=[];function u(i,o){return i[0]?0:1}return e=u(c),n=a[e]=r[e](c),{c(){n.c(),t=d()},l(i){n.l(i),t=d()},m(i,o){a[e].m(i,o),k(i,t,o),s=!0},p(i,[o]){let l=e;e=u(i),e===l?a[e].p(i,o):(P(),p(a[l],1,1,()=>{a[l]=null}),D(),n=a[e],n?n.p(i,o):(n=a[e]=r[e](i),n.c()),_(n,1),n.m(t.parentNode,t))},i(i){s||(_(n),s=!0)},o(i){p(n),s=!1},d(i){i&&f(t),a[e].d(i)}}}function Z(c,e,n){let t,s;g(c,j,o=>n(4,t=o));const r=N("i18n");g(c,r,o=>n(5,s=o));let a=null;const u=async o=>{console.log(o);const l=K(o.content);if(L((l==null?void 0:l.required_open_webui_version)??"0.0.0",$)){console.log("Version is lower than required"),m.error(s.t("Open WebUI version (v{{OPEN_WEBUI_VERSION}}) is lower than required version (v{{REQUIRED_VERSION}})",{OPEN_WEBUI_VERSION:$,REQUIRED_VERSION:(l==null?void 0:l.required_open_webui_version)??"0.0.0"}));return}await Q(localStorage.token,a.id,{id:o.id,name:o.name,meta:o.meta,content:o.content}).catch(R=>(m.error(R),null))&&(m.success(s.t("Function updated successfully")),C.set(await H(localStorage.token)),M.set(await J(localStorage.token)))};return O(async()=>{console.log("mounted");const o=t.url.searchParams.get("id");o&&(n(0,a=await z(localStorage.token,o).catch(l=>(m.error(l),W("/workspace/functions"),null))),console.log(a))}),[a,r,u,o=>{u(o.detail)}]}class me extends U{constructor(e){super(),B(this,e,Z,Y,V,{})}}export{me as component};
//# sourceMappingURL=15.CoD7HNM9.js.map