UI: Clean up tool calling code

This commit is contained in:
oobabooga 2026-03-12 22:39:38 -03:00
parent 4c7a56c18d
commit 286ae475f6
2 changed files with 18 additions and 25 deletions

View file

@ -1,6 +1,5 @@
import importlib.util
import json
import random
from modules import shared
from modules.logging_colors import logger
@ -49,12 +48,6 @@ def load_tools(selected_names):
return tool_defs, executors
def generate_tool_call_id():
"""Generate a unique tool call ID (e.g. 'call_a1b2c3d4')."""
chars = "abcdefghijklmnopqrstuvwxyz0123456789"
return "call_" + "".join(random.choice(chars) for _ in range(8))
def execute_tool(func_name, arguments, executors):
"""Execute a tool by function name. Returns result as a JSON string."""
fn = executors.get(func_name)