mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-27 18:38:58 +03:00
Don't require object type for parameter in categorized names tool
This commit is contained in:
+4
-16
@@ -542,9 +542,7 @@ async def execute_tool(
|
||||
|
||||
if tool_name == "get_categorized_object_names":
|
||||
return JSONResponse(
|
||||
content=_execute_get_categorized_object_names(
|
||||
request, arguments, allowed_cameras
|
||||
)
|
||||
content=_execute_get_categorized_object_names(request, allowed_cameras)
|
||||
)
|
||||
|
||||
if tool_name == "find_similar_objects":
|
||||
@@ -727,22 +725,14 @@ async def _execute_set_camera_state(
|
||||
|
||||
def _execute_get_categorized_object_names(
|
||||
request: Request,
|
||||
arguments: dict[str, Any],
|
||||
allowed_cameras: list[str],
|
||||
) -> dict[str, Any]:
|
||||
object_type = arguments.get("object_type") or None
|
||||
names = get_categorized_object_names(
|
||||
request.app.frigate_config, allowed_cameras, object_type
|
||||
)
|
||||
names = get_categorized_object_names(request.app.frigate_config, allowed_cameras)
|
||||
|
||||
if not names:
|
||||
return {
|
||||
"names": {},
|
||||
"message": (
|
||||
f"No names configured for '{object_type}'."
|
||||
if object_type
|
||||
else "No names configured; search by label or semantic_query."
|
||||
),
|
||||
"message": "No names configured; search by label or semantic_query.",
|
||||
}
|
||||
|
||||
return {"names": names}
|
||||
@@ -773,9 +763,7 @@ async def _execute_tool_internal(
|
||||
logger.warning(f"Failed to extract tool result: {e}")
|
||||
return {"error": "Failed to parse tool result"}
|
||||
elif tool_name == "get_categorized_object_names":
|
||||
return _execute_get_categorized_object_names(
|
||||
request, arguments, allowed_cameras
|
||||
)
|
||||
return _execute_get_categorized_object_names(request, allowed_cameras)
|
||||
elif tool_name == "find_similar_objects":
|
||||
return await _execute_find_similar_objects(request, arguments, allowed_cameras)
|
||||
elif tool_name == "set_camera_state":
|
||||
|
||||
Reference in New Issue
Block a user