Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/backend/rtmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,15 @@ async def _process_message_to_client(self, msg: str, client_ws: web.WebSocketRes
})
if "response" in message:
replace = False
for i, output in enumerate(reversed(message["response"]["output"])):
# Get the original list length
output_len = len(message["response"]["output"])

# Iterate in reverse while calculating the correct index
for reverse_index, output in enumerate(reversed(message["response"]["output"])):
if output["type"] == "function_call":
message["response"]["output"].pop(i)
original_index = output_len - 1 - reverse_index # Map reversed index to the original

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output_len ? where is it declared and initialized ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for reviewing my PR. Apologies missed to add the declaration earlier. Its now resolved. and updated my PR.

print("Len of message[response][output]:", output_len, ", output:", message["response"]["output"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmuralikrishna111 Remove print(), I assume that was for debugging

Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug print statement should be removed before merging to production. Consider using proper logging instead of print statements.

Suggested change
print("Len of message[response][output]:", output_len, ", output:", message["response"]["output"])
logger.debug("Len of message[response][output]: %d, output: %s", output_len, message["response"]["output"])

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say to just remove it entirely.

message["response"]["output"].pop(original_index)
replace = True
if replace:
updated_message = json.dumps(message)
Expand Down