Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
feat(frontend): Add AI intelligence API types and methods
rcourtmaneffa33ac0992
diff --git a/frontend-modern/src/api/ai.ts b/frontend-modern/src/api/ai.tsindex 415d3f12d6..d7060f2d64 100644--- a/frontend-modern/src/api/ai.ts+++ b/frontend-modern/src/api/ai.ts@@ -9,6 +9,13 @@ import type {AIStreamEvent,AICostSummary,} from '@/types/ai';+import type {+ PatternsResponse,+ PredictionsResponse,+ CorrelationsResponse,+ ChangesResponse,+ BaselinesResponse,+} from '@/types/aiIntelligence';export class AIAPI {private static baseUrl = '/api';@@ -62,6 +69,40 @@ export class AIAPI {return apiFetch(`${this.baseUrl}/ai/cost/export?days=${days}&format=${format}`, { method: 'GET' });}+ // ============================================+ // AI Intelligence API - Patterns, Predictions, Correlations+ // ============================================++ // Get detected failure patterns+ static async getPatterns(resourceId?: string): Promise<PatternsResponse> {+ const params = resourceId ? `?resource_id=${encodeURIComponent(resourceId)}` : '';+ return apiFetchJSON(`${this.baseUrl}/ai/intelligence/patterns${params}`) as Promise<PatternsResponse>;+ }++ // Get failure predictions+ static async getPredictions(resourceId?: string): Promise<PredictionsResponse> {+ const params = resourceId ? `?resource_id=${encodeURIComponent(resourceId)}` : '';+ return apiFetchJSON(`${this.baseUrl}/ai/intelligence/predictions${params}`) as Promise<PredictionsResponse>;+ }++ // Get resource correlations+ static async getCorrelations(resourceId?: string): Promise<CorrelationsResponse> {+ const params = resourceId ? `?resource_id=${encodeURIComponent(resourceId)}` : '';+ return apiFetchJSON(`${this.baseUrl}/ai/intelligence/correlations${params}`) as Promise<CorrelationsResponse>;+ }++ // Get recent infrastructure changes+ static async getRecentChanges(hours = 24): Promise<ChangesResponse> {+ return apiFetchJSON(`${this.baseUrl}/ai/intelligence/changes?hours=${hours}`) as Promise<ChangesResponse>;+ }++ // Get learned baselines+ static async getBaselines(resourceId?: string): Promise<BaselinesResponse> {+ const params = resourceId ? `?resource_id=${encodeURIComponent(resourceId)}` : '';+ return apiFetchJSON(`${this.baseUrl}/ai/intelligence/baselines${params}`) as Promise<BaselinesResponse>;+ }++// Start OAuth flow for Claude Pro/Max subscription// Returns the authorization URL to redirect the user tostatic async startOAuth(): Promise<{ auth_url: string; state: string }> {diff --git a/frontend-modern/src/types/aiIntelligence.ts b/frontend-modern/src/types/aiIntelligence.tsnew file mode 100644index 0000000000..0b385f8bc9--- /dev/null+++ b/frontend-modern/src/types/aiIntelligence.ts@@ -0,0 +1,88 @@+// AI Intelligence types for patterns, predictions, and correlations++export interface FailurePattern {+ key: string;+ resource_id: string;+ event_type: string;+ occurrences: number;+ average_interval: string;+ average_duration: string;+ last_occurrence: string;+ confidence: number;+}++export interface FailurePrediction {+ resource_id: string;+ event_type: string;+ predicted_at: string;+ days_until: number;+ confidence: number;+ basis: string;+ is_overdue: boolean;+}++export interface ResourceCorrelation {+ source_id: string;+ source_name: string;+ source_type: string;+ target_id: string;+ target_name: string;+ target_type: string;+ event_pattern: string;+ occurrences: number;+ avg_delay: string;+ confidence: number;+ last_seen: string;+ description: string;+}++export interface InfrastructureChange {+ id: string;+ resource_id: string;+ resource_name: string;+ resource_type: string;+ change_type: string;+ before: unknown;+ after: unknown;+ detected_at: string;+ description: string;+}++export interface ResourceBaseline {+ key: string;+ resource_id: string;+ metric: string;+ mean: number;+ std_dev: number;+ min: number;+ max: number;+ samples: number;+ last_update: string;+}++// API response types+export interface PatternsResponse {+ patterns: FailurePattern[];+ count: number;+}++export interface PredictionsResponse {+ predictions: FailurePrediction[];+ count: number;+}++export interface CorrelationsResponse {+ correlations: ResourceCorrelation[];+ count: number;+}++export interface ChangesResponse {+ changes: InfrastructureChange[];+ count: number;+ hours: number;+}++export interface BaselinesResponse {+ baselines: ResourceBaseline[];+ count: number;+}