Spaces:
Runtime error
Runtime error
参数输入bug修复
Browse files- main.py +1 -1
- toolbox.py +2 -2
main.py
CHANGED
@@ -135,7 +135,7 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False, css=advanced_css) as de
|
|
135 |
# 函数插件-固定按钮区
|
136 |
for k in crazy_fns:
|
137 |
if not crazy_fns[k].get("AsButton", True): continue
|
138 |
-
click_handle = crazy_fns[k]["Button"].click(crazy_fns[k]["Function"], [*input_combo, gr.State(PORT)], output_combo)
|
139 |
click_handle.then(on_report_generated, [file_upload, chatbot], [file_upload, chatbot])
|
140 |
cancel_handles.append(click_handle)
|
141 |
# 函数插件-下拉菜单与随变按钮的互动
|
|
|
135 |
# 函数插件-固定按钮区
|
136 |
for k in crazy_fns:
|
137 |
if not crazy_fns[k].get("AsButton", True): continue
|
138 |
+
click_handle = crazy_fns[k]["Button"].click(ArgsGeneralWrapper(crazy_fns[k]["Function"]), [*input_combo, gr.State(PORT)], output_combo)
|
139 |
click_handle.then(on_report_generated, [file_upload, chatbot], [file_upload, chatbot])
|
140 |
cancel_handles.append(click_handle)
|
141 |
# 函数插件-下拉菜单与随变按钮的互动
|
toolbox.py
CHANGED
@@ -6,10 +6,10 @@ def ArgsGeneralWrapper(f):
|
|
6 |
"""
|
7 |
装饰器函数,用于重组输入参数,改变输入参数的顺序与结构。
|
8 |
"""
|
9 |
-
def decorated(txt, txt2,
|
10 |
txt_passon = txt
|
11 |
if txt == "" and txt2 != "": txt_passon = txt2
|
12 |
-
yield from f(txt_passon,
|
13 |
|
14 |
return decorated
|
15 |
|
|
|
6 |
"""
|
7 |
装饰器函数,用于重组输入参数,改变输入参数的顺序与结构。
|
8 |
"""
|
9 |
+
def decorated(txt, txt2, *args, **kwargs):
|
10 |
txt_passon = txt
|
11 |
if txt == "" and txt2 != "": txt_passon = txt2
|
12 |
+
yield from f(txt_passon, *args, **kwargs)
|
13 |
|
14 |
return decorated
|
15 |
|