mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-10 04:41:11 +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":
|
||||
|
||||
@@ -354,16 +354,12 @@ def get_tool_definitions(
|
||||
"description": (
|
||||
"Every name that can be attached as a sub_label, grouped by object "
|
||||
"type: recognized faces, named license plates, classification "
|
||||
"categories, and delivery logos."
|
||||
"categories, and delivery logos. Takes no arguments and always "
|
||||
"returns the complete map."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"object_type": {
|
||||
"type": "string",
|
||||
"description": "Optional object label (e.g. 'person', 'car'). Omit for all.",
|
||||
},
|
||||
},
|
||||
"properties": {},
|
||||
"required": [],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user