Implement AIAvatar.on_turn_end that is call at the end of each conversation turn to control exit/not exit.
This is an example to exit chat if the request message contains "bye".
app = AIAvatar()
async def on_turn_end(req, resp):
if "bye" in req:
# Reset histories
app.chat_processor.reset_histories()
# Return True to exit chat
return True
# Set the function to on_turn_end
app.on_turn_end = on_turn_end
Implement
AIAvatar.on_turn_end
that is call at the end of each conversation turn to control exit/not exit.This is an example to exit chat if the request message contains "bye".