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.
This commit is contained in:
莫尔索
2023-04-14 11:38:29 +08:00
committed by GitHub
parent a3024ca80d
commit 5e6d0b620a

View File

@@ -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:
"""