ajoute les api et faire avancer la technolgie avec l'ia
Browse files- index.html +91 -10
- js/ai-core.js +107 -0
- js/api-service.js +140 -0
- script.js +37 -0
index.html
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="fr">
|
| 3 |
<head>
|
|
@@ -319,12 +321,19 @@
|
|
| 319 |
</span>
|
| 320 |
</div>
|
| 321 |
</div>
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
<i data-feather="maximize-2" class="w-5 h-5"></i>
|
| 329 |
</button>
|
| 330 |
<button class="px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2">
|
|
@@ -908,12 +917,84 @@
|
|
| 908 |
</div>
|
| 909 |
</aside>
|
| 910 |
</div>
|
| 911 |
-
|
| 912 |
-
<
|
|
|
|
| 913 |
<script src="components/graph-visualization.js"></script>
|
| 914 |
<script src="components/charts.js"></script>
|
| 915 |
<script src="script.js"></script>
|
| 916 |
<script>feather.replace();</script>
|
| 917 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 918 |
</body>
|
| 919 |
-
</html>
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
<!DOCTYPE html>
|
| 4 |
<html lang="fr">
|
| 5 |
<head>
|
|
|
|
| 321 |
</span>
|
| 322 |
</div>
|
| 323 |
</div>
|
| 324 |
+
<div class="flex items-center gap-4">
|
| 325 |
+
<div class="flex items-center gap-2 px-3 py-1.5 bg-secondary-800 rounded-lg border border-secondary-700">
|
| 326 |
+
<span class="relative flex h-2 w-2">
|
| 327 |
+
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
|
| 328 |
+
<span class="relative inline-flex rounded-full h-2 w-2 bg-green-500"></span>
|
| 329 |
+
</span>
|
| 330 |
+
<span class="text-xs text-gray-400 font-mono">API: ONLINE</span>
|
| 331 |
+
</div>
|
| 332 |
+
<button class="relative p-2 text-gray-400 hover:text-white transition-colors">
|
| 333 |
+
<i data-feather="bell" class="w-5 h-5"></i>
|
| 334 |
+
<span class="absolute top-1 right-1 w-2 h-2 bg-danger-500 rounded-full"></span>
|
| 335 |
+
</button>
|
| 336 |
+
<button class="p-2 text-gray-400 hover:text-white transition-colors">
|
| 337 |
<i data-feather="maximize-2" class="w-5 h-5"></i>
|
| 338 |
</button>
|
| 339 |
<button class="px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2">
|
|
|
|
| 917 |
</div>
|
| 918 |
</aside>
|
| 919 |
</div>
|
| 920 |
+
<!-- AI & API Components -->
|
| 921 |
+
<script src="js/ai-core.js"></script>
|
| 922 |
+
<script src="js/api-service.js"></script>
|
| 923 |
<script src="components/graph-visualization.js"></script>
|
| 924 |
<script src="components/charts.js"></script>
|
| 925 |
<script src="script.js"></script>
|
| 926 |
<script>feather.replace();</script>
|
| 927 |
+
|
| 928 |
+
<!-- AI Cortex Neural Interface -->
|
| 929 |
+
<div id="ai-cortex-overlay" class="fixed inset-0 bg-black/80 backdrop-blur-sm z-50 hidden flex items-center justify-center">
|
| 930 |
+
<div class="glass p-8 rounded-2xl border border-primary-500/30 max-w-2xl w-full mx-4 relative overflow-hidden">
|
| 931 |
+
<button onclick="toggleAICortex()" class="absolute top-4 right-4 text-gray-400 hover:text-white">
|
| 932 |
+
<i data-feather="x" class="w-6 h-6"></i>
|
| 933 |
+
</button>
|
| 934 |
+
|
| 935 |
+
<div class="text-center mb-8">
|
| 936 |
+
<div class="w-20 h-20 mx-auto bg-gradient-to-br from-primary-500 to-purple-600 rounded-full flex items-center justify-center mb-4 relative">
|
| 937 |
+
<i data-feather="cpu" class="w-10 h-10 text-white"></i>
|
| 938 |
+
<div class="absolute inset-0 rounded-full border-2 border-primary-400 animate-ping opacity-25"></div>
|
| 939 |
+
</div>
|
| 940 |
+
<h2 class="text-2xl font-bold text-white">Neural Cortex AI</h2>
|
| 941 |
+
<p class="text-gray-400 mt-2">Deep Learning Fraud Detection Engine</p>
|
| 942 |
+
</div>
|
| 943 |
+
|
| 944 |
+
<div class="space-y-4">
|
| 945 |
+
<div class="bg-secondary-800/50 rounded-xl p-4">
|
| 946 |
+
<div class="flex justify-between items-center mb-2">
|
| 947 |
+
<span class="text-sm text-gray-400">Processing Model</span>
|
| 948 |
+
<span class="text-xs text-primary-400 font-mono">SPECTRE-V4-TRANSFORMER</span>
|
| 949 |
+
</div>
|
| 950 |
+
<div class="w-full bg-secondary-700 rounded-full h-2 mb-2">
|
| 951 |
+
<div class="bg-gradient-to-r from-primary-500 to-purple-500 h-2 rounded-full animate-pulse" style="width: 75%"></div>
|
| 952 |
+
</div>
|
| 953 |
+
<div class="flex justify-between text-xs text-gray-500">
|
| 954 |
+
<span>Pattern Recognition</span>
|
| 955 |
+
<span id="ai-progress">75% Complete</span>
|
| 956 |
+
</div>
|
| 957 |
+
</div>
|
| 958 |
+
|
| 959 |
+
<div class="grid grid-cols-2 gap-4">
|
| 960 |
+
<div class="bg-secondary-800/50 rounded-xl p-4 text-center">
|
| 961 |
+
<p class="text-3xl font-bold text-primary-400" id="ai-confidence">99.7%</p>
|
| 962 |
+
<p class="text-xs text-gray-500">Confidence Score</p>
|
| 963 |
+
</div>
|
| 964 |
+
<div class="bg-secondary-800/50 rounded-xl p-4 text-center">
|
| 965 |
+
<p class="text-3xl font-bold text-purple-400" id="ai-patterns">847</p>
|
| 966 |
+
<p class="text-xs text-gray-500">Patterns Analyzed</p>
|
| 967 |
+
</div>
|
| 968 |
+
</div>
|
| 969 |
+
|
| 970 |
+
<div class="bg-gradient-to-r from-danger-500/10 to-warning-500/10 border border-danger-500/20 rounded-xl p-4">
|
| 971 |
+
<div class="flex items-center gap-2 mb-2">
|
| 972 |
+
<i data-feather="alert-triangle" class="w-4 h-4 text-danger-400"></i>
|
| 973 |
+
<span class="font-medium text-danger-400">AI Anomaly Detection</span>
|
| 974 |
+
</div>
|
| 975 |
+
<p class="text-sm text-gray-300" id="ai-insight">
|
| 976 |
+
Analyzing transaction velocity anomalies and cross-referencing with 50M+ known fraud patterns...
|
| 977 |
+
</p>
|
| 978 |
+
</div>
|
| 979 |
+
</div>
|
| 980 |
+
|
| 981 |
+
<div class="mt-6 flex gap-3">
|
| 982 |
+
<button class="flex-1 py-3 bg-primary-500 hover:bg-primary-600 text-white rounded-lg font-medium transition-all flex items-center justify-center gap-2">
|
| 983 |
+
<i data-feather="play" class="w-4 h-4"></i>
|
| 984 |
+
Run Analysis
|
| 985 |
+
</button>
|
| 986 |
+
<button class="flex-1 py-3 bg-secondary-700 hover:bg-secondary-600 text-white rounded-lg font-medium transition-all flex items-center justify-center gap-2">
|
| 987 |
+
<i data-feather="download" class="w-4 h-4"></i>
|
| 988 |
+
Export Report
|
| 989 |
+
</button>
|
| 990 |
+
</div>
|
| 991 |
+
</div>
|
| 992 |
+
</div>
|
| 993 |
+
|
| 994 |
+
<!-- Floating AI Assistant -->
|
| 995 |
+
<button onclick="toggleAICortex()" class="fixed bottom-6 right-6 w-14 h-14 bg-gradient-to-br from-primary-500 to-purple-600 rounded-full shadow-lg shadow-primary-500/30 flex items-center justify-center hover:scale-110 transition-transform z-40">
|
| 996 |
+
<i data-feather="cpu" class="w-6 h-6 text-white"></i>
|
| 997 |
+
<span class="absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full animate-pulse border-2 border-secondary-900"></span>
|
| 998 |
+
</button>
|
| 999 |
</body>
|
| 1000 |
+
</html>
|
js/ai-core.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* AI Core Module
|
| 3 |
+
* Neural Network Simulation for Financial Fraud Detection
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
class AICore {
|
| 7 |
+
constructor() {
|
| 8 |
+
this.apiEndpoint = '/api/v1/ai';
|
| 9 |
+
this.isProcessing = false;
|
| 10 |
+
this.models = {
|
| 11 |
+
fraudDetection: 'SPECTRE-V4-TRANSFORMER',
|
| 12 |
+
riskScoring: 'RISK-NET-XL',
|
| 13 |
+
nlpAnalysis: 'DOCUMENT-AI-V3'
|
| 14 |
+
};
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Analyze a specific entity using ML models
|
| 19 |
+
*/
|
| 20 |
+
async analyzeEntity(entityId) {
|
| 21 |
+
console.log(`🤖 AI Core: Analyzing entity ${entityId}...`);
|
| 22 |
+
|
| 23 |
+
// Simulate API call delay
|
| 24 |
+
await this.delay(800);
|
| 25 |
+
|
| 26 |
+
// Mock AI analysis result
|
| 27 |
+
return {
|
| 28 |
+
entityId: entityId,
|
| 29 |
+
riskScore: Math.floor(Math.random() * 30) + 70, // High risk simulation
|
| 30 |
+
anomalies: [
|
| 31 |
+
{ type: 'VELOCITY_SPIKE', severity: 'HIGH', description: 'Transaction volume increased by 400% in last 24h' },
|
| 32 |
+
{ type: 'STRUCTURE_ANOMALY', severity: 'MEDIUM', description: 'Nested entity structure detected' },
|
| 33 |
+
{ type: 'GEO_ANOMALY', severity: 'LOW', description: 'Transactions from unexpected jurisdictions' }
|
| 34 |
+
],
|
| 35 |
+
predictedOutcome: 'LIKELY_FRAUDULENT',
|
| 36 |
+
confidence: 0.96,
|
| 37 |
+
recommendations: [
|
| 38 |
+
'Flag for manual review',
|
| 39 |
+
'Cross-reference with PEP databases',
|
| 40 |
+
'Request source of funds documentation'
|
| 41 |
+
]
|
| 42 |
+
};
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Global Risk Analysis
|
| 47 |
+
*/
|
| 48 |
+
async analyzeGlobalRisk() {
|
| 49 |
+
console.log('🌍 AI Core: Running global risk assessment...');
|
| 50 |
+
await this.delay(1200);
|
| 51 |
+
|
| 52 |
+
return {
|
| 53 |
+
globalRiskScore: 78, // Out of 100
|
| 54 |
+
threatLevel: 'ELEVATED',
|
| 55 |
+
activeThreats: 12,
|
| 56 |
+
networkAnomalies: 47,
|
| 57 |
+
predictions: {
|
| 58 |
+
nextWeekRisk: 0.82,
|
| 59 |
+
likelyAttackVector: 'Supply Chain Compromise',
|
| 60 |
+
affectedSectors: ['Banking', 'Crypto', 'Real Estate']
|
| 61 |
+
}
|
| 62 |
+
};
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Natural Language Processing for Report Generation
|
| 67 |
+
*/
|
| 68 |
+
async generateReport(entityId) {
|
| 69 |
+
await this.delay(2000);
|
| 70 |
+
|
| 71 |
+
return {
|
| 72 |
+
summary: "This entity exhibits classic markers of a shell company structure...",
|
| 73 |
+
sentiment: "NEGATIVE",
|
| 74 |
+
keyPhrases: ["shell company", "fund layering", "round-tripping"],
|
| 75 |
+
entitiesMentioned: ["Cayman Islands", "Delaware", "Offshore Account"]
|
| 76 |
+
};
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Pattern Matching against known fraud databases
|
| 81 |
+
*/
|
| 82 |
+
async matchPatterns(entityData) {
|
| 83 |
+
console.log('🔍 AI Core: Matching patterns against fraud database...');
|
| 84 |
+
await this.delay(600);
|
| 85 |
+
|
| 86 |
+
// Simulate matching logic
|
| 87 |
+
const matchScore = Math.random();
|
| 88 |
+
return {
|
| 89 |
+
matchesFound: matchScore > 0.7 ? 5 : 0,
|
| 90 |
+
matchType: matchScore > 0.7 ? 'KNOWN_FRAUD_PATTERN' : 'NO_MATCH',
|
| 91 |
+
similarCases: matchScore > 0.7 ? [
|
| 92 |
+
{ caseId: 'CASE-2024-001', similarity: 0.94 },
|
| 93 |
+
{ caseId: 'CASE-2023-287', similarity: 0.89 }
|
| 94 |
+
] : []
|
| 95 |
+
};
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Utility: Simulate API delay
|
| 100 |
+
*/
|
| 101 |
+
delay(ms) {
|
| 102 |
+
return new Promise(resolve => setTimeout(resolve, ms));
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
// Export for use in other scripts
|
| 107 |
+
window.AICore = AICore;
|
js/api-service.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* API Service Layer
|
| 3 |
+
* Handles all external API communications for Spectre Analytics
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
const API_CONFIG = {
|
| 7 |
+
baseUrl: 'https://api.spectre-analytics.internal/v1',
|
| 8 |
+
timeout: 30000,
|
| 9 |
+
retryAttempts: 3,
|
| 10 |
+
headers: {
|
| 11 |
+
'Content-Type': 'application/json',
|
| 12 |
+
'X-API-Key': 'spectre_secure_key_xxxx',
|
| 13 |
+
'Authorization': 'Bearer <token>'
|
| 14 |
+
}
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
class APIService {
|
| 18 |
+
constructor() {
|
| 19 |
+
this.baseUrl = API_CONFIG.baseUrl;
|
| 20 |
+
this.cache = new Map();
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Generic GET request
|
| 25 |
+
*/
|
| 26 |
+
async get(endpoint, params = {}) {
|
| 27 |
+
const url = new URL(`${this.baseUrl}${endpoint}`);
|
| 28 |
+
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
|
| 29 |
+
|
| 30 |
+
return this.request('GET', url.toString());
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Generic POST request
|
| 35 |
+
*/
|
| 36 |
+
async post(endpoint, data) {
|
| 37 |
+
return this.request('POST', `${this.baseUrl}${endpoint}`, data);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Core request handler with error handling
|
| 42 |
+
*/
|
| 43 |
+
async request(method, url, data = null) {
|
| 44 |
+
const options = {
|
| 45 |
+
method,
|
| 46 |
+
headers: API_CONFIG.headers
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
if (data) {
|
| 50 |
+
options.body = JSON.stringify(data);
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
try {
|
| 54 |
+
// In production, this would be a real fetch call
|
| 55 |
+
// For demo, we simulate the response
|
| 56 |
+
console.log(`📡 API Request: ${method} ${url}`);
|
| 57 |
+
return this.simulateResponse(method, url);
|
| 58 |
+
} catch (error) {
|
| 59 |
+
console.error(`API Error: ${error.message}`);
|
| 60 |
+
return this.handleError(error);
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Simulate API responses for demo purposes
|
| 66 |
+
*/
|
| 67 |
+
simulateResponse(method, url) {
|
| 68 |
+
// Simulate network delay
|
| 69 |
+
const delay = Math.random() * 500 + 200;
|
| 70 |
+
|
| 71 |
+
return new Promise(resolve => {
|
| 72 |
+
setTimeout(() => {
|
| 73 |
+
if (url.includes('/entities')) {
|
| 74 |
+
resolve({ success: true, data: window.entityData || [] });
|
| 75 |
+
} else if (url.includes('/alerts')) {
|
| 76 |
+
resolve({
|
| 77 |
+
success: true,
|
| 78 |
+
data: [
|
| 79 |
+
{ id: 1, type: 'HIGH_RISK', message: 'Suspicious activity detected', timestamp: new Date() },
|
| 80 |
+
{ id: 2, type: 'MEDIUM_RISK', message: 'Pattern anomaly', timestamp: new Date() }
|
| 81 |
+
]
|
| 82 |
+
});
|
| 83 |
+
} else {
|
| 84 |
+
resolve({ success: true, data: { status: 'ok' } });
|
| 85 |
+
}
|
| 86 |
+
}, delay);
|
| 87 |
+
});
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Error handling
|
| 92 |
+
*/
|
| 93 |
+
handleError(error) {
|
| 94 |
+
return {
|
| 95 |
+
success: false,
|
| 96 |
+
error: error.message,
|
| 97 |
+
timestamp: new Date().toISOString()
|
| 98 |
+
};
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Entity Endpoints
|
| 103 |
+
*/
|
| 104 |
+
async getEntities(filters = {}) {
|
| 105 |
+
return this.get('/entities', filters);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
async getEntityById(id) {
|
| 109 |
+
return this.get(`/entities/${id}`);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
async createEntity(data) {
|
| 113 |
+
return this.post('/entities', data);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* Investigation Endpoints
|
| 118 |
+
*/
|
| 119 |
+
async createInvestigation(entityId) {
|
| 120 |
+
return this.post('/investigations', { entityId, timestamp: new Date() });
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
async getInvestigations() {
|
| 124 |
+
return this.get('/investigations');
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Alert Endpoints
|
| 129 |
+
*/
|
| 130 |
+
async getAlerts() {
|
| 131 |
+
return this.get('/alerts');
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
async acknowledgeAlert(alertId) {
|
| 135 |
+
return this.post(`/alerts/${alertId}/acknowledge`, {});
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
// Initialize API service
|
| 140 |
+
window.apiService = new APIService();
|
script.js
CHANGED
|
@@ -1,17 +1,54 @@
|
|
|
|
|
| 1 |
/**
|
| 2 |
* Spectre Analytics Dashboard - Main JavaScript
|
| 3 |
* Financial Fraud Detection & Investigation Platform
|
|
|
|
| 4 |
*/
|
| 5 |
|
| 6 |
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
|
|
|
|
|
|
| 7 |
// Initialize all components
|
| 8 |
initializeDashboard();
|
| 9 |
initializeGraphVisualization();
|
| 10 |
initializeCharts();
|
| 11 |
initializeEventListeners();
|
| 12 |
startRealTimeUpdates();
|
|
|
|
|
|
|
|
|
|
| 13 |
});
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
/**
|
| 16 |
* Dashboard Core Initialization
|
| 17 |
*/
|
|
|
|
| 1 |
+
|
| 2 |
/**
|
| 3 |
* Spectre Analytics Dashboard - Main JavaScript
|
| 4 |
* Financial Fraud Detection & Investigation Platform
|
| 5 |
+
* Enhanced with AI Integration
|
| 6 |
*/
|
| 7 |
|
| 8 |
document.addEventListener('DOMContentLoaded', () => {
|
| 9 |
+
// Initialize AI Core
|
| 10 |
+
window.aiCore = new AICore();
|
| 11 |
+
|
| 12 |
// Initialize all components
|
| 13 |
initializeDashboard();
|
| 14 |
initializeGraphVisualization();
|
| 15 |
initializeCharts();
|
| 16 |
initializeEventListeners();
|
| 17 |
startRealTimeUpdates();
|
| 18 |
+
|
| 19 |
+
// Run initial AI analysis
|
| 20 |
+
runInitialAIAnalysis();
|
| 21 |
});
|
| 22 |
|
| 23 |
+
/**
|
| 24 |
+
* Run Initial AI Analysis
|
| 25 |
+
*/
|
| 26 |
+
async function runInitialAIAnalysis() {
|
| 27 |
+
console.log('🤖 Initializing AI Cortex...');
|
| 28 |
+
try {
|
| 29 |
+
const analysis = await window.aiCore.analyzeGlobalRisk();
|
| 30 |
+
updateDashboardWithAI(analysis);
|
| 31 |
+
} catch (error) {
|
| 32 |
+
console.error('AI Analysis failed:', error);
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Update Dashboard with AI Insights
|
| 38 |
+
*/
|
| 39 |
+
function updateDashboardWithAI(data) {
|
| 40 |
+
// Update AI-driven stats
|
| 41 |
+
if (data.globalRiskScore) {
|
| 42 |
+
const riskElement = document.getElementById('ai-risk-score');
|
| 43 |
+
if (riskElement) riskElement.textContent = data.globalRiskScore;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
// Animate the AI cortex button
|
| 47 |
+
const cortexBtn = document.querySelector('button[onclick="toggleAICortex()"]');
|
| 48 |
+
if (cortexBtn) {
|
| 49 |
+
cortexBtn.classList.add('pulse-green');
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
/**
|
| 53 |
* Dashboard Core Initialization
|
| 54 |
*/
|