- StoreForge API: e-commerce site generator via WEVIA - LeadForge API: B2B lead generation + ICP + sequences - ProposalAI API: commercial proposal generator - BlueprintAI API: process/architecture document generator - MailWarm API: email warmup status/start/history - OutreachAI API: cold outreach sequences + subject lines - FormBuilder API: AI form generator - EmailVerify API: email validation (MX, disposable, format) - Auth OTP: replaces email-only auth with OTP/magic-link - SQL migration: auth_otp + auth_attempts tables - WEVIA proxy library: routes all AI calls through server-side Ollama - Auth library: API key validation + rate limiting via Redis Co-authored-by: Yacineutt <Yacineutt@users.noreply.github.com>
43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* StoreForge API — E-commerce site generator
|
|
* POST /api/storeforge/generate
|
|
*/
|
|
require_once __DIR__ . '/../lib/auth.php';
|
|
require_once __DIR__ . '/../lib/wevia-proxy.php';
|
|
|
|
$user = requireAuth();
|
|
rateLimitCheck($user['id'], 10, 60);
|
|
|
|
$input = json_decode(file_get_contents('php://input'), true);
|
|
$storeName = $input['store_name'] ?? '';
|
|
$sector = $input['sector'] ?? 'general';
|
|
$description = $input['description'] ?? '';
|
|
$style = $input['style'] ?? 'modern';
|
|
$features = $input['features'] ?? ['catalog', 'cart', 'checkout'];
|
|
|
|
if (empty($storeName)) {
|
|
http_response_code(400);
|
|
echo json_encode(['error' => 'store_name requis']);
|
|
exit;
|
|
}
|
|
|
|
$systemPrompt = "Tu es un expert e-commerce. Genere le code HTML/CSS/JS complet pour une boutique en ligne professionnelle. Design: $style. Inclus toutes les sections demandees. Code propre, responsive, SEO-ready.";
|
|
|
|
$userPrompt = "Boutique: $storeName\nSecteur: $sector\nDescription: $description\nFonctionnalites: " . implode(', ', $features);
|
|
|
|
$result = weviaGenerate($systemPrompt, $userPrompt, ['max_tokens' => 8000, 'timeout' => 180]);
|
|
|
|
if (isset($result['error'])) {
|
|
http_response_code($result['status'] ?? 500);
|
|
echo json_encode(['error' => $result['error']]);
|
|
exit;
|
|
}
|
|
|
|
echo json_encode([
|
|
'store_name' => $storeName,
|
|
'html' => $result['content'],
|
|
'model' => $result['model'],
|
|
'usage' => $result['usage']
|
|
]);
|