- 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>
52 lines
2.1 KiB
PHP
52 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* BlueprintAI API — Process & architecture document generator
|
|
* POST /api/blueprintai/generate
|
|
*/
|
|
require_once __DIR__ . '/../lib/auth.php';
|
|
require_once __DIR__ . '/../lib/wevia-proxy.php';
|
|
|
|
$user = requireAuth();
|
|
rateLimitCheck($user['id'], 5, 60);
|
|
|
|
$input = json_decode(file_get_contents('php://input'), true);
|
|
$type = $input['type'] ?? 'architecture';
|
|
$domain = $input['domain'] ?? '';
|
|
$erp = $input['erp'] ?? 'SAP';
|
|
$level = $input['level'] ?? 'standard';
|
|
$description = $input['description'] ?? '';
|
|
$methodology = $input['methodology'] ?? 'TOGAF';
|
|
$language = $input['language'] ?? 'fr';
|
|
|
|
if (empty($description)) {
|
|
http_response_code(400);
|
|
echo json_encode(['error' => 'description requis']);
|
|
exit;
|
|
}
|
|
|
|
$typePrompts = [
|
|
'architecture' => "Architecte d'entreprise certifie $methodology. Document d'architecture technique complet: contexte, principes, composants, flux, diagrammes ASCII, decisions, risques.",
|
|
'bpmn' => "Expert BPM/BPMN. Cartographie process complete: swimlanes, activites, gateways, events, flux de donnees. Diagrammes ASCII BPMN.",
|
|
'erp' => "Consultant ERP senior ($erp). Blueprint ERP complet: gap analysis, fit/gap, configuration, customisation, migration, tests, formation.",
|
|
'data' => "Data architect senior. Modele de donnees complet: entites, relations, cardinalites, schemas, dictionnaire de donnees, lineage.",
|
|
'integration' => "Expert integration/ESB. Architecture d'integration: flux, APIs, middleware, patterns (pub/sub, event-driven), monitoring."
|
|
];
|
|
|
|
$systemPrompt = ($typePrompts[$type] ?? $typePrompts['architecture']) . " Domaine: $domain. ERP: $erp. Niveau: $level. Document en markdown avec tableaux. Langue: $language.";
|
|
|
|
$result = weviaGenerate($systemPrompt, $description, ['max_tokens' => 6000, 'timeout' => 180]);
|
|
|
|
if (isset($result['error'])) {
|
|
http_response_code($result['status'] ?? 500);
|
|
echo json_encode(['error' => $result['error']]);
|
|
exit;
|
|
}
|
|
|
|
echo json_encode([
|
|
'type' => $type,
|
|
'content' => $result['content'],
|
|
'format' => 'markdown',
|
|
'model' => $result['model'],
|
|
'usage' => $result['usage']
|
|
]);
|