获取快速移动路径时返回$HOME,本地视图默认移到到home

pull/3/head
zanllp 2023-03-22 22:40:21 +08:00
parent 6728a02ba9
commit 236faf6a9a
8 changed files with 52 additions and 45 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-6683a983.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-ee7d62e9.css">
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-c8336d20.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-84bac848.css">
</head>
<body>
<div id="zanllp_dev_gradio_fe"></div>
@ -41,7 +41,7 @@
iframe.srcdoc = html
iframe.style = `width:100%;height:${window.innerHeight - 128}px`
window.addEventListener('resize', v => {
window.addEventListener('resize', () => {
iframe.style = `width:100%;height:${window.innerHeight - 128}px`
})
wrap.appendChild(iframe)

View File

@ -151,6 +151,7 @@ def baidu_netdisk_api(_: Any, app: FastAPI):
"global_setting": conf,
"cwd": cwd,
"is_win": is_win,
"home": os.environ.get("USERPROFILE") if is_win else os.environ.get("HOME"),
"sd_cwd": os.getcwd(),
}

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-6683a983.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-ee7d62e9.css">
<script type="module" crossorigin src="/baidu_netdisk/fe-static/assets/index-c8336d20.js"></script>
<link rel="stylesheet" href="/baidu_netdisk/fe-static/assets/index-84bac848.css">
</head>
<body>
<div id="zanllp_dev_gradio_fe"></div>

View File

@ -3,11 +3,11 @@ import axios, { isAxiosError } from 'axios'
import type { GlobalSettingPart } from './type'
export const axiosInst = axios.create({
baseURL: '/baidu_netdisk',
})
axiosInst.interceptors.response.use(resp => resp, err => {
if (isAxiosError(err)) {
const errmsg = err.response?.data?.detail ?? "发生了个错误"
const errmsg = err.response?.data?.detail ?? "发生了个错误"
message.error(errmsg)
}
return err
@ -133,6 +133,7 @@ export interface GlobalConf {
global_setting: GlobalSettingPart,
is_win: boolean,
cwd: string,
home: string
sd_cwd: string
}

View File

@ -49,6 +49,9 @@ onMounted(async () => {
})
np.value = new NProgress()
np.value!.configure({ parent: el.value as any })
if (props.target == 'local') {
global.conf?.home && to(global.conf.home)
}
})
const getBasePath = () =>

View File

@ -1,7 +1,7 @@
import type { getGlobalSetting } from '@/api'
import { pick, type ReturnTypeAsync } from '@/util'
export const getAutoCompletedTagList = ({ global_setting,sd_cwd }: ReturnTypeAsync<typeof getGlobalSetting>) => {
export const getAutoCompletedTagList = ({ global_setting, sd_cwd, home }: ReturnTypeAsync<typeof getGlobalSetting>) => {
const picked = pick(global_setting,
'additional_networks_extra_lora_path',
'outdir_grids',
@ -19,7 +19,8 @@ export const getAutoCompletedTagList = ({ global_setting,sd_cwd }: ReturnTypeAsy
...picked,
'embeddings': 'embeddings',
'hypernetworks': 'models/hypernetworks',
'cwd': sd_cwd
'cwd': sd_cwd,
home
}
type Keys = keyof (typeof allTag)
const cnMap: Record<Keys, string> = {
@ -34,7 +35,8 @@ export const getAutoCompletedTagList = ({ global_setting,sd_cwd }: ReturnTypeAsy
hypernetworks: '超网络模型的路径',
outdir_save: '使用“保存”按钮保存图像的目录',
embeddings: 'Embedding的文件夹',
cwd: '工作文件夹'
cwd: '工作文件夹',
home: 'home'
}
return Object.keys(cnMap).map((k) => {
const key = k as Keys