From 41f44d41ff967374d10cb6958ddc8c1219d76b4a Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Mon, 17 Mar 2025 12:36:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=20Python=20=E5=86=85?= =?UTF-8?q?=E5=BB=BA=E7=9A=84=20packaging.version=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E7=89=88=E6=9C=AC=E5=8F=B7=EF=BC=8C=E4=B8=80?= =?UTF-8?q?=E5=8A=B3=E6=B0=B8=E9=80=B8=E8=A7=A3=E5=86=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webui.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webui.py b/webui.py index e9d831bc4..f0966233d 100644 --- a/webui.py +++ b/webui.py @@ -6,6 +6,7 @@ from loguru import logger import shutil import ast import json +from packaging import version is_share = False @@ -13,7 +14,8 @@ debug = True config_data = toml.load("config/bot_config.toml") CONFIG_VERSION = config_data["inner"]["version"] -PARSED_CONFIG_VERSION = float(CONFIG_VERSION[2:]) +PARSED_CONFIG_VERSION = version.parse(CONFIG_VERSION) +HAVE_ONLINE_STATUS_VERSION = version.parse("0.0.9") #============================================== #env环境配置文件读取部分 @@ -1148,7 +1150,7 @@ with gr.Blocks(title="MaimBot配置文件编辑") as app: enable_debug_output = gr.Checkbox(value=config_data['others']['enable_debug_output'], label="是否开启调试输出") with gr.Row(): enable_friend_chat = gr.Checkbox(value=config_data['others']['enable_friend_chat'], label="是否开启好友聊天") - if PARSED_CONFIG_VERSION > 0.8: + if PARSED_CONFIG_VERSION > HAVE_ONLINE_STATUS_VERSION: with gr.Row(): gr.Markdown( """### 远程统计设置\n @@ -1178,7 +1180,7 @@ with gr.Blocks(title="MaimBot配置文件编辑") as app: with gr.Row(): save_other_config_message = gr.Textbox() with gr.Row(): - if PARSED_CONFIG_VERSION <= 0.8: + if PARSED_CONFIG_VERSION <= HAVE_ONLINE_STATUS_VERSION: remote_status = gr.Checkbox(value=False,visible=False) save_other_config_btn.click( save_other_config,