Fixed duplicate telegram message update error
This commit is contained in:
@@ -105,14 +105,17 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
|
|||||||
|
|
||||||
toolUseCount = 0
|
toolUseCount = 0
|
||||||
|
|
||||||
|
previous_function_name = ""
|
||||||
|
|
||||||
while len(tool_calls) > 0 and toolUseCount < 50 and processing_status[user_id]["processing"]:
|
while len(tool_calls) > 0 and toolUseCount < 50 and processing_status[user_id]["processing"]:
|
||||||
tool_use_results = []
|
tool_use_results = []
|
||||||
while len(tool_calls) > 0:
|
while len(tool_calls) > 0:
|
||||||
tool_call = tool_calls.pop(0)
|
tool_call = tool_calls.pop(0)
|
||||||
function_name = tool_call.name
|
function_name = tool_call.name
|
||||||
|
|
||||||
# Update status message
|
if previous_function_name != function_name:
|
||||||
await update_status_message(context, update.effective_chat.id, status_message.message_id, f"Using tool: {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_response = call_tool(tool_call)
|
||||||
tool_use_results.append({"type": "tool_result", "tool_use_id": tool_call.id, "content": json.dumps(tool_response)})
|
tool_use_results.append({"type": "tool_result", "tool_use_id": tool_call.id, "content": json.dumps(tool_response)})
|
||||||
|
|||||||
Reference in New Issue
Block a user