Fixed duplicate telegram message update error

This commit is contained in:
2024-08-18 18:19:15 -05:00
parent 3206a11201
commit 5716577b83
+5 -2
View File
@@ -105,14 +105,17 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
toolUseCount = 0
previous_function_name = ""
while len(tool_calls) > 0 and toolUseCount < 50 and processing_status[user_id]["processing"]:
tool_use_results = []
while len(tool_calls) > 0:
tool_call = tool_calls.pop(0)
function_name = tool_call.name
# Update status message
await update_status_message(context, update.effective_chat.id, status_message.message_id, f"Using tool: {function_name}")
if previous_function_name != function_name:
await update_status_message(context, update.effective_chat.id, status_message.message_id, f"Using tool: {function_name}")
previous_function_name = function_name
tool_response = call_tool(tool_call)
tool_use_results.append({"type": "tool_result", "tool_use_id": tool_call.id, "content": json.dumps(tool_response)})