Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Crash on first message

Clémence Lesnéa8f3f1ee8649
diff --git a/helpers/call_utils.py b/helpers/call_utils.py
index 010477f..bf05825 100644
--- a/helpers/call_utils.py
+++ b/helpers/call_utils.py
@@ -141,7 +141,7 @@ async def handle_play(
"""
if store:
if (
- call.messages[-1].persona == MessagePersonaEnum.ASSISTANT
+ call.messages and call.messages[-1].persona == MessagePersonaEnum.ASSISTANT
): # If the last message was from the assistant, append to it
call.messages[-1].content += f" {text}"
else: # Otherwise, create a new message