Spaces:
Running
Running
微调界面布局
Browse files- crazy_functional.py +2 -2
- main.py +7 -7
crazy_functional.py
CHANGED
@@ -193,11 +193,11 @@ def get_crazy_functions():
|
|
193 |
|
194 |
from crazy_functions.解析项目源代码 import 解析任意code项目
|
195 |
function_plugins.update({
|
196 |
-
"
|
197 |
"Color": "stop",
|
198 |
"AsButton": False,
|
199 |
"AdvancedArgs": True, # 调用时,唤起高级参数输入区(默认False)
|
200 |
-
"ArgsReminder": "输入时用逗号隔开,
|
201 |
"Function": HotReload(解析任意code项目)
|
202 |
},
|
203 |
})
|
|
|
193 |
|
194 |
from crazy_functions.解析项目源代码 import 解析任意code项目
|
195 |
function_plugins.update({
|
196 |
+
"解析项目源代码(手动指定和筛选源代码文件类型)": {
|
197 |
"Color": "stop",
|
198 |
"AsButton": False,
|
199 |
"AdvancedArgs": True, # 调用时,唤起高级参数输入区(默认False)
|
200 |
+
"ArgsReminder": "输入时用逗号隔开, *代表通配符, 加了^代表不匹配。例如: \"*.c, ^*.cpp, config.toml, ^README.md\"", # 高级参数输入区的显示提示
|
201 |
"Function": HotReload(解析任意code项目)
|
202 |
},
|
203 |
})
|
main.py
CHANGED
@@ -91,8 +91,8 @@ def main():
|
|
91 |
with gr.Row():
|
92 |
dropdown = gr.Dropdown(dropdown_fn_list, value=r"打开插件列表", label="").style(container=False)
|
93 |
with gr.Row():
|
94 |
-
|
95 |
-
|
96 |
with gr.Row():
|
97 |
switchy_bt = gr.Button(r"请先从插件列表中选择", variant="secondary")
|
98 |
with gr.Row():
|
@@ -125,10 +125,10 @@ def main():
|
|
125 |
ret.update({area_input_secondary: gr.update(visible=("底部输入区" in a))})
|
126 |
ret.update({clearBtn: gr.update(visible=("输入清除键" in a))})
|
127 |
ret.update({clearBtn2: gr.update(visible=("输入清除键" in a))})
|
128 |
-
ret.update({
|
129 |
if "底部输入区" in a: ret.update({txt: gr.update(value="")})
|
130 |
return ret
|
131 |
-
checkboxes.select(fn_area_visibility, [checkboxes], [area_basic_fn, area_crazy_fn, area_input_primary, area_input_secondary, txt, txt2, clearBtn, clearBtn2,
|
132 |
# 整理反复出现的控件句柄组合
|
133 |
input_combo = [cookies, max_length_sl, md_dropdown, txt, txt2, top_p, temperature, chatbot, history, system_prompt, plugin_advanced_arg]
|
134 |
output_combo = [cookies, chatbot, history, status]
|
@@ -159,11 +159,11 @@ def main():
|
|
159 |
variant = crazy_fns[k]["Color"] if "Color" in crazy_fns[k] else "secondary"
|
160 |
ret = {switchy_bt: gr.update(value=k, variant=variant)}
|
161 |
if crazy_fns[k].get("AdvancedArgs", False): # 是否唤起高级插件参数区
|
162 |
-
ret.update({
|
163 |
else:
|
164 |
-
ret.update({
|
165 |
return ret
|
166 |
-
dropdown.select(on_dropdown_changed, [dropdown], [switchy_bt,
|
167 |
def on_md_dropdown_changed(k):
|
168 |
return {chatbot: gr.update(label="当前模型:"+k)}
|
169 |
md_dropdown.select(on_md_dropdown_changed, [md_dropdown], [chatbot] )
|
|
|
91 |
with gr.Row():
|
92 |
dropdown = gr.Dropdown(dropdown_fn_list, value=r"打开插件列表", label="").style(container=False)
|
93 |
with gr.Row():
|
94 |
+
plugin_advanced_arg = gr.Textbox(show_label=True, label="高级参数输入区", visible=False,
|
95 |
+
placeholder="这里是特殊函数插件的高级参数输入区").style(container=False)
|
96 |
with gr.Row():
|
97 |
switchy_bt = gr.Button(r"请先从插件列表中选择", variant="secondary")
|
98 |
with gr.Row():
|
|
|
125 |
ret.update({area_input_secondary: gr.update(visible=("底部输入区" in a))})
|
126 |
ret.update({clearBtn: gr.update(visible=("输入清除键" in a))})
|
127 |
ret.update({clearBtn2: gr.update(visible=("输入清除键" in a))})
|
128 |
+
ret.update({plugin_advanced_arg: gr.update(visible=("插件参数区" in a))})
|
129 |
if "底部输入区" in a: ret.update({txt: gr.update(value="")})
|
130 |
return ret
|
131 |
+
checkboxes.select(fn_area_visibility, [checkboxes], [area_basic_fn, area_crazy_fn, area_input_primary, area_input_secondary, txt, txt2, clearBtn, clearBtn2, plugin_advanced_arg] )
|
132 |
# 整理反复出现的控件句柄组合
|
133 |
input_combo = [cookies, max_length_sl, md_dropdown, txt, txt2, top_p, temperature, chatbot, history, system_prompt, plugin_advanced_arg]
|
134 |
output_combo = [cookies, chatbot, history, status]
|
|
|
159 |
variant = crazy_fns[k]["Color"] if "Color" in crazy_fns[k] else "secondary"
|
160 |
ret = {switchy_bt: gr.update(value=k, variant=variant)}
|
161 |
if crazy_fns[k].get("AdvancedArgs", False): # 是否唤起高级插件参数区
|
162 |
+
ret.update({plugin_advanced_arg: gr.update(visible=True, label=f"插件[{k}]的高级参数说明:" + crazy_fns[k].get("ArgsReminder", [f"没有提供高级参数功能说明"]))})
|
163 |
else:
|
164 |
+
ret.update({plugin_advanced_arg: gr.update(visible=False, label=f"插件[{k}]不需要高级参数。")})
|
165 |
return ret
|
166 |
+
dropdown.select(on_dropdown_changed, [dropdown], [switchy_bt, plugin_advanced_arg] )
|
167 |
def on_md_dropdown_changed(k):
|
168 |
return {chatbot: gr.update(label="当前模型:"+k)}
|
169 |
md_dropdown.select(on_md_dropdown_changed, [md_dropdown], [chatbot] )
|