fix: 修复违禁词列表由于没有清除干净导致全选了(
This commit is contained in:
13
webui.py
13
webui.py
@@ -165,7 +165,10 @@ def format_list_to_str_alias(lst):
|
||||
format_list_to_str([1, "two", 3.0])
|
||||
'[1, "two", 3.0]'
|
||||
"""
|
||||
resarr = lst.split(", ")
|
||||
resarr = []
|
||||
if len(lst) != 0:
|
||||
resarr = lst.split(", ")
|
||||
|
||||
return resarr
|
||||
|
||||
def format_list_to_int(lst):
|
||||
@@ -729,24 +732,24 @@ with gr.Blocks(title="MaimBot配置文件编辑") as app:
|
||||
with gr.Row():
|
||||
ban_msgs_regex_list_display = gr.TextArea(
|
||||
value="\n".join(ban_msgs_regex_list),
|
||||
label="违禁词列表",
|
||||
label="违禁消息正则列表",
|
||||
interactive=False,
|
||||
lines=5
|
||||
)
|
||||
with gr.Row():
|
||||
with gr.Column(scale=3):
|
||||
ban_msgs_regex_new_item_input = gr.Textbox(label="添加新违禁词")
|
||||
ban_msgs_regex_new_item_input = gr.Textbox(label="添加新违禁消息正则")
|
||||
ban_msgs_regex_add_btn = gr.Button("添加", scale=1)
|
||||
|
||||
with gr.Row():
|
||||
with gr.Column(scale=3):
|
||||
ban_msgs_regex_item_to_delete = gr.Dropdown(
|
||||
choices=ban_msgs_regex_list,
|
||||
label="选择要删除的违禁词"
|
||||
label="选择要删除的违禁消息正则"
|
||||
)
|
||||
ban_msgs_regex_delete_btn = gr.Button("删除", scale=1)
|
||||
|
||||
ban_msgs_regex_final_result = gr.Text(label="修改后的违禁词")
|
||||
ban_msgs_regex_final_result = gr.Text(label="修改后的违禁消息正则")
|
||||
ban_msgs_regex_add_btn.click(
|
||||
add_item,
|
||||
inputs=[ban_msgs_regex_new_item_input, ban_msgs_regex_list_state],
|
||||
|
||||
Reference in New Issue
Block a user