acheong08/ChatGPT

[Bug]: wrong begavior in async version

vgdh opened this issue · 0 comments

vgdh commented

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

got only the part of answer, till the first quote char.
the error is in the code:

# DO NOT REMOVE THIS
line = line.replace('\\"', '"')
line = line.replace("\\'", "'")
line = line.replace("\\\\", "\\")

when i deleted it, i got the whole version of the answer

code example, for reproduce:

from revChatGPT.V1 import AsyncChatbot
import asyncio


async def amain():
    chatbot = AsyncChatbot(config={
        "access_token": "key"
    })

    gpt_q = f"There is a sentence 'bla bla' "
    gpt_q += f"can I write it that way: 'bugaga'\n"
    gpt_q += f"Does it have any errors?"

    response = ""
    gen = chatbot.ask(gpt_q)

    async for data in gen:
        response = data["message"]
    print(response)
    
asyncio.run(amain())

Steps to reproduce the problem

run the code

What should have happened?

get my answer

Version where the problem happens

6.1.3

What Python version are you running this with?

3.11

What is your operating system ?

No response

Command Line Arguments

none

Console logs

none

Additional information

No response