From 0de869bfb79052ebc45ac33f3fdb22497e8118de Mon Sep 17 00:00:00 2001 From: BaimoQilin Date: Wed, 5 Jun 2024 18:10:48 +0800 Subject: [PATCH 1/3] Fix: Encoding error when using EXE edition --- log_writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/log_writer.py b/log_writer.py index 6b522de..07e88fb 100644 --- a/log_writer.py +++ b/log_writer.py @@ -22,5 +22,5 @@ def logger(text: str): os.makedirs(os.path.dirname(log_filename), exist_ok=True) - with open(log_filename + ".log", "a") as log_file: + with open(log_filename + ".log", "a", encoding='utf-8') as log_file: log_file.write(log_line) \ No newline at end of file From 36879b789e29f0f05d0bea7fbb99c0725e349bab Mon Sep 17 00:00:00 2001 From: BaimoQilin Date: Wed, 5 Jun 2024 18:28:34 +0800 Subject: [PATCH 2/3] Fix: Set encoding to UTF-8 --- .github/workflows/build-linux.yml | 5 +++++ .github/workflows/build-windows.yml | 4 ++++ core.py | 2 ++ ui-v2.py | 3 +++ 4 files changed, 14 insertions(+) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 4fecdaa..27be0d5 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -26,6 +26,11 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt + + - name: Set locale encoding to UTF-8 + run: | + python -c "import locale; locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')" + - name: Build project run: python setup.py build diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 1bcb7f7..95947b0 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -26,6 +26,10 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt + - name: Set locale encoding to UTF-8 + run: | + python -c "import locale; locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')" + - name: Build project run: python setup.py build diff --git a/core.py b/core.py index bd1454c..74e3f45 100644 --- a/core.py +++ b/core.py @@ -2,6 +2,7 @@ import mcschematic import sys import json +import locale from log_writer import logger import config @@ -18,6 +19,7 @@ def initialize(): Returns: None """ + locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') logger(f"Launch. Software version {config.VERSION_NUMBER}, platform {sys.platform}") def askgpt(system_prompt: str, user_prompt: str, model_name: str, disable_json_mode: bool = False, image_url: str = None): diff --git a/ui-v2.py b/ui-v2.py index 876783a..64518c1 100644 --- a/ui-v2.py +++ b/ui-v2.py @@ -157,6 +157,9 @@ def open_config(args: dict): tab_names=["Generate", "Render", "Settings"] ) +# Initialize Core +core.initialize() + # Banner root.add_banner_tool(GitHub("https://github.com/CubeGPT/BuilderGPT")) From 830477d6f4b3cb27722aafe6f65d7ae6d3f296c4 Mon Sep 17 00:00:00 2001 From: BaimoQilin Date: Wed, 5 Jun 2024 18:29:57 +0800 Subject: [PATCH 3/3] Edit: Build on every branch --- .github/workflows/build-linux.yml | 2 -- .github/workflows/build-windows.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 27be0d5..f926f8e 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -2,8 +2,6 @@ name: Linux Builds on: push: - branches: - - main release: types: - created diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 95947b0..0bd4f66 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -2,8 +2,6 @@ name: Windows Builds on: push: - branches: - - main release: types: - created