Files
html/api/wevia-tools-router.php
2026-04-12 22:57:03 +02:00

32 lines
1.9 KiB
PHP

<?php
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
$data = json_decode(file_get_contents('php://input'), true);
$intent = $data['intent'] ?? $_GET['intent'] ?? '';
$query = $data['query'] ?? $_GET['query'] ?? '';
$tools = [
'browse' => ['api' => '/api/browser-use-api.php', 'desc' => 'Navigate web pages autonomously'],
'scan' => ['api' => '/api/strix-scan-api.php', 'desc' => 'Security vulnerability scan'],
'skills' => ['api' => '/api/openclaw-skills-api.php', 'desc' => 'Search 5700+ AI skills'],
'metrics' => ['api' => '/api/prometheus-api.php', 'desc' => 'Server metrics & health'],
'agent' => ['api' => '/api/mastra-agent-api.php', 'desc' => 'Autonomous task execution'],
'workflow' => ['api' => '/api/dify-workflow-api.php', 'desc' => 'Visual AI pipelines'],
'memory' => ['api' => '/api/supermemory-api.php', 'desc' => 'Persistent context memory'],
'test' => ['api' => '/api/evomaster-api.php', 'desc' => 'API test generation'],
'automate' => ['api' => '/api/activepieces-api.php', 'desc' => 'Workflow automation'],
'code' => ['api' => '/api/goose-agent-api.php', 'desc' => 'Agentic code execution'],
'search' => ['api' => '/api/searxng-proxy.php', 'desc' => 'Web search via SearXNG'],
'ethica' => ['api' => '/api/ethica-stats.php', 'desc' => 'Healthcare contacts'],
'crm' => ['api' => '/api/crm-api.php', 'desc' => 'Customer relationship data'],
];
if (empty($intent)) {
echo json_encode(['ok' => true, 'available_tools' => array_keys($tools), 'count' => count($tools), 'usage' => 'POST with intent + query']);
} else if (isset($tools[$intent])) {
$tool = $tools[$intent];
echo json_encode(['ok' => true, 'routed_to' => $tool['api'], 'intent' => $intent, 'desc' => $tool['desc']]);
} else {
echo json_encode(['ok' => false, 'error' => "Unknown intent: $intent", 'available' => array_keys($tools)]);
}