mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 09:19:51 +00:00
Makes the AI auto-reply bot visible and controllable from the inbox, completes the handoff, and records token spend. Builds on the existing lib/ai engine rather than replacing it. Track A — user-facing - messages.ai_generated flag → small "AI" badge on bot-generated bubbles - "Take over" / "Resume AI" banner per conversation (POST /api/ai/autoreply/[id]) — take-over pauses + assigns to the agent - handoff now assigns to a configurable target (agent or unassigned queue) and writes an internal note summarizing the exchange; the existing on_conversation_assigned trigger notifies the assignee - Settings → AI: "Hand off to" target picker Track B — observability + safety - providers return normalized token usage; logged per run to ai_usage_log (admin-readable) from both auto-reply and draft - account-wide auto-reply rate limit (30/min) on top of the per-conversation cap Migration: 033_ai_reply_polish.sql (messages.ai_generated, ai_configs.handoff_agent_id, conversations.ai_handoff_summary, ai_usage_log). Tests + typecheck + lint pass (607 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| 001_initial_schema.sql | ||
| 002_pipelines_enhancements.sql | ||
| 003_broadcast_recipient_wamid.sql | ||
| 004_contact_delete_set_null.sql | ||
| 005_broadcast_counts_incremental.sql | ||
| 006_automations.sql | ||
| 007_automations_increment_counter.sql | ||
| 008_profile_avatars_storage.sql | ||
| 009_message_actions.sql | ||
| 010_flows.sql | ||
| 011_profile_beta_features.sql | ||
| 012_flows_increment_counter.sql | ||
| 013_whatsapp_config_phone_number_id_unique.sql | ||
| 014_message_templates_meta_integration.sql | ||
| 015_whatsapp_config_registration.sql | ||
| 016_flow_media.sql | ||
| 017_account_sharing.sql | ||
| 018_account_member_rpcs.sql | ||
| 019_invitation_rpcs.sql | ||
| 020_account_sharing_followups.sql | ||
| 021_account_default_currency.sql | ||
| 022_contact_phone_dedup.sql | ||
| 023_chat_media.sql | ||
| 024_member_presence.sql | ||
| 025_filter_contacts_by_tags.sql | ||
| 026_api_keys.sql | ||
| 027_notifications.sql | ||
| 028_webhook_endpoints.sql | ||
| 029_ai_reply.sql | ||
| 030_ai_knowledge.sql | ||
| 031_ai_reply_slot_grant.sql | ||
| 031_fix_profiles_update_rls.sql | ||
| 032_fix_ai_knowledge_membership.sql | ||
| 033_ai_reply_polish.sql | ||