From 85e71f8a71c61a8fd4036de64cdf801bdaaa872b Mon Sep 17 00:00:00 2001 From: qingxu fu <505030475@qq.com> Date: Wed, 5 Apr 2023 00:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=BE=93=E5=85=A5bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- toolbox.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 479acde..f9511b0 100644 --- a/main.py +++ b/main.py @@ -135,7 +135,7 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False, css=advanced_css) as de # 函数插件-固定按钮区 for k in crazy_fns: if not crazy_fns[k].get("AsButton", True): continue - click_handle = crazy_fns[k]["Button"].click(crazy_fns[k]["Function"], [*input_combo, gr.State(PORT)], output_combo) + click_handle = crazy_fns[k]["Button"].click(ArgsGeneralWrapper(crazy_fns[k]["Function"]), [*input_combo, gr.State(PORT)], output_combo) click_handle.then(on_report_generated, [file_upload, chatbot], [file_upload, chatbot]) cancel_handles.append(click_handle) # 函数插件-下拉菜单与随变按钮的互动 diff --git a/toolbox.py b/toolbox.py index 3925e83..011cb44 100644 --- a/toolbox.py +++ b/toolbox.py @@ -6,10 +6,10 @@ def ArgsGeneralWrapper(f): """ 装饰器函数,用于重组输入参数,改变输入参数的顺序与结构。 """ - def decorated(txt, txt2, top_p, temperature, chatbot, history, system_prompt, *args, **kwargs): + def decorated(txt, txt2, *args, **kwargs): txt_passon = txt if txt == "" and txt2 != "": txt_passon = txt2 - yield from f(txt_passon, top_p, temperature, chatbot, history, system_prompt, *args, **kwargs) + yield from f(txt_passon, *args, **kwargs) return decorated