From 1ec6892f33f8ac1c8f9635ec153ab361f4d7fb7e Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Fri, 14 Mar 2025 23:41:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BF=9D=E7=A6=81?= =?UTF-8?q?=E8=AF=8D=E5=88=97=E8=A1=A8=E7=94=B1=E4=BA=8E=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=B8=85=E9=99=A4=E5=B9=B2=E5=87=80=E5=AF=BC=E8=87=B4=E5=85=A8?= =?UTF-8?q?=E9=80=89=E4=BA=86=EF=BC=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webui.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/webui.py b/webui.py index bd2e9ee0b..2c99ba8fa 100644 --- a/webui.py +++ b/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],