diff --git a/assistants/explorer-assistant/assistant/chat.py b/assistants/explorer-assistant/assistant/chat.py index 5cad2525..f2a8d1b7 100644 --- a/assistants/explorer-assistant/assistant/chat.py +++ b/assistants/explorer-assistant/assistant/chat.py @@ -111,10 +111,6 @@ async def on_message_created( - @assistant.events.conversation.message.on_created """ - # ignore messages from this assistant - if message.sender.participant_id == context.assistant.id: - return - # update the participant status to indicate the assistant is thinking async with context.set_status_for_block("thinking..."): config = await assistant_config.get(context.assistant) @@ -413,7 +409,7 @@ async def respond_to_conversation( # check if the completion total tokens exceed the warning threshold if completion_total_tokens > token_count_for_warning: - content = f"{config.high_token_usage_warning.message}\n\n" f"Total tokens used: {completion_total_tokens}" + content = f"{config.high_token_usage_warning.message}\n\nTotal tokens used: {completion_total_tokens}" # send a notice message to the conversation that the token usage is high await context.send_messages( diff --git a/assistants/guided-conversation-assistant/assistant/chat.py b/assistants/guided-conversation-assistant/assistant/chat.py index 6b225a5d..77bacb89 100644 --- a/assistants/guided-conversation-assistant/assistant/chat.py +++ b/assistants/guided-conversation-assistant/assistant/chat.py @@ -118,10 +118,6 @@ async def on_message_created( - @assistant.events.conversation.message.on_created """ - # ignore messages from this assistant - if message.sender.participant_id == context.assistant.id: - return - # update the participant status to indicate the assistant is thinking await context.update_participant_me(UpdateParticipant(status="thinking...")) try: diff --git a/assistants/prospector-assistant/assistant/chat.py b/assistants/prospector-assistant/assistant/chat.py index ec2a0088..a0e5df29 100644 --- a/assistants/prospector-assistant/assistant/chat.py +++ b/assistants/prospector-assistant/assistant/chat.py @@ -156,10 +156,6 @@ async def on_chat_message_created( - @assistant.events.conversation.message.on_created """ - # ignore messages from this assistant - if message.sender.participant_id == context.assistant.id: - return - # update the participant status to indicate the assistant is thinking async with context.set_status_for_block("thinking..."): config = await assistant_config.get(context.assistant) diff --git a/assistants/skill-assistant/assistant/skill_assistant.py b/assistants/skill-assistant/assistant/skill_assistant.py index 52300f4e..aa08e2a0 100644 --- a/assistants/skill-assistant/assistant/skill_assistant.py +++ b/assistants/skill-assistant/assistant/skill_assistant.py @@ -102,10 +102,6 @@ async def on_message_created( - @assistant.events.conversation.message.on_created """ - # ignore messages from this assistant - if message.sender.participant_id == context.assistant.id: - return - # pass the message to the core response logic await respond_to_conversation(context, event, message) @@ -118,10 +114,6 @@ async def on_command_message_created( Handle the event triggered when a new command message is created in the conversation. """ - # ignore messages from this assistant - if message.sender.participant_id == context.assistant.id: - return - # pass the message to the core response logic await respond_to_conversation(context, event, message) diff --git a/examples/python/python-02-simple-chatbot/assistant/chat.py b/examples/python/python-02-simple-chatbot/assistant/chat.py index 6babafac..8f5a76e5 100644 --- a/examples/python/python-02-simple-chatbot/assistant/chat.py +++ b/examples/python/python-02-simple-chatbot/assistant/chat.py @@ -126,9 +126,6 @@ async def on_message_created( - To handle all message types, you can use the root event handler for all message types: - @assistant.events.conversation.message.on_created """ - # ignore messages from this assistant - if message.sender.participant_id == context.assistant.id: - return # update the participant status to indicate the assistant is thinking await context.update_participant_me(UpdateParticipant(status="thinking...")) diff --git a/examples/python/python-03-multimodel-chatbot/assistant/chat.py b/examples/python/python-03-multimodel-chatbot/assistant/chat.py index aad16b97..71099207 100644 --- a/examples/python/python-03-multimodel-chatbot/assistant/chat.py +++ b/examples/python/python-03-multimodel-chatbot/assistant/chat.py @@ -124,9 +124,6 @@ async def on_message_created( - To handle all message types, you can use the root event handler for all message types: - @assistant.events.conversation.message.on_created """ - # ignore messages from this assistant - if message.sender.participant_id == context.assistant.id: - return # update the participant status to indicate the assistant is thinking await context.update_participant_me(UpdateParticipant(status="thinking..."))