1.3 KiB
1.3 KiB
V50 wevia-chat.php Orchestrator-First FIX
Bug rapporte V48/V49
wevia-chat.php PUBLIC appelait sovereign LLM directement. Hallucinations sur queries data-driven (HCP, vistex, ethica, etc.). User voyait "37 millions / 6720000 hectares" au lieu de 146694 HCP reel.
Fix V50
Wrap wevia-chat.php pour router via wevia-sse-orchestrator.php:
- POST arrive -> curl SSE orchestrator avec Host: weval-consulting.com header
- Parse exec_result events (intents detected + data reelle)
- Si intents match -> JSON response avec provider:orchestrator + data
- Si aucun match -> fallback sovereign LLM direct (preserve comportement v3)
Preuves E2E
- "combien hcp maroc/tunisie" -> 146694 (Ethica vault) au lieu de hallucination
- "status vistex" -> Olga Vanurina contacts + EUR 250-450K (vault)
- "nonreg status" -> 153/153 (100%) reel
- "hello" -> fallback LLM correct
Anti-corruption
- GOLD backup: wevia-chat.php.GOLD-20260417-223513-pre-v50-orchestrator-first
- chattr unlock -> write -> lint verify -> chattr +i relock
- PHP syntax verified (4326 bytes, 108 lines)
Pour next Claude
- V50 wrapper est en place, ne pas remplacer sans raison
- Si evolution: garder pattern orchestrator-first + fallback LLM
- Endpoint wevia-sse-orchestrator.php depends on: wevia-autonomous.php intents
- Test rapide: curl -X POST "/api/wevia-chat.php" -d '{"message":"status vistex"}'