agents icon indicating copy to clipboard operation
agents copied to clipboard

message_received event cannot be triggered.

Open Emotibot5 opened this issue 6 months ago • 7 comments

message_received event cannot be triggered.

chat = rtc.ChatManager(ctx.room)

async def answer_from_text(txt: str):
    chat_ctx = assistant.chat_ctx.copy()
    chat_ctx.append(role="user", text=txt)
    stream = llm_plugin.chat(chat_ctx=chat_ctx)
    await assistant.say(stream)

@chat.on("message_received")
def on_chat_received(msg: rtc.ChatMessage):
    if msg.message:
        asyncio.create_task(answer_from_text(msg.message))

Emotibot5 avatar Aug 06 '24 04:08 Emotibot5