Contents in this wiki are for entertainment purposes only
This is not fiction ∞ this is psience of mind

Simple Python Chat Agency with File Load/Save: Revision history

Jump to navigation Jump to search

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

15 October 2024

  • curprev 02:2302:23, 15 October 2024XenoEngineer talk contribs 3,897 bytes +3,897 Created page with "{{menuSimplePythonChatAgency}} <pre style="margin-left:3em; font:normal 14px terminal;">import os import json class ChatAgent: def __init__(self, name): self.name = name self.messages = [] def add_message(self, message): self.messages.append(message) def save_to_file(self, file_path): with open(file_path, 'w') as file: json.dump(self.__dict__, file) @staticmethod def load_from_file(file_path): wi..."