From 533c63599a9cb27dae18772e7b088c361310a764 Mon Sep 17 00:00:00 2001 From: Daniel Dayley Date: Sun, 30 Apr 2023 10:52:23 -0600 Subject: [PATCH] Added random wait for texts --- persona/skills/chatgpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persona/skills/chatgpt.py b/persona/skills/chatgpt.py index 7e0e1fc..2526288 100644 --- a/persona/skills/chatgpt.py +++ b/persona/skills/chatgpt.py @@ -85,6 +85,6 @@ class PersonaSkill(PersonaBaseSkill) : # Get a completion from OpenAI by sending the last MAX_CHAT_CONTEXT messages to the bot. completion = openai.ChatCompletion.create(model='gpt-3.5-turbo', messages=list(self.chat_logs[message.chat_identifier])) response = completion.choices[0].message.content - return persona.Message(text=response,sender_identifier=message.sender_identifier,chat_identifier=message.chat_identifier,attachments=[],timestamp=datetime.datetime.now(), recipients=[message.sender_identifier], identifier=None, meta={}) + return persona.Message(text=response,sender_identifier=message.sender_identifier,chat_identifier=message.chat_identifier,attachments=[],timestamp=datetime.datetime.now()+datetime.timedelta(seconds=random.randrange(5,15)), recipients=[message.sender_identifier], identifier=None, meta={}) except openai.error.RateLimitError as e : raise persona.PersonaResponseException(str(e))