feat: media via AI, text via NormalBot only, ai_for_media toggle

- Text/interactive/button messages → NormalBot only, never escalates to AI
- Image/audio/video/document → AiBot.processMedia() if ai_for_media enabled,
  else falls back to category greeting menu
- AiBot.processMedia() uses permission_type context so AI acknowledges uploads
  for perm 3 and redirects others to their menu
- WpWebhook.handleMedia now calls BotRouter so the bot responds to media
- Admin UI: checkbox toggle "Procesar imágenes y archivos con IA" in AI tab
- categoryMenuFallback() extracted in BotRouter as shared helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-28 13:28:56 -05:00
co-authored by Claude Sonnet 4.6
parent 4d7dd0f306
commit 6f799c3829
5 changed files with 95 additions and 10 deletions
+3
View File
@@ -351,6 +351,9 @@ class WpWebhook
self::saveWebhookLog('messages', $ctx['from'], $ctx['name'], $type, $preview);
self::saveConversation($ctx, $preview, $mediaId);
self::forwardToCompany($ctx, $preview, $mediaId);
if (self::$currentCompany !== null) {
BotRouter::route(self::$currentCompany, $ctx, $caption, $type);
}
}
private static function handleLocation(array $msg, array $ctx): void