feat: expose CAD dimensions (mm) in chat agent tools
- search_products now returns dim_x_mm, dim_y_mm, dim_z_mm from cad_files.mesh_attributes->'dimensions_mm' - query_database tool description updated with cad_files schema including mesh_attributes->'dimensions_mm' path - AI can now answer "what's the biggest product?" using real dimensions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -219,7 +219,7 @@ TOOLS = [
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "query_database",
|
||||
"description": "Execute a read-only SQL SELECT query against the database. Key columns: products(id, name, pim_id, category_key, cad_file_id, is_active), orders(id, order_number, status, tenant_id), order_lines(id, order_id, product_id, render_status, material_override, render_overrides). Use :tenant_id parameter for tenant filtering. Category is 'category_key' not 'category'.",
|
||||
"description": "Execute a read-only SQL SELECT query against the database. Key tables/columns: products(id, name, pim_id, category_key, cad_file_id, is_active, tenant_id), orders(id, order_number, status, tenant_id), order_lines(id, order_id, product_id, render_status, material_override, render_overrides), cad_files(id, mesh_attributes->'dimensions_mm' with {x,y,z} in mm, parsed_objects, processing_status). To get product dimensions: JOIN cad_files cf ON cf.id = p.cad_file_id and use cf.mesh_attributes->'dimensions_mm'. Use :tenant_id parameter for tenant filtering. Category is 'category_key' not 'category'.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -327,7 +327,10 @@ async def _tool_search_products(db: AsyncSession, tenant_id: str, query: str = "
|
||||
sql = """
|
||||
SELECT p.id, p.name, p.pim_id, p.category_key, p.baureihe,
|
||||
p.cad_file_id IS NOT NULL AS has_step,
|
||||
cf.processing_status
|
||||
cf.processing_status,
|
||||
cf.mesh_attributes->'dimensions_mm'->>'x' AS dim_x_mm,
|
||||
cf.mesh_attributes->'dimensions_mm'->>'y' AS dim_y_mm,
|
||||
cf.mesh_attributes->'dimensions_mm'->>'z' AS dim_z_mm
|
||||
FROM products p
|
||||
LEFT JOIN cad_files cf ON cf.id = p.cad_file_id
|
||||
WHERE p.tenant_id = :tenant_id
|
||||
|
||||
Reference in New Issue
Block a user