From 5e6d0b620a582f2f143d91df1921d44c22e648df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E5=B0=94=E7=B4=A2?= Date: Fri, 14 Apr 2023 11:38:29 +0800 Subject: [PATCH] Resolving Unicode encoding issues Solve the problem that Chinese, Japanese, Korean and other non-English languages are all encoded in Unicode when writing ai_settings.yaml configuration. --- scripts/ai_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ai_config.py b/scripts/ai_config.py index 4eb076ef..89a4e07e 100644 --- a/scripts/ai_config.py +++ b/scripts/ai_config.py @@ -70,8 +70,8 @@ class AIConfig: """ config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals} - with open(config_file, "w") as file: - yaml.dump(config, file) + with open(config_file, "w", encoding='utf-8') as file: + yaml.dump(config, file, allow_unicode=True) def construct_full_prompt(self) -> str: """