feat(whatsapp): QWEN primary AI backend, Hermes fallback, conversation history, vehicle persistence, demo prompts
- Add QWEN (qwen3.6) as primary AI backend with short system prompt - Hermes remains as fallback with 45s timeout - Increase QWEN timeout to 35s, max_tokens to 4000 - Add conversation history loading from whatsapp_messages (last 4 msgs) - Persist detected vehicle in whatsapp_sessions table - Add 'limpiar chat' / 'nuevo chat' / 'reset' commands to clear history - Fix CSS conflict: rename whatsapp chat-panel classes to wa-chat-panel - Fix JS ID conflicts with chat.js widget (waChatPanel, waChatMessages, etc.) - Improve no-stock response: conversational with alternatives - Split search_query by | for multi-part lookups - Add DEMO_PROMPTS.md and DEMO_PROMPTS_V2.md
This commit is contained in:
@@ -96,12 +96,13 @@ def get_stock_bulk(conn, branch_id=None):
|
||||
|
||||
|
||||
def record_operation(conn, inventory_id, branch_id, operation_type, quantity,
|
||||
reference_id=None, reference_type=None, cost_at_time=None, notes=None):
|
||||
reference_id=None, reference_type=None, cost_at_time=None,
|
||||
notes=None, employee_id=None):
|
||||
"""Record a single inventory operation. Does NOT commit — caller controls transaction.
|
||||
|
||||
Args:
|
||||
quantity: positive for entries (PURCHASE, RETURN, INITIAL), negative for exits (SALE)
|
||||
operation_type: SALE, PURCHASE, RETURN, ADJUST, TRANSFER, INITIAL
|
||||
operation_type: SALE, PURCHASE, RETURN, ADJUST, TRANSFER, INITIAL, QUOTE_RESERVE, QUOTE_RELEASE
|
||||
"""
|
||||
cur = conn.cursor()
|
||||
cur.execute("""
|
||||
@@ -113,7 +114,7 @@ def record_operation(conn, inventory_id, branch_id, operation_type, quantity,
|
||||
""", (
|
||||
inventory_id, branch_id, operation_type, quantity,
|
||||
reference_id, reference_type, cost_at_time,
|
||||
_safe_g('employee_id'),
|
||||
employee_id if employee_id is not None else _safe_g('employee_id'),
|
||||
_safe_g('device_id'),
|
||||
notes
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user