Closed uprg closed 2 months ago
@uprg - Thank you for your patience. Are you still having an issue with this? My initial guess to the cause of the problem is with Emulator which depends Web Chat. Web Chat, at this point, is not setup to work with streaming responses like those generated from something like ChatGPT. What is more, Emulator is using an older version of Web Chat. This needs to be updated to current version, however there is no ETA on that, at the moment.
If you use another client that isn't Web Chat based, does the issue persist there?
If you perform logging in App.py on the if...else
statement, are you certain it is accurately filtering the incoming text between questions and non-questions?
To that end, since it is an echo bot, is it repeating responses because the text in both the original message as well as in the echoed response are virtually the same?
@stevkan Thank you for responding.
Yes the messages are getting correctly identified for if they are a question or if they are not.
The user request message and response message are not same.
The issue isn't resolved but we have stopped further development because of the two times response issue.
@uprg - Ok, I will attempt a repro of the issue using the code above, providing I'm not missing anything.
There isn't enough info here to make a firm determination. However, I question how this is done. Typically, the 'message' implementation would just call 'process_activity'. The the ActivityHandler (the bot) would handle the business logic.
Given:
if status["isQuestion"] == False:
body["text"] = status["text"]
activity = Activity().deserialize(body)
auth_header = req.headers["Authorization"] if "Authorization" in req.headers else ""
await ADAPTER.process_activity(activity, auth_header, BOT.on_turn)
else:
callOpenAI(status["text"])
body["text"] = status["text"]
activity = Activity().deserialize(body)
auth_header = req.headers["Authorization"] if "Authorization" in req.headers else ""
await ADAPTER.process_activity(activity, auth_header, BOT.on_turn)
Whatever 'callOpenAI' does would not stop the EchoBot.on_message_activity from executing.
1) isQuestion == False: EchoBot sends back (echo's) whatever the user sent 2) isQuestion == true: Something happens is 'callOpenAI', then EchoBot sends back whatever the user sent
Check: The indentation on the line with 'callOpenAI'
Version
v4
Describe the bug
Same responses from bot are coming multiple times when deployed with azure bot service
To Reproduce
Clone the echo bot Test it on emulator Deploy it on azure with azure bot service
Expected behavior
Response should only come once.
Additional context
I created a simple bot which can send messages based on a certain input like if you send hi it will send hello. Some messages like hi and hello are send from the bot itself via a if else statement Now some text with prefix question like "question: what is the number system" When bot gets these type of text it send a request to OpenAI APIs for an LLM reponse
Now both these kinds of response one which is normal from the bot and one which comes from openai to bot and then to user as response are coming multiple times.
I though i might have done something in async operations wrong but it also gives two response for both types of messages
Below is some code from app.py
Below is my Bot code