重新编译Gradio优化使用体验

This commit is contained in:
binary-husky
2023-10-06 10:32:03 +08:00
parent 93c76e1809
commit 6310b65d70
15 changed files with 122 additions and 67 deletions

View File

@@ -523,7 +523,7 @@ def promote_file_to_downloadzone(file, rename_file=None, chatbot=None):
# 把文件复制过去
if not os.path.exists(new_path): shutil.copyfile(file, new_path)
# 将文件添加到chatbot cookie中避免多用户干扰
if chatbot:
if chatbot is not None:
if 'files_to_promote' in chatbot._cookies: current = chatbot._cookies['files_to_promote']
else: current = []
chatbot._cookies.update({'files_to_promote': [new_path] + current})
@@ -581,7 +581,7 @@ def on_file_uploaded(request: gradio.Request, files, chatbot, txt, txt2, checkbo
# 整理文件集合
moved_files = [fp for fp in glob.glob(f'{target_path_base}/**/*', recursive=True)]
if "底部输入区" in checkboxes:
if "浮动输入区" in checkboxes:
txt, txt2 = "", target_path_base
else:
txt, txt2 = target_path_base, ""