From 53b169804d40a305a4cb094ac9b75387d19af290 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:42:43 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Model=20:=20github=20api?= =?UTF-8?q?=E3=81=AE=E3=82=A2=E3=82=AF=E3=82=BB=E3=82=B9=E5=88=B6=E9=99=90?= =?UTF-8?q?=E3=81=AB=E3=82=88=E3=82=8B=E8=B5=B7=E5=8B=95=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/model.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src-python/model.py b/src-python/model.py index 4ba9566d..82c1d9c7 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -9,6 +9,7 @@ from queue import Queue from threading import Thread from requests import get as requests_get from typing import Callable +from packaging.version import parse from flashtext import KeywordProcessor from pykakasi import kakasi @@ -322,9 +323,13 @@ class Model: # check update update_flag = False response = requests_get(config.GITHUB_URL) - new_version = response.json()["name"] - if new_version != config.VERSION: - update_flag = True + json_data = response.json() + version = json_data.get("name", None) + if isinstance(version, str): + new_version = parse(version) + current_version = parse(config.VERSION) + if new_version > current_version: + update_flag = True return update_flag @staticmethod