From fd385c433d8ed4067b7a4dbaf33afdcb9675dbae Mon Sep 17 00:00:00 2001 From: Need4Swede Date: Mon, 18 Sep 2023 09:14:33 -0700 Subject: [PATCH] added 'time' to imports 'time' was missing from imports, but used in code. --- chatgpt_core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chatgpt_core.py b/chatgpt_core.py index 76a2c9a..c8d18f0 100644 --- a/chatgpt_core.py +++ b/chatgpt_core.py @@ -1,6 +1,7 @@ # Note that this file was not purpose-made for the reddit history thing, I use it for other conversation scripts I've made and have removed a bunch of functions that aren't relevant. import os +import time import json import openai import pandas as pd @@ -19,7 +20,7 @@ def __init__(self, instructions="You are a helpful assistant.", model="gpt-3.5-t self.filename = filename self.inserts = inserts if inserts else {} self.messages = pd.DataFrame(columns=["actor", "message", "sendable"]) - + if filename: try: with open(filename, 'r') as f: @@ -91,7 +92,7 @@ def generate_response(self, message=None, store_message=True, retries=5): assistant_message = response.choices[0].message['content'] if store_message: self.add_message(assistant_message, actor="assistant") - + if self.filename: self.save_chat()