MCPcopy
hub / github.com/rawandahmad698/PyChatGPT / save_data

Method save_data

src/pychatgpt/main.py:235–249  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

233 return answer, previous_convo, convo_id
234
235 def save_data(self):
236 if self.options.track:
237 try:
238 with open(self.options.chat_log, "a") as f:
239 f.write("\n".join(self.__chat_history) + "\n")
240
241 with open(self.options.id_log, "w") as f:
242 f.write(str(self.previous_convo_id) + "\n")
243 f.write(str(self.conversation_id) + "\n")
244
245 except Exception as ex:
246 self.log(f"{Fore.RED}>> Failed to save chat and ids to chat log and id_log."
247 f"{ex}")
248 finally:
249 self.__chat_history = []
250
251 def cli_chat(self, rep_queue: Queue or None = None):
252 """

Callers 2

askMethod · 0.95
cli_chatMethod · 0.95

Calls 1

logMethod · 0.95

Tested by

no test coverage detected