From 4b4836099dec30f9f8108a86bf1c31b20e829d5e Mon Sep 17 00:00:00 2001 From: Keldos Date: Tue, 2 May 2023 21:49:57 +0800 Subject: [PATCH] fix: specify encoding when saving HTML Solve the possible issue of displaying garbled codes in macOS --- crazy_functions/对话历史存档.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crazy_functions/对话历史存档.py b/crazy_functions/对话历史存档.py index bc75875..c638d1b 100644 --- a/crazy_functions/对话历史存档.py +++ b/crazy_functions/对话历史存档.py @@ -13,7 +13,7 @@ def write_chat_to_file(chatbot, history=None, file_name=None): os.makedirs('./gpt_log/', exist_ok=True) with open(f'./gpt_log/{file_name}', 'w', encoding='utf8') as f: from theme import advanced_css - f.write(f'对话历史') + f.write(f'对话历史') for i, contents in enumerate(chatbot): for j, content in enumerate(contents): try: # 这个bug没找到触发条件,暂时先这样顶一下