发送和接受路径均支持占位符
parent
0128256784
commit
83cc053232
|
|
@ -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-46aacd62.js"></script>
|
||||
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-4ec91611.css">
|
||||
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-692e9c45.js"></script>
|
||||
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-24411239.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="zanllp_dev_gradio_fe"></div>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import asyncio
|
||||
import datetime
|
||||
import os
|
||||
from typing import List, Dict, Union, Literal
|
||||
from typing import Dict, Literal
|
||||
import uuid
|
||||
import re
|
||||
import subprocess
|
||||
from scripts.bin import bin_file_path
|
||||
|
||||
|
|
@ -74,7 +75,7 @@ class BaiduyunTask:
|
|||
bin_file_path,
|
||||
type,
|
||||
*process_path_arr(str(send_dirs).split(",")),
|
||||
recv_dir,
|
||||
parse_and_replace_time(recv_dir),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
|
@ -96,7 +97,7 @@ baiduyun_task_cache: Dict[str, BaiduyunTask] = {}
|
|||
|
||||
def process_path_arr(path_arr):
|
||||
"""
|
||||
处理路径
|
||||
处理路径,顺便替换模板
|
||||
如果是绝对路径直接返回,
|
||||
如果是相对路径则与当前工作目录拼接返回。
|
||||
"""
|
||||
|
|
@ -107,4 +108,12 @@ def process_path_arr(path_arr):
|
|||
result.append(path)
|
||||
else:
|
||||
result.append(os.path.join(cwd, path))
|
||||
return result
|
||||
return list(map(parse_and_replace_time, result))
|
||||
|
||||
def parse_and_replace_time(s):
|
||||
pattern = r'<#(.+?)#>'
|
||||
matches = re.findall(pattern, s)
|
||||
for match in matches:
|
||||
formatted_time = datetime.datetime.now().strftime(match)
|
||||
s = s.replace(f'<#{match}#>', formatted_time)
|
||||
return s
|
||||
|
|
@ -212,7 +212,7 @@ def get_default_conf():
|
|||
)
|
||||
upload_dir = "/stable-diffusion-upload"
|
||||
return {
|
||||
#"output_dirs": outputs_dirs,
|
||||
"output_dirs": outputs_dirs,
|
||||
"upload_dir": upload_dir,
|
||||
}
|
||||
|
||||
|
|
|
|||
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
|
|
@ -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-46aacd62.js"></script>
|
||||
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-4ec91611.css">
|
||||
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-692e9c45.js"></script>
|
||||
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-24411239.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="zanllp_dev_gradio_fe"></div>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
<!-- eslint-disable no-empty -->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { SplitView } from 'vue3-ts-util'
|
||||
import { copy2clipboard, SplitView } from 'vue3-ts-util'
|
||||
import { useTaskListStore } from './store/useTaskListStore'
|
||||
import LogDetail from './taskList/logDetail.vue'
|
||||
import TaskList from './taskList/taskList.vue'
|
||||
const store = useTaskListStore()
|
||||
const percent = computed(() => !store.splitView.open ? 100 : store.splitView.percent)
|
||||
const copy = (text: string) => {
|
||||
copy2clipboard(text, `复制 "${text}" 成功,粘贴使用"`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -14,10 +17,16 @@ const percent = computed(() => !store.splitView.open ? 100 : store.splitView.per
|
|||
<div class="global-setting">
|
||||
|
||||
<a-form layout="inline">
|
||||
<a-form-item label="轮询间隔" >
|
||||
<a-input-number v-model:value="store.pollInterval" :min="0.5" :disabled="!store.queue.isIdle"/> (s) <sub>越小对网络压力越大</sub>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<a-form-item label="轮询间隔">
|
||||
<a-input-number v-model:value="store.pollInterval" :min="0.5" :disabled="!store.queue.isIdle" /> (s)
|
||||
<sub>越小对网络压力越大</sub>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<div class="actions-bar">
|
||||
<a-button @click="copy('<#%Y-%m-%d#>')">复制日期占位符</a-button>
|
||||
<a-button @click="copy('<#%H-%M-%S#>')">复制日期占位符</a-button>
|
||||
<a-button @click="copy('<#%Y-%m-%d %H-%M-%S#>')">复制日期+时间占位符</a-button>
|
||||
</div>
|
||||
</div>
|
||||
<split-view v-model:percent="percent">
|
||||
<template #left>
|
||||
|
|
@ -37,7 +46,13 @@ const percent = computed(() => !store.splitView.open ? 100 : store.splitView.per
|
|||
margin: 16px;
|
||||
border-radius: 8px;
|
||||
background: #fafafa;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.actions-bar > * {
|
||||
margin-left: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
height: 100vh; // todo 暂时这样,这个不重要
|
||||
width: 95%;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import "antd-vue-volar"
|
|||
import 'ant-design-vue/es/message/style'
|
||||
import 'ant-design-vue/es/notification/style'
|
||||
import 'ant-design-vue/es/modal/style'
|
||||
import '@/util/index.scss'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||
|
|
|
|||
|
|
@ -103,13 +103,14 @@ const addDir2task = (idx: number, dir: string) => {
|
|||
task.send_dirs += ` , ${dir}`
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="wrapper" @click="showDirAutoCompletedIdx = -1">
|
||||
<a-select style="display: none" />
|
||||
<a-button @click="addEmptyTask" block>
|
||||
<template>
|
||||
<a-button @click="addEmptyTask" block style="border-radius: 8px;">
|
||||
<template #icon>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
添加一个任务
|
||||
|
|
@ -129,7 +130,7 @@ const addDir2task = (idx: number, dir: string) => {
|
|||
<a-form layout="vertical" label-align="left">
|
||||
<a-form-item label="发送的文件夹" @click.stop="showDirAutoCompletedIdx = idx">
|
||||
<a-textarea auto-size :disabled="task.running" v-model:value="task.send_dirs"
|
||||
placeholder="发送文件的文件夹,多个文件夹使用逗号或者换行分隔"></a-textarea>
|
||||
placeholder="发送文件的文件夹,多个文件夹使用逗号或者换行分隔。支持使用占位符例如stable-diffusion-webui最常用表示日期的<#%Y-%m-%d#>"></a-textarea>
|
||||
<div v-if="idx === showDirAutoCompletedIdx" class="auto-completed-dirs">
|
||||
<a-tooltip v-for="item, tagIdx in autoCompletedDirList" :key="item.dir" :title="item.dir + ' 点击添加'">
|
||||
<a-tag :visible="!task.send_dirs.includes(item.dir)" :color="colors[tagIdx % colors.length]"
|
||||
|
|
@ -138,7 +139,7 @@ const addDir2task = (idx: number, dir: string) => {
|
|||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="百度云文件夹">
|
||||
<a-input v-model:value="task.recv_dir" :disabled="task.running" placeholder="用于接收的文件夹,可以使用占位符进行动态生成"></a-input>
|
||||
<a-input v-model:value="task.recv_dir" :disabled="task.running" placeholder="用于接收的文件夹,支持使用占位符例如stable-diffusion-webui最常用表示日期的<#%Y-%m-%d#>"></a-input>
|
||||
</a-form-item>
|
||||
<!--a-form-item label="任务类型">
|
||||
<search-select v-model:value="task.type" :disabled="task.running" :options="['upload', 'download']"
|
||||
|
|
@ -160,9 +161,6 @@ const addDir2task = (idx: number, dir: string) => {
|
|||
</div>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.flex-placeholder {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
height: 100%;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
.flex-placeholder {
|
||||
flex: 1;
|
||||
}
|
||||
Loading…
Reference in New Issue