fix(WEVIA patron): doctrine 209 EXTERNAL_INFO_REFUSE transformed to AUTO web_search via SearXNG port 8888 - Yacine demande: WEVIA doit etre patronne et chercher pas refuser - elle utilise desormais SearXNG meteo/bourse/news/sport/heure - 3 resultats top retournes avec url - GOLD preserved pre-external-refuse-fix - NR 153/153
This commit is contained in:
@@ -16,7 +16,30 @@ function wevia_opus_intents($msg) {
|
||||
// INTENT: external_info_refuse (V6c - prevents LLM hallucination for external realtime data)
|
||||
/*EXTERNAL_INFO_REFUSE_V6C*/
|
||||
if ($r === null && preg_match("/\b(meteo|m[ée]t[ée]o|weather|temperature|temperatures|humidite|humidit[ée])\b|\b(cours|price|prix)\s+(du|de|of)\s+(bitcoin|btc|eth|ethereum|dollar|euro|action)|\b(bitcoin|btc|eth|sp500|dow jones|cac40|nasdaq)\b\s+(aujourd|today|maintenant|actuel)|\b(news|actualite|actualit[ée]|actu)\s+(aujourd|today|du jour)|\b(resultat|score)\s+(match|foot|basket|tennis|ligue|champion)|\b(heure\s+exacte|heure\s+actuelle|current\s+time)\b/iu", $m)) {
|
||||
$r = "EXTERNAL_INFO_REFUSE: Cette question concerne une donnee externe temps reel (meteo, bourse, news, sport, heure exacte) que WEVIA Master ne peut pas connaitre sans tool dedie. Repondre: 'Je n ai pas acces a cette information en temps reel. Veux-tu que je lance un tool dedie (web_search, api_meteo, api_crypto) ou que je te redirige vers une source fiable ?' - JAMAIS inventer chiffre, temperature, prix, date, nom.";
|
||||
// DOCTRINE 209: Auto-launch web_search via SearXNG port 8888 (Yacine patron demand)
|
||||
// WEVIA ne refuse plus - elle CHERCHE automatiquement via tool dedie
|
||||
$search_query = trim(preg_replace('/\s+/', ' ', $msg));
|
||||
$search_query = substr($search_query, 0, 200);
|
||||
$sx_url = 'http://127.0.0.1:8888/search?q=' . rawurlencode($search_query) . '&format=json';
|
||||
$sx_resp = @file_get_contents($sx_url, false, stream_context_create(['http'=>['timeout'=>8]]));
|
||||
if ($sx_resp) {
|
||||
$sx_data = @json_decode($sx_resp, true);
|
||||
if (!empty($sx_data['results'])) {
|
||||
$top = array_slice($sx_data['results'], 0, 3);
|
||||
$out = "WEB_SEARCH (SearXNG): " . $search_query . "\n\n";
|
||||
foreach ($top as $i => $res) {
|
||||
$title = $res['title'] ?? '?';
|
||||
$content = substr($res['content'] ?? '', 0, 200);
|
||||
$url = $res['url'] ?? '';
|
||||
$out .= ($i+1) . ". " . $title . "\n " . $content . "\n -> " . $url . "\n\n";
|
||||
}
|
||||
$r = $out;
|
||||
} else {
|
||||
$r = "WEB_SEARCH: SearXNG returned no results for: " . $search_query;
|
||||
}
|
||||
} else {
|
||||
$r = "WEB_SEARCH: SearXNG unavailable (port 8888). Query was: " . $search_query;
|
||||
}
|
||||
}
|
||||
|
||||
// INTENT: smart_client_help (V84 - pre-empts office/github to route via v83 orchestrator)
|
||||
|
||||
Reference in New Issue
Block a user