144 lines
5.1 KiB
PHP
Executable File
144 lines
5.1 KiB
PHP
Executable File
<?php
|
|
header('Content-Type: application/json');
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Access-Control-Allow-Methods: POST, OPTIONS');
|
|
header('Access-Control-Allow-Headers: Content-Type');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
|
http_response_code(200);
|
|
exit;
|
|
}
|
|
|
|
$input = json_decode(file_get_contents('php://input'), true);
|
|
$message = $input['message'] ?? '';
|
|
|
|
if (empty($message)) {
|
|
echo json_encode(['error' => 'Message required']);
|
|
exit;
|
|
}
|
|
|
|
$systemPrompt = <<<PROMPT
|
|
Tu es l'assistant commercial expert WEVAL Consulting, spécialisé dans les solutions technologiques propriétaires.
|
|
|
|
**🎯 ÉCOSYSTÈME WEVAL**
|
|
|
|
**WEVADS** : Infrastructure propriétaire email marketing enterprise
|
|
- Control Hub : Dashboard temps réel (visiteurs, tracking, earnings)
|
|
- Winning Config : Configurations PowerMTA optimales
|
|
- N8N Automation : Workflows automatisés
|
|
- DELIVERADS : Déploiement massif 100+ serveurs/heure
|
|
- Tracking multi-serveurs avec analytics avancés
|
|
|
|
**WEVAL IA** : Intelligence Artificielle Multi-Provider (anciennement HAMID)
|
|
- **11 Providers** : OpenAI, Anthropic (Claude), Google, Mistral, Cerebras, Groq, Cohere, Hugging Face, Replicate, Together AI, Custom
|
|
- **40+ Modules** : Chatbots, prédictions, génération, RPA, OCR, sentiment
|
|
- **Multi-Interface** : Widget Web, CLI Terminal, Code IDE, SSH Server
|
|
- **Multimodal** : Texte, Voix, Image, Vidéo, Documents
|
|
- **Brain Config** : Interface configuration modèles IA
|
|
- Hébergement EU, RGPD compliant
|
|
|
|
**🚀 NOS 3 SOLUTIONS**
|
|
|
|
**WEVAL PULSE** (E-Marketing + Infrastructure)
|
|
2-4 semaines • 📈 ROI 300% • 💰 Devis sur-mesure
|
|
Email automation, 100+ serveurs/h, analytics IA, multi-canal, -80% temps, ISO 27001
|
|
|
|
**WEVAL IA** (Intelligence Artificielle)
|
|
1-3 semaines • 📉 -60% coûts • 💰 Devis sur-mesure
|
|
Chatbots 24/7 (-75% tickets), prédictions (+40%), contenu (10x), RPA (-80%), sentiment, décision
|
|
|
|
**WEVAL ADS** (Infrastructure Cloud)
|
|
3-7 jours • 📉 -70% coûts • 💰 Devis sur-mesure
|
|
100+ serveurs/h, multi-cloud (AWS, Azure, GCP, Huawei, OVH), monitoring IA, auto-scaling, SLA 99.9%, IaC
|
|
|
|
**🎯 PROCESSUS**
|
|
1. Démo/Audit gratuit (2h)
|
|
2. POC personnalisé (3-7j)
|
|
3. Déploiement (1-4 semaines)
|
|
4. Support 24/7 inclus
|
|
|
|
**💡 ARGUMENTS**
|
|
Technologies propriétaires
|
|
Déploiement express (1-4 semaines vs 3-6 mois)
|
|
ROI positif mois 1
|
|
Support francophone 24/7 (<2min)
|
|
+500 clients enterprise
|
|
Sécurité EU, RGPD, ISO 27001
|
|
Garantie 30j satisfait ou remboursé
|
|
|
|
**📞 CONTACT**
|
|
|
|
Sois commercial mais pas pushy. Qualifie le besoin. Insiste sur ROI et références. Propose démo/audit gratuit. Utilise chiffres concrets.
|
|
|
|
**NOTE** : Tu es propulsé par WEVAL IA (11 providers) - tu es un exemple de notre tech !
|
|
PROMPT;
|
|
|
|
$providers = [
|
|
[
|
|
'name' => 'cerebras',
|
|
'url' => 'https://api.cerebras.ai/v1/chat/completions',
|
|
'key' => 'csk-4wrrhkpr568ry9xx49k9mcynwdx483nx53dd62yh5xedfckh',
|
|
'model' => 'llama3.1-8b'
|
|
]
|
|
];
|
|
|
|
$response = null;
|
|
$usedProvider = null;
|
|
|
|
foreach ($providers as $provider) {
|
|
$ch = curl_init($provider['url']);
|
|
|
|
curl_setopt_array($ch, [
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_POST => true,
|
|
CURLOPT_POSTFIELDS => json_encode([
|
|
'model' => $provider['model'],
|
|
'messages' => [
|
|
['role' => 'system', 'content' => $systemPrompt],
|
|
['role' => 'user', 'content' => $message]
|
|
],
|
|
'max_tokens' => 800,
|
|
'temperature' => 0.7
|
|
]),
|
|
CURLOPT_HTTPHEADER => [
|
|
'Content-Type: application/json',
|
|
'Authorization: Bearer ' . $provider['key']
|
|
],
|
|
CURLOPT_TIMEOUT => 15
|
|
]);
|
|
|
|
$result = curl_exec($ch);
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_close($ch);
|
|
|
|
if ($httpCode === 200 && $result) {
|
|
$data = json_decode($result, true);
|
|
if (isset($data['choices'][0]['message']['content'])) {
|
|
$response = $data['choices'][0]['message']['content'];
|
|
$usedProvider = $provider['name'];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($response) {
|
|
// Sauvegarder conversation
|
|
try {
|
|
$pdo = new PDO("pgsql:host=localhost;dbname=adx_system", "admin", "admin123");
|
|
$stmt = $pdo->prepare("INSERT INTO admin.hamid_conversations (session_id, title, content, provider) VALUES (?, ?, ?, ?)");
|
|
$stmt->execute(["public_" . uniqid(), substr($message ?? "", 0, 100), ($message ?? "") . "\n\nAssistant: " . substr($response, 0, 2000), $usedProvider]);
|
|
} catch (Exception $e) {}
|
|
echo json_encode([
|
|
'response' => $response,
|
|
'provider' => $usedProvider,
|
|
'kb_count' => 0
|
|
]);
|
|
} else {
|
|
echo json_encode([
|
|
'response' => "👋 Bonjour ! Je suis propulsé par WEVAL IA (11 providers).\n\n💡 Nos 3 solutions :\n• **Weval Pulse** : E-Marketing + Cloud (2-4 sem, ROI 300%)\n• **Weval IA** : Intelligence artificielle (1-3 sem, -60% coûts)\n• **Weval Ads** : Infrastructure cloud (3-7j, -70% coûts)\n\n🎁 Démo/Audit gratuit !\n📞 +212 6 57 78 52 92 | 📧 commercial@weval-consulting.com",
|
|
'provider' => 'fallback',
|
|
'kb_count' => 0
|
|
]);
|
|
}
|
|
|