Chat now fetches tenant inventory summary (brands, counts, low-stock) and injects it into the AI system prompt so responses prioritize local stock. VIN decoder uses free NHTSA vPIC API to decode 17-char VINs and auto-fills the vehicle selector dropdowns when a catalog match is found. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,8 +23,23 @@ def chat():
|
||||
|
||||
history = body.get("history") or []
|
||||
|
||||
# Call AI
|
||||
ai_response = ai_chat.chat(user_message, history)
|
||||
# Fetch inventory context so the AI knows what this tenant has in stock
|
||||
inventory_context = None
|
||||
tenant_for_context = None
|
||||
try:
|
||||
tenant_for_context = get_tenant_conn(g.tenant_id)
|
||||
inventory_context = ai_chat.get_inventory_context(tenant_for_context, g.branch_id)
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
if tenant_for_context:
|
||||
try:
|
||||
tenant_for_context.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Call AI with inventory context
|
||||
ai_response = ai_chat.chat(user_message, history, inventory_context=inventory_context)
|
||||
|
||||
search_results = []
|
||||
vehicle_match = None
|
||||
|
||||
Reference in New Issue
Block a user