diff --git a/src/askui/chat/api/messages/service.py b/src/askui/chat/api/messages/service.py index 204a3fbd..4923f36b 100644 --- a/src/askui/chat/api/messages/service.py +++ b/src/askui/chat/api/messages/service.py @@ -96,7 +96,7 @@ def save(self, thread_id: ThreadId, messages: list[Message]) -> None: raise ValueError(error_msg) messages = sorted(messages, key=lambda m: m.created_at) thread_path = self._get_thread_path(thread_id) - with thread_path.open("w") as f: + with thread_path.open("w", encoding="utf-8") as f: for msg in messages: f.write(msg.model_dump_json()) f.write("\n")