-
Notifications
You must be signed in to change notification settings - Fork 328
Update rtmt.py - pop gives the error when there are two message in the queue #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
80ba6a7
7ec7982
aced8ab
e85ce76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 | ||||||
print("Len of message[response][output]:", output_len, ", output:", message["response"]["output"]) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pmuralikrishna111 Remove print(), I assume that was for debugging There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||||||
|
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.