预检查路径是否可用

pull/10/head
zanllp 2023-04-03 21:36:00 +08:00
parent 8fed991b90
commit 33e1611502
19 changed files with 104 additions and 74 deletions

View File

@ -6,8 +6,8 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-ac425f1f.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-9316e415.css">
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-cba93bef.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-bca67b7d.css">
</head>
<body>
<div id="zanllp_dev_gradio_fe"></div>

View File

@ -358,4 +358,14 @@ def baidu_netdisk_api(_: Any, app: FastAPI):
"tick_info": tick_info,
"pending_files": AutoUpload.files
}
class CheckPathExistsReq(BaseModel):
paths: List[str]
@app.post(pre + '/check_path_exists')
async def check_path_exists(req: CheckPathExistsReq):
res = {}
for path in req.paths:
res[path] = os.path.exists(path)
return res

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
.ant-statistic{box-sizing:border-box;margin:0;padding:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:"tnum"}.ant-statistic-title{margin-bottom:4px;color:#00000073;font-size:14px}.ant-statistic-content{color:#000000d9;font-size:24px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.ant-statistic-content-value{display:inline-block;direction:ltr}.ant-statistic-content-prefix,.ant-statistic-content-suffix{display:inline-block}.ant-statistic-content-prefix{margin-right:4px}.ant-statistic-content-suffix{margin-left:4px}.ant-statistic-rtl{direction:rtl}.ant-statistic-rtl .ant-statistic-content-prefix{margin-right:0;margin-left:4px}.ant-statistic-rtl .ant-statistic-content-suffix{margin-right:4px;margin-left:0}.container[data-v-8db10f61]{margin:16px}.container>*[data-v-8db10f61]{margin:8px}
.ant-statistic{box-sizing:border-box;margin:0;padding:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:"tnum"}.ant-statistic-title{margin-bottom:4px;color:#00000073;font-size:14px}.ant-statistic-content{color:#000000d9;font-size:24px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.ant-statistic-content-value{display:inline-block;direction:ltr}.ant-statistic-content-prefix,.ant-statistic-content-suffix{display:inline-block}.ant-statistic-content-prefix{margin-right:4px}.ant-statistic-content-suffix{margin-left:4px}.ant-statistic-rtl{direction:rtl}.ant-statistic-rtl .ant-statistic-content-prefix{margin-right:0;margin-left:4px}.ant-statistic-rtl .ant-statistic-content-suffix{margin-right:4px;margin-left:0}.container[data-v-5df62fcd]{margin:16px}.container>*[data-v-5df62fcd]{margin:8px}

View File

@ -1 +1 @@
import{d as f,j as x,k as C,n as o,p as n,q as l,az as t,aU as i,cs as S,aJ as g,ad as v,aK as y,x as _,aR as I,aA as w,aB as B,A as D}from"./index-ac425f1f.js";const k=c=>(w("data-v-cafd544a"),c=c(),B(),c),L={class:"container"},q=k(()=>t("h1",null," 欢迎 ",-1)),N={key:0,class:"record-restore"},R=k(()=>t("h2",null,"启动",-1)),$=["onClick"],j=k(()=>t("h2",null,"最近",-1)),A=["onClick"],E=f({__name:"emptyStartup",props:{tabIdx:null,paneIdx:null},setup(c){const h=c,r=x(),d={"auto-upload":"自动上传",local:"本地文件",netdisk:"百度云","task-record":"任务记录"},b=(a,p)=>{let s;switch(a){case"auto-upload":case"task-record":case"empty":s={type:a,name:d[a],key:Date.now()+I.uniqueId()};break;case"local":case"netdisk":s={type:a,name:d[a],key:Date.now()+I.uniqueId(),target:a,path:p}}const e=r.tabList[h.tabIdx];e.panes.splice(h.paneIdx,1,s),e.key=s.key},m=C(()=>{var a;return(a=r.lastTabListRecord)==null?void 0:a[1]});return(a,p)=>{var s;return o(),n("div",L,[q,(s=l(m))!=null&&s.tabs?(o(),n("div",N,[t("a",{onClick:p[0]||(p[0]=i(e=>l(r).tabList=l(m).tabs.map(u=>l(S)(u,!0)),["prevent"]))},"还原上次记录")])):g("",!0),t("ul",null,[R,(o(!0),n(v,null,y(Object.keys(d),e=>(o(),n("li",{key:e},[t("a",{onClick:i(u=>b(e),["prevent"])},_(d[e]),9,$)]))),128))]),t("ul",null,[j,(o(!0),n(v,null,y(l(r).recent,e=>(o(),n("li",{key:e.key},[t("a",{onClick:i(u=>b(e.target,e.path),["prevent"])},_(e.target==="local"?"本地":"云盘")+" : "+_(e.path),9,A)]))),128))])])}}});const T=D(E,[["__scopeId","data-v-cafd544a"]]);export{T as default};
import{d as f,j as x,k as C,n as o,p as n,q as l,az as t,aU as i,cs as S,aJ as g,ad as v,aK as y,x as _,aR as I,aA as w,aB as B,A as D}from"./index-cba93bef.js";const k=c=>(w("data-v-cafd544a"),c=c(),B(),c),L={class:"container"},q=k(()=>t("h1",null," 欢迎 ",-1)),N={key:0,class:"record-restore"},R=k(()=>t("h2",null,"启动",-1)),$=["onClick"],j=k(()=>t("h2",null,"最近",-1)),A=["onClick"],E=f({__name:"emptyStartup",props:{tabIdx:null,paneIdx:null},setup(c){const h=c,r=x(),d={"auto-upload":"自动上传",local:"本地文件",netdisk:"百度云","task-record":"任务记录"},b=(a,p)=>{let s;switch(a){case"auto-upload":case"task-record":case"empty":s={type:a,name:d[a],key:Date.now()+I.uniqueId()};break;case"local":case"netdisk":s={type:a,name:d[a],key:Date.now()+I.uniqueId(),target:a,path:p}}const e=r.tabList[h.tabIdx];e.panes.splice(h.paneIdx,1,s),e.key=s.key},m=C(()=>{var a;return(a=r.lastTabListRecord)==null?void 0:a[1]});return(a,p)=>{var s;return o(),n("div",L,[q,(s=l(m))!=null&&s.tabs?(o(),n("div",N,[t("a",{onClick:p[0]||(p[0]=i(e=>l(r).tabList=l(m).tabs.map(u=>l(S)(u,!0)),["prevent"]))},"还原上次记录")])):g("",!0),t("ul",null,[R,(o(!0),n(v,null,y(Object.keys(d),e=>(o(),n("li",{key:e},[t("a",{onClick:i(u=>b(e),["prevent"])},_(d[e]),9,$)]))),128))]),t("ul",null,[j,(o(!0),n(v,null,y(l(r).recent,e=>(o(),n("li",{key:e.key},[t("a",{onClick:i(u=>b(e.target,e.path),["prevent"])},_(e.target==="local"?"本地":"云盘")+" : "+_(e.path),9,A)]))),128))])])}}});const T=D(E,[["__scopeId","data-v-cafd544a"]]);export{T as default};

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import{i as Pe,g as Be,B as Oe,I as P,h as Ie,j as Fe,k as Ne,l as $e,r as ie,E as Ve}from"./index-164dea42.js";import{d as X,u as te,k as q,a as S,c as R,_ as f,e as ce,P as je,r as F,B as Ee,bp as ke,F as Te,C as ne,h as ae,g as De,Z,O as Ge,X as _e,Y as J,o as Le,a3 as Ue,bq as Ze,br as He,a1 as Re,V as Ye,l as qe,U as ee,I as de,ah as Xe,K as Ke}from"./index-ac425f1f.js";const Qe=X({compatConfig:{MODE:3},name:"AInputGroup",props:{prefixCls:String,size:{type:String},compact:{type:Boolean,default:void 0},onMouseenter:{type:Function},onMouseleave:{type:Function},onFocus:{type:Function},onBlur:{type:Function}},setup:function(e,n){var a=n.slots,c=te("input-group",e),p=c.prefixCls,m=c.direction,i=q(function(){var l,d=p.value;return l={},S(l,"".concat(d),!0),S(l,"".concat(d,"-lg"),e.size==="large"),S(l,"".concat(d,"-sm"),e.size==="small"),S(l,"".concat(d,"-compact"),e.compact),S(l,"".concat(d,"-rtl"),m.value==="rtl"),l});return function(){var l;return R("span",{class:i.value,onMouseenter:e.onMouseenter,onMouseleave:e.onMouseleave,onFocus:e.onFocus,onBlur:e.onBlur},[(l=a.default)===null||l===void 0?void 0:l.call(a)])}}});var oe=/iPhone/i,fe=/iPod/i,ge=/iPad/i,le=/\bAndroid(?:.+)Mobile\b/i,me=/Android/i,H=/\bAndroid(?:.+)SD4930UR\b/i,W=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,k=/Windows Phone/i,pe=/\bWindows(?:.+)ARM\b/i,be=/BlackBerry/i,he=/BB10/i,xe=/Opera Mini/i,ye=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ce=/Mobile(?:.+)Firefox\b/i;function r(o,e){return o.test(e)}function ze(o){var e=o||(typeof navigator<"u"?navigator.userAgent:""),n=e.split("[FBAN");if(typeof n[1]<"u"){var a=n,c=ce(a,1);e=c[0]}if(n=e.split("Twitter"),typeof n[1]<"u"){var p=n,m=ce(p,1);e=m[0]}var i={apple:{phone:r(oe,e)&&!r(k,e),ipod:r(fe,e),tablet:!r(oe,e)&&r(ge,e)&&!r(k,e),device:(r(oe,e)||r(fe,e)||r(ge,e))&&!r(k,e)},amazon:{phone:r(H,e),tablet:!r(H,e)&&r(W,e),device:r(H,e)||r(W,e)},android:{phone:!r(k,e)&&r(H,e)||!r(k,e)&&r(le,e),tablet:!r(k,e)&&!r(H,e)&&!r(le,e)&&(r(W,e)||r(me,e)),device:!r(k,e)&&(r(H,e)||r(W,e)||r(le,e)||r(me,e))||r(/\bokhttp\b/i,e)},windows:{phone:r(k,e),tablet:r(pe,e),device:r(k,e)||r(pe,e)},other:{blackberry:r(be,e),blackberry10:r(he,e),opera:r(xe,e),firefox:r(Ce,e),chrome:r(ye,e),device:r(be,e)||r(he,e)||r(xe,e)||r(Ce,e)||r(ye,e)},any:null,phone:null,tablet:null};return i.any=i.apple.device||i.android.device||i.windows.device||i.other.device,i.phone=i.apple.phone||i.android.phone||i.windows.phone,i.tablet=i.apple.tablet||i.android.tablet||i.windows.tablet,i}var We=f(f({},ze()),{},{isMobile:ze});const Je=We;var et=["disabled","loading","addonAfter","suffix"];const tt=X({compatConfig:{MODE:3},name:"AInputSearch",inheritAttrs:!1,props:f(f({},Pe()),{},{inputPrefixCls:String,enterButton:je.any,onSearch:{type:Function}}),setup:function(e,n){var a=n.slots,c=n.attrs,p=n.expose,m=n.emit,i=F(),l=function(){var u;(u=i.value)===null||u===void 0||u.focus()},d=function(){var u;(u=i.value)===null||u===void 0||u.blur()};p({focus:l,blur:d});var y=function(u){m("update:value",u.target.value),u&&u.target&&u.type==="click"&&m("search",u.target.value,u),m("change",u)},b=function(u){var C;document.activeElement===((C=i.value)===null||C===void 0?void 0:C.input)&&u.preventDefault()},A=function(u){var C;m("search",(C=i.value)===null||C===void 0?void 0:C.stateValue,u),Je.tablet||i.value.focus()},I=te("input-search",e),E=I.prefixCls,V=I.getPrefixCls,N=I.direction,w=I.size,s=q(function(){return V("input",e.inputPrefixCls)});return function(){var g,u,C,M,_,B=e.disabled,$=e.loading,L=e.addonAfter,j=L===void 0?(g=a.addonAfter)===null||g===void 0?void 0:g.call(a):L,K=e.suffix,Q=K===void 0?(u=a.suffix)===null||u===void 0?void 0:u.call(a):K,re=Ee(e,et),h=e.enterButton,t=h===void 0?(C=(M=a.enterButton)===null||M===void 0?void 0:M.call(a))!==null&&C!==void 0?C:!1:h;t=t||t==="";var v=typeof t=="boolean"?R(ke,null,null):null,x="".concat(E.value,"-button"),z=Array.isArray(t)?t[0]:t,T,U=z.type&&Be(z.type)&&z.type.__ANT_BUTTON;if(U||z.tagName==="button")T=Te(z,f({onMousedown:b,onClick:A,key:"enterButton"},U?{class:x,size:w.value}:{}),!1);else{var D=v&&!t;T=R(Oe,{class:x,type:t?"primary":void 0,size:w.value,disabled:B,key:"enterButton",onMousedown:b,onClick:A,loading:$,icon:D?v:null},{default:function(){return[D?null:v||t]}})}j&&(T=[T,j]);var G=ne(E.value,(_={},S(_,"".concat(E.value,"-rtl"),N.value==="rtl"),S(_,"".concat(E.value,"-").concat(w.value),!!w.value),S(_,"".concat(E.value,"-with-button"),!!t),_),c.class);return R(P,f(f(f({ref:i},ae(re,["onUpdate:value","onSearch","enterButton"])),c),{},{onPressEnter:A,size:w.value,prefixCls:s.value,addonAfter:T,suffix:Q,onChange:y,class:G,disabled:B}),a)}}});var nt=`
import{i as Pe,g as Be,B as Oe,I as P,h as Ie,j as Fe,k as Ne,l as $e,r as ie,E as Ve}from"./index-633d24a9.js";import{d as X,u as te,k as q,a as S,c as R,_ as f,e as ce,P as je,r as F,B as Ee,bp as ke,F as Te,C as ne,h as ae,g as De,Z,O as Ge,X as _e,Y as J,o as Le,a3 as Ue,bq as Ze,br as He,a1 as Re,V as Ye,l as qe,U as ee,I as de,ah as Xe,K as Ke}from"./index-cba93bef.js";const Qe=X({compatConfig:{MODE:3},name:"AInputGroup",props:{prefixCls:String,size:{type:String},compact:{type:Boolean,default:void 0},onMouseenter:{type:Function},onMouseleave:{type:Function},onFocus:{type:Function},onBlur:{type:Function}},setup:function(e,n){var a=n.slots,c=te("input-group",e),p=c.prefixCls,m=c.direction,i=q(function(){var l,d=p.value;return l={},S(l,"".concat(d),!0),S(l,"".concat(d,"-lg"),e.size==="large"),S(l,"".concat(d,"-sm"),e.size==="small"),S(l,"".concat(d,"-compact"),e.compact),S(l,"".concat(d,"-rtl"),m.value==="rtl"),l});return function(){var l;return R("span",{class:i.value,onMouseenter:e.onMouseenter,onMouseleave:e.onMouseleave,onFocus:e.onFocus,onBlur:e.onBlur},[(l=a.default)===null||l===void 0?void 0:l.call(a)])}}});var oe=/iPhone/i,fe=/iPod/i,ge=/iPad/i,le=/\bAndroid(?:.+)Mobile\b/i,me=/Android/i,H=/\bAndroid(?:.+)SD4930UR\b/i,W=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,k=/Windows Phone/i,pe=/\bWindows(?:.+)ARM\b/i,be=/BlackBerry/i,he=/BB10/i,xe=/Opera Mini/i,ye=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ce=/Mobile(?:.+)Firefox\b/i;function r(o,e){return o.test(e)}function ze(o){var e=o||(typeof navigator<"u"?navigator.userAgent:""),n=e.split("[FBAN");if(typeof n[1]<"u"){var a=n,c=ce(a,1);e=c[0]}if(n=e.split("Twitter"),typeof n[1]<"u"){var p=n,m=ce(p,1);e=m[0]}var i={apple:{phone:r(oe,e)&&!r(k,e),ipod:r(fe,e),tablet:!r(oe,e)&&r(ge,e)&&!r(k,e),device:(r(oe,e)||r(fe,e)||r(ge,e))&&!r(k,e)},amazon:{phone:r(H,e),tablet:!r(H,e)&&r(W,e),device:r(H,e)||r(W,e)},android:{phone:!r(k,e)&&r(H,e)||!r(k,e)&&r(le,e),tablet:!r(k,e)&&!r(H,e)&&!r(le,e)&&(r(W,e)||r(me,e)),device:!r(k,e)&&(r(H,e)||r(W,e)||r(le,e)||r(me,e))||r(/\bokhttp\b/i,e)},windows:{phone:r(k,e),tablet:r(pe,e),device:r(k,e)||r(pe,e)},other:{blackberry:r(be,e),blackberry10:r(he,e),opera:r(xe,e),firefox:r(Ce,e),chrome:r(ye,e),device:r(be,e)||r(he,e)||r(xe,e)||r(Ce,e)||r(ye,e)},any:null,phone:null,tablet:null};return i.any=i.apple.device||i.android.device||i.windows.device||i.other.device,i.phone=i.apple.phone||i.android.phone||i.windows.phone,i.tablet=i.apple.tablet||i.android.tablet||i.windows.tablet,i}var We=f(f({},ze()),{},{isMobile:ze});const Je=We;var et=["disabled","loading","addonAfter","suffix"];const tt=X({compatConfig:{MODE:3},name:"AInputSearch",inheritAttrs:!1,props:f(f({},Pe()),{},{inputPrefixCls:String,enterButton:je.any,onSearch:{type:Function}}),setup:function(e,n){var a=n.slots,c=n.attrs,p=n.expose,m=n.emit,i=F(),l=function(){var u;(u=i.value)===null||u===void 0||u.focus()},d=function(){var u;(u=i.value)===null||u===void 0||u.blur()};p({focus:l,blur:d});var y=function(u){m("update:value",u.target.value),u&&u.target&&u.type==="click"&&m("search",u.target.value,u),m("change",u)},b=function(u){var C;document.activeElement===((C=i.value)===null||C===void 0?void 0:C.input)&&u.preventDefault()},A=function(u){var C;m("search",(C=i.value)===null||C===void 0?void 0:C.stateValue,u),Je.tablet||i.value.focus()},I=te("input-search",e),E=I.prefixCls,V=I.getPrefixCls,N=I.direction,w=I.size,s=q(function(){return V("input",e.inputPrefixCls)});return function(){var g,u,C,M,_,B=e.disabled,$=e.loading,L=e.addonAfter,j=L===void 0?(g=a.addonAfter)===null||g===void 0?void 0:g.call(a):L,K=e.suffix,Q=K===void 0?(u=a.suffix)===null||u===void 0?void 0:u.call(a):K,re=Ee(e,et),h=e.enterButton,t=h===void 0?(C=(M=a.enterButton)===null||M===void 0?void 0:M.call(a))!==null&&C!==void 0?C:!1:h;t=t||t==="";var v=typeof t=="boolean"?R(ke,null,null):null,x="".concat(E.value,"-button"),z=Array.isArray(t)?t[0]:t,T,U=z.type&&Be(z.type)&&z.type.__ANT_BUTTON;if(U||z.tagName==="button")T=Te(z,f({onMousedown:b,onClick:A,key:"enterButton"},U?{class:x,size:w.value}:{}),!1);else{var D=v&&!t;T=R(Oe,{class:x,type:t?"primary":void 0,size:w.value,disabled:B,key:"enterButton",onMousedown:b,onClick:A,loading:$,icon:D?v:null},{default:function(){return[D?null:v||t]}})}j&&(T=[T,j]);var G=ne(E.value,(_={},S(_,"".concat(E.value,"-rtl"),N.value==="rtl"),S(_,"".concat(E.value,"-").concat(w.value),!!w.value),S(_,"".concat(E.value,"-with-button"),!!t),_),c.class);return R(P,f(f(f({ref:i},ae(re,["onUpdate:value","onSearch","enterButton"])),c),{},{onPressEnter:A,size:w.value,prefixCls:s.value,addonAfter:T,suffix:Q,onChange:y,class:G,disabled:B}),a)}}});var nt=`
min-height:0 !important;
max-height:none !important;
height:0 !important;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
vue/dist/index.html vendored
View File

@ -5,8 +5,8 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-ac425f1f.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-9316e415.css">
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-cba93bef.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-bca67b7d.css">
</head>
<body>
<div id="zanllp_dev_gradio_fe"></div>

View File

@ -18,9 +18,10 @@ const queue = reactive(new FetchQueue(-1, 0, 0, 'throw'))
const globalStore = useGlobalStore()
const taskStore = useTaskListStore()
onMounted(async () => {
getGlobalSetting().then((resp) => {
getGlobalSetting().then(async (resp) => {
globalStore.conf = resp
globalStore.autoCompletedDirList = getAutoCompletedTagList(resp).filter(v => v?.dir?.trim?.())
const r = await getAutoCompletedTagList(resp)
globalStore.autoCompletedDirList = r.filter(v => v?.dir?.trim?.())
})
user.value = await queue.pushAction(getUserInfo).res
})
@ -57,43 +58,43 @@ useIntervalFn(() => {
<a-skeleton :loading="!queue.isIdle">
<!--div class="panel">
<template v-if="user">
<div>
已登录用户{{ user.username }}
</div>
<div class="flex-placeholder" /><a-alert :message="tips" type="info" show-icon />
<template v-if="user">
<div>
已登录用户{{ user.username }}
</div>
<div class="flex-placeholder" /><a-alert :message="tips" type="info" show-icon />
<a-form layout="inline">
<a-form-item label="使用缩略图预览">
<a-switch v-model:checked="globalStore.enableThumbnail" />
<a-form layout="inline">
<a-form-item label="使用缩略图预览">
<a-switch v-model:checked="globalStore.enableThumbnail" />
</a-form-item>
<a-form-item>
<a-button @click="onLogoutBtnClick">
<template #icon>
<logout-outlined />
</template>
登出
</a-button>
</a-form-item>
</a-form>
</template>
<a-form layout="inline" v-else>
<a-form-item label="bduss">
<a-input v-model:value="bduss" style="width:300px"></a-input>
</a-form-item>
<a-form-item>
<a-button @click="onLogoutBtnClick">
<a-button @click="onLoginBtnClick" type="primary">
<template #icon>
<logout-outlined />
<login-outlined />
</template>
登出
</a-button>
</a-form-item>
</a-form>
</template>
<a-form layout="inline" v-else>
<a-form-item label="bduss">
<a-input v-model:value="bduss" style="width:300px"></a-input>
</a-form-item>
<a-form-item>
<a-button @click="onLoginBtnClick" type="primary">
<template #icon>
<login-outlined />
</template>
登录
</a-button>
</a-form-item>
</a-form>
</div-->
<split-view-tab/>
</div-->
<split-view-tab />
</a-skeleton>
</template>
<style scoped lang="scss">
@ -105,7 +106,7 @@ useIntervalFn(() => {
padding: 8px;
margin: 16px;
border-radius: 8px;
background: var( --xdt-primary-background);
background: var(--xdt-primary-background);
display: flex;
justify-content: space-between;

View File

@ -142,6 +142,11 @@ export const getGlobalSetting = async () => {
return resp.data as GlobalConf
}
export const checkPathExists = async (paths: string[]) => {
const resp = await axiosInst.post('/check_path_exists',{ paths })
return resp.data as Record<string, boolean>
}
export const cancelTask = async (id: string) => {
const resp = await axiosInst.post(`/task/${id}/cancel`)

View File

@ -1,8 +1,9 @@
<script setup lang="ts">
import { computed, reactive, ref, watchEffect } from 'vue'
import { computed, onMounted, reactive, ref, watchEffect } from 'vue'
import { autoUploadOutput, type UploadTaskSummary } from '@/api/index'
import { delay, Task } from 'vue3-ts-util'
import { useGlobalStore } from '@/store/useGlobalStore'
import { onBeforeUnmount } from 'vue'
const emit = defineEmits<{ (e: 'runningChange', v: boolean): void }>()
const global = useGlobalStore()
@ -16,6 +17,10 @@ const completedFiles = computed(() => taskLogList.value.reduce((p, c) => p + c.n
const failededFiles = computed(() => taskLogList.value.reduce((p, c) => p + c.n_failed_files, 0))
// const allFiles = computed(() => taskLogList.value.reduce((p, c) => p + c.n_files, 0) + pendingFiles.value.length)
onBeforeUnmount(() => {
task.value?.clearTask()
})
const runPollTask = () => {
return Task.run({
action: async () => {

View File

@ -1,5 +1,6 @@
import type { GlobalConf, UploadTaskSummary } from '@/api'
import type { getAutoCompletedTagList } from '@/taskRecord/autoComplete'
import type { ReturnTypeAsync } from '@/util'
import { uniqueId } from 'lodash'
import { defineStore } from 'pinia'
import { reactive, ref } from 'vue'
@ -28,7 +29,7 @@ export interface Tab extends UniqueId {
export const useGlobalStore = defineStore('useGlobalStore', () => {
const conf = ref<GlobalConf>()
const autoCompletedDirList = ref([] as ReturnType<typeof getAutoCompletedTagList>)
const autoCompletedDirList = ref([] as ReturnTypeAsync<typeof getAutoCompletedTagList>)
const enableThumbnail = ref(true)
const stackViewSplit = ref(50)
const autoUploadRecvDir = ref('/')

View File

@ -1,8 +1,13 @@
import type { getGlobalSetting } from '@/api'
import { checkPathExists, type getGlobalSetting } from '@/api'
import { pick, type ReturnTypeAsync } from '@/util'
export const getAutoCompletedTagList = ({ global_setting, sd_cwd, home }: ReturnTypeAsync<typeof getGlobalSetting>) => {
const picked = pick(global_setting,
export const getAutoCompletedTagList = async ({
global_setting,
sd_cwd,
home
}: ReturnTypeAsync<typeof getGlobalSetting>) => {
const picked = pick(
global_setting,
'additional_networks_extra_lora_path',
'outdir_grids',
'outdir_extras_samples',
@ -15,14 +20,15 @@ export const getAutoCompletedTagList = ({ global_setting, sd_cwd, home }: Return
'outdir_txt2img_samples',
'outdir_save'
)
const allTag = {
const pathMap = {
...picked,
'embeddings': 'embeddings',
'hypernetworks': 'models/hypernetworks',
'cwd': sd_cwd,
embeddings: 'embeddings',
hypernetworks: 'models/hypernetworks',
cwd: sd_cwd,
home
}
type Keys = keyof (typeof allTag)
const exists = await checkPathExists(Object.values(pathMap))
type Keys = keyof typeof pathMap
const cnMap: Record<Keys, string> = {
outdir_txt2img_samples: '文生图的输出目录',
outdir_img2img_samples: '图生图的输出目录',
@ -36,14 +42,16 @@ export const getAutoCompletedTagList = ({ global_setting, sd_cwd, home }: Return
hypernetworks: '超网络模型的路径',
embeddings: 'Embedding的文件夹',
cwd: '工作文件夹',
home: 'home',
home: 'home'
}
return Object.keys(cnMap).map((k) => {
const key = k as Keys
return {
key,
zh: cnMap[key],
dir: allTag[key]
}
})
}
return Object.keys(cnMap)
.filter((k) => exists[pathMap[k as keyof typeof pathMap] as string])
.map((k) => {
const key = k as Keys
return {
key,
zh: cnMap[key],
dir: pathMap[key]
}
})
}