-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenhanced_dashboard.py
More file actions
2095 lines (1832 loc) · 84.7 KB
/
Copy pathenhanced_dashboard.py
File metadata and controls
2095 lines (1832 loc) · 84.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""
Enhanced MeshAdmin Performance Analytics Dashboard with ML Integration
This is an enhanced version of the Performance Dashboard that integrates
advanced machine learning analytics, predictive insights, and intelligent
monitoring capabilities.
Features:
- Real-time performance monitoring (Network Flow Master & Load Balancer Pro)
- Advanced ML-powered analytics and predictions
- Intelligent anomaly detection and alerts
- Capacity planning recommendations
- Interactive visualization with predictive charts
- Correlation analysis between applications
- Automated optimization suggestions
"""
import sys
import os
import time
import json
import logging
import asyncio
from datetime import datetime, timedelta
from typing import Dict, List, Any, Optional
from dataclasses import dataclass, asdict
import threading
from concurrent.futures import ThreadPoolExecutor
# Add project directories to path
current_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
sys.path.insert(0, current_dir)
# Try to import our custom modules
try:
from dashboard import (
PerformanceAnalyticsDashboard,
ApplicationIntegration,
create_analytics_dashboard
)
DASHBOARD_AVAILABLE = True
except ImportError:
print("⚠️ Base dashboard not available")
DASHBOARD_AVAILABLE = False
try:
# Try to import from both locations
sys.path.insert(0, os.path.join(current_dir, 'advanced-analytics'))
from dashboard_integration import (
AdvancedAnalyticsDashboard,
create_advanced_analytics_dashboard
)
ML_INTEGRATION_AVAILABLE = True
except ImportError as e:
print(f"⚠️ ML integration not available: {e}")
ML_INTEGRATION_AVAILABLE = False
try:
from llm_integration import (
PerformanceAnalyticsLLM,
create_llm_integration,
LLMConfig
)
LLM_INTEGRATION_AVAILABLE = True
except ImportError as e:
print(f"⚠️ LLM integration not available: {e}")
LLM_INTEGRATION_AVAILABLE = False
# External dependencies
try:
import flask
from flask import Flask, render_template_string, jsonify, request, Response
from flask_cors import CORS
FLASK_AVAILABLE = True
except ImportError:
print("⚠️ Flask not available for web interface")
FLASK_AVAILABLE = False
try:
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import plotly.utils
PLOTLY_AVAILABLE = True
except ImportError:
print("⚠️ Plotly not available")
PLOTLY_AVAILABLE = False
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger("enhanced-dashboard")
# =============================================================================
# Enhanced Dashboard Configuration
# =============================================================================
@dataclass
class DashboardConfig:
"""Configuration for the Enhanced Dashboard"""
port: int = 8080
host: str = "0.0.0.0"
update_interval: int = 30
ml_enabled: bool = True
auto_refresh: bool = True
alert_thresholds: Dict[str, float] = None
capacity_warning_threshold: float = 0.8
def __post_init__(self):
if self.alert_thresholds is None:
self.alert_thresholds = {
'response_time': 500.0,
'error_rate': 0.05,
'packet_rate': 10000.0,
'connection_count': 1000
}
# =============================================================================
# Enhanced Performance Dashboard
# =============================================================================
class EnhancedPerformanceDashboard:
"""
Enhanced Performance Analytics Dashboard with ML Integration
Combines real-time monitoring with advanced ML analytics for comprehensive
performance insights and predictive capabilities.
"""
def __init__(self, config: DashboardConfig = None):
self.config = config or DashboardConfig()
self.is_running = False
self.update_thread = None
self.executor = ThreadPoolExecutor(max_workers=4)
# Initialize components
self.base_dashboard: Optional[PerformanceAnalyticsDashboard] = None
self.ml_dashboard: Optional[AdvancedAnalyticsDashboard] = None
self.llm_analytics: Optional[Any] = None
self.flask_app: Optional[Flask] = None
# Data storage
self.current_data = {}
self.ml_insights = {}
self.alerts = []
self.suggestions = []
self.predictive_charts = {}
# Initialize base dashboard
if DASHBOARD_AVAILABLE:
dashboard_config = {
'update_interval': self.config.update_interval,
'buffer_size': 1000
}
self.base_dashboard = create_analytics_dashboard(dashboard_config)
# Initialize ML dashboard if enabled
if self.config.ml_enabled and ML_INTEGRATION_AVAILABLE:
ml_config = {
'update_interval': self.config.update_interval,
'prediction_horizon': 3600,
'anomaly_sensitivity': 'medium'
}
self.ml_dashboard = create_advanced_analytics_dashboard(ml_config)
# Initialize LLM integration if available
if LLM_INTEGRATION_AVAILABLE:
llm_config = LLMConfig(
models_path="/Users/cnelson/models",
default_model="llama-3.2-8b" # Updated to match available models
)
self.llm_analytics = create_llm_integration(llm_config)
# Initialize Flask app
if FLASK_AVAILABLE:
self._setup_flask_app()
logger.info("🚀 Enhanced Performance Dashboard initialized")
def start(self) -> None:
"""Start the enhanced dashboard"""
if self.is_running:
return
self.is_running = True
# Start base dashboard
if self.base_dashboard:
self.base_dashboard.start()
# Start ML dashboard
if self.ml_dashboard:
self.ml_dashboard.start()
# Start update thread
if self.config.auto_refresh:
self.update_thread = threading.Thread(target=self._update_loop, daemon=True)
self.update_thread.start()
logger.info("✅ Enhanced Performance Dashboard started")
# Start Flask server if available
if self.flask_app and FLASK_AVAILABLE:
logger.info(f"🌐 Web interface available at http://{self.config.host}:{self.config.port}")
self.flask_app.run(
host=self.config.host,
port=self.config.port,
debug=False,
threaded=True
)
def stop(self) -> None:
"""Stop the enhanced dashboard"""
self.is_running = False
if self.base_dashboard:
self.base_dashboard.stop()
if self.ml_dashboard:
self.ml_dashboard.stop()
self.executor.shutdown(wait=True)
logger.info("🛑 Enhanced Performance Dashboard stopped")
def get_dashboard_data(self) -> Dict[str, Any]:
"""Get comprehensive dashboard data"""
# If no data is available, provide mock data for UI testing
if not self.current_data:
self.current_data = self._generate_mock_data()
if not self.ml_insights:
self.ml_insights = self._generate_mock_ml_insights()
if not self.alerts:
self.alerts = self._generate_mock_alerts()
if not self.suggestions:
self.suggestions = self._generate_mock_suggestions()
data = {
'timestamp': time.time(),
'status': 'running' if self.is_running else 'stopped',
'base_available': self.base_dashboard is not None,
'ml_available': self.ml_dashboard is not None,
'current_data': self.current_data,
'ml_insights': self.ml_insights,
'alerts': self.alerts,
'suggestions': self.suggestions,
'predictive_charts': self.predictive_charts,
'config': asdict(self.config)
}
return data
def force_update(self) -> None:
"""Force an immediate update of all data"""
self._update_data()
# =========================================================================
# Private Methods
# =========================================================================
def _update_loop(self) -> None:
"""Main update loop for real-time data"""
logger.info("🔄 Starting update loop")
while self.is_running:
try:
self._update_data()
time.sleep(self.config.update_interval)
except Exception as e:
logger.error(f"Error in update loop: {e}")
time.sleep(5) # Short delay on error
def _update_data(self) -> None:
"""Update all dashboard data"""
try:
# Update base dashboard data
if self.base_dashboard:
self.current_data = self.base_dashboard.get_current_metrics()
# Feed data to ML dashboard
if self.ml_dashboard:
self.ml_dashboard.process_dashboard_metrics(self.current_data)
# Update ML insights
if self.ml_dashboard:
self.ml_insights = self.ml_dashboard.get_ml_insights()
self.alerts = self.ml_dashboard.get_intelligent_alerts()
self.suggestions = self.ml_dashboard.get_optimization_suggestions()
# Update predictive charts
if PLOTLY_AVAILABLE:
self.predictive_charts = self.ml_dashboard.get_predictive_charts()
logger.debug("📊 Dashboard data updated successfully")
except Exception as e:
logger.error(f"Error updating dashboard data: {e}")
def _setup_flask_app(self) -> None:
"""Setup Flask web application"""
self.flask_app = Flask(__name__)
CORS(self.flask_app)
# Static file serving
@self.flask_app.route('/static/<path:filename>')
def static_files(filename):
import os
from flask import send_from_directory
static_dir = os.path.join(os.path.dirname(__file__), 'static')
return send_from_directory(static_dir, filename)
# Main dashboard route
@self.flask_app.route('/')
def dashboard():
return render_template_string(self._get_dashboard_template())
# API endpoints
@self.flask_app.route('/api/data')
def api_data():
return jsonify(self.get_dashboard_data())
@self.flask_app.route('/api/update', methods=['POST'])
def api_update():
self.force_update()
return jsonify({'status': 'updated'})
@self.flask_app.route('/api/insights')
def api_insights():
return jsonify(self.ml_insights)
@self.flask_app.route('/api/alerts')
def api_alerts():
return jsonify(self.alerts)
@self.flask_app.route('/api/suggestions')
def api_suggestions():
return jsonify(self.suggestions)
@self.flask_app.route('/api/charts')
def api_charts():
return jsonify(self.predictive_charts)
# LLM Model Management APIs
@self.flask_app.route('/api/llm/status')
def api_llm_status():
if self.llm_analytics:
return jsonify(self.llm_analytics.get_model_status())
return jsonify({'available': False, 'message': 'LLM integration not available'})
@self.flask_app.route('/api/llm/models')
def api_llm_models():
if self.llm_analytics:
return jsonify(self.llm_analytics.llm.list_available_models())
return jsonify([])
@self.flask_app.route('/api/llm/load', methods=['POST'])
def api_llm_load():
if not self.llm_analytics:
return jsonify({'success': False, 'message': 'LLM integration not available'})
data = request.get_json()
model_name = data.get('model_name')
# Check if this is an SSE-enabled request
if request.args.get('sse') == 'true':
return jsonify({'success': True, 'streaming': True, 'message': 'Use /api/llm/load_stream for progress updates'})
try:
success = self.llm_analytics.llm.load_model(model_name)
return jsonify({
'success': success,
'message': f'Model {model_name} loaded successfully' if success else f'Failed to load model {model_name}'
})
except Exception as e:
return jsonify({'success': False, 'message': str(e)})
@self.flask_app.route('/api/llm/load_stream')
def api_llm_load_stream():
if not self.llm_analytics:
return jsonify({'success': False, 'message': 'LLM integration not available'})
model_name = request.args.get('model')
if not model_name:
return jsonify({'success': False, 'message': 'Model name is required'})
def generate_progress():
import time
import json
try:
# Send initial connection status
yield f"data: {json.dumps({'stage': 'connecting', 'pct': 0, 'message': 'Establishing connection...'})}\n\n"
time.sleep(0.5)
# Simulate model loading stages with progress
stages = [
{'stage': 'initializing', 'pct': 10, 'message': 'Initializing model loader...'},
{'stage': 'loading', 'pct': 25, 'message': 'Loading model file...'},
{'stage': 'parsing', 'pct': 45, 'message': 'Parsing model structure...'},
{'stage': 'quantizing', 'pct': 70, 'message': 'Applying quantization...'},
{'stage': 'optimizing', 'pct': 85, 'message': 'Optimizing for inference...'},
{'stage': 'finalizing', 'pct': 95, 'message': 'Finalizing setup...'}
]
for stage_info in stages:
yield f"data: {json.dumps(stage_info)}\n\n"
time.sleep(1) # Simulate processing time
# Attempt actual model loading
try:
success = self.llm_analytics.llm.load_model(model_name)
if success:
yield f"data: {json.dumps({
'stage': 'complete',
'pct': 100,
'message': f'Model {model_name} loaded successfully',
'complete': True
})}\n\n"
else:
yield f"data: {json.dumps({
'error': f'Failed to load model {model_name}. Check model file and configuration.',
'stage': 'error',
'pct': 0
})}\n\n"
except Exception as load_error:
# Handle specific error types
error_message = str(load_error)
if "out of memory" in error_message.lower() or "oom" in error_message.lower():
yield f"data: {json.dumps({'error': 'OOM on GPU - Model too large for available GPU memory'})}\n\n"
elif "not found" in error_message.lower():
yield f"data: {json.dumps({'error': f'Model file not found: {model_name}'})}\n\n"
elif "permission" in error_message.lower():
yield f"data: {json.dumps({'error': 'Permission denied accessing model file'})}\n\n"
else:
yield f"data: {json.dumps({'error': f'Failed to load model: {error_message}'})}\n\n"
except Exception as e:
yield f"data: {json.dumps({'error': f'Streaming error: {str(e)}'})}\n\n"
return Response(
generate_progress(),
mimetype='text/event-stream',
headers={
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'X-Accel-Buffering': 'no' # Disable nginx buffering
}
)
@self.flask_app.route('/api/llm/unload', methods=['POST'])
def api_llm_unload():
if not self.llm_analytics:
return jsonify({'success': False, 'message': 'LLM integration not available'})
try:
self.llm_analytics.llm.model = None
self.llm_analytics.llm.model_loaded = False
return jsonify({'success': True, 'message': 'Model unloaded successfully'})
except Exception as e:
return jsonify({'success': False, 'message': str(e)})
@self.flask_app.route('/api/llm/config', methods=['GET', 'POST'])
def api_llm_config():
if not self.llm_analytics:
return jsonify({'success': False, 'message': 'LLM integration not available'})
if request.method == 'GET':
return jsonify({
'models_path': self.llm_analytics.config.models_path,
'default_model': self.llm_analytics.config.default_model,
'max_tokens': self.llm_analytics.config.max_tokens,
'temperature': self.llm_analytics.config.temperature,
'context_window': self.llm_analytics.config.context_window,
'enable_gpu': self.llm_analytics.config.enable_gpu
})
elif request.method == 'POST':
data = request.get_json()
try:
# Update configuration
if 'models_path' in data:
old_path = self.llm_analytics.config.models_path
self.llm_analytics.config.models_path = data['models_path']
# Rescan models if path changed
if old_path != data['models_path']:
self.llm_analytics.llm.config.models_path = data['models_path']
self.llm_analytics.llm._scan_available_models()
if 'default_model' in data:
self.llm_analytics.config.default_model = data['default_model']
if 'max_tokens' in data:
self.llm_analytics.config.max_tokens = int(data['max_tokens'])
if 'temperature' in data:
self.llm_analytics.config.temperature = float(data['temperature'])
if 'context_window' in data:
self.llm_analytics.config.context_window = int(data['context_window'])
if 'enable_gpu' in data:
self.llm_analytics.config.enable_gpu = bool(data['enable_gpu'])
return jsonify({'success': True, 'message': 'Configuration updated successfully'})
except Exception as e:
return jsonify({'success': False, 'message': str(e)})
@self.flask_app.route('/api/llm/delete', methods=['POST'])
def api_llm_delete():
if not self.llm_analytics:
return jsonify({'success': False, 'message': 'LLM integration not available'})
data = request.get_json()
model_path = data.get('model_path')
if not model_path:
return jsonify({'success': False, 'message': 'Model path is required'})
try:
import os
if os.path.exists(model_path):
os.remove(model_path)
# Rescan models after deletion
self.llm_analytics.llm._scan_available_models()
return jsonify({'success': True, 'message': 'Model deleted successfully'})
else:
return jsonify({'success': False, 'message': 'Model file not found'})
except Exception as e:
return jsonify({'success': False, 'message': f'Error deleting model: {str(e)}'})
@self.flask_app.route('/api/llm/upload', methods=['POST'])
def api_llm_upload():
if not self.llm_analytics:
return jsonify({'success': False, 'message': 'LLM integration not available'})
if 'file' not in request.files:
return jsonify({'success': False, 'message': 'No file provided'})
file = request.files['file']
if file.filename == '':
return jsonify({'success': False, 'message': 'No file selected'})
try:
import os
# Save uploaded file to models directory
filename = file.filename
filepath = os.path.join(self.llm_analytics.config.models_path, filename)
# Create directory if it doesn't exist
os.makedirs(self.llm_analytics.config.models_path, exist_ok=True)
file.save(filepath)
# Rescan models after upload
self.llm_analytics.llm._scan_available_models()
return jsonify({
'success': True,
'message': f'Model {filename} uploaded successfully',
'path': filepath
})
except Exception as e:
return jsonify({'success': False, 'message': f'Error uploading model: {str(e)}'})
logger.info("🌐 Flask web interface configured")
def _generate_mock_data(self) -> Dict[str, Any]:
"""Generate mock data for UI testing"""
import random
return {
'performance_summary': {
'total_network_flows': random.randint(1000, 2000),
'packet_rate': f"{random.randint(2000000, 3000000):,}",
'total_lb_connections': random.randint(200, 400),
'average_response_time': f"{random.randint(100, 200):.2f}",
'error_rate': random.uniform(0.01, 0.05),
'health_score': random.uniform(0.95, 1.0)
}
}
def _generate_mock_ml_insights(self) -> Dict[str, Any]:
"""Generate mock ML insights for UI testing"""
import random
return {
'available': True,
'ml_status': {
'models_trained': True,
'metrics_analyzed': random.randint(20, 50),
'last_updated': datetime.now().isoformat()
},
'anomalies': {
'count': random.randint(0, 3),
'critical_count': random.randint(0, 1)
},
'predictions': {
'count': random.randint(0, 5)
},
'recommendations': {
'count': random.randint(0, 3)
}
}
def _generate_mock_alerts(self) -> List[Dict[str, Any]]:
"""Generate mock alerts for UI testing"""
import random
alerts = []
if random.random() > 0.7: # 30% chance of having alerts
alerts.append({
'title': 'High Response Time Detected',
'message': 'Average response time has increased by 25% in the last 10 minutes',
'severity': 'medium',
'type': 'performance',
'confidence': 0.85,
'timestamp': time.time()
})
return alerts
def _generate_mock_suggestions(self) -> List[Dict[str, Any]]:
"""Generate mock suggestions for UI testing"""
return [
{
'title': 'Load Balancer Optimization',
'description': 'Consider adjusting load balancing algorithm for better performance',
'priority': 'medium',
'category': 'performance',
'actions': [
'Review current load balancing configuration',
'Consider implementing weighted round-robin',
'Monitor backend server performance'
]
}
]
def _get_dashboard_template(self) -> str:
"""Get the HTML template for the dashboard"""
return """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MeshAdmin Enhanced Performance Analytics</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<!-- Tab System CSS -->
<link rel="stylesheet" href="/static/css/tabs.css">
<link rel="stylesheet" href="/static/css/llm-progress.css">
<script src="/static/js/tabs.js"></script>
<style>
:root {
--primary-bg: #000000;
--secondary-bg: #1a1a1a;
--card-bg: #1a1a1a;
--bg-color: #1a1a1a;
--primary-text: #ffffff;
--text-color: #e0e0e0;
--text-secondary: #b0b0b0;
--border-color: #3d3d3d;
--accent-color: #FF4444;
--accent-color-light: #FF6666;
--success-color: #00b894;
--warning-color: #fdcb6e;
--error-color: #e84393;
--critical-color: #FF3333;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 20px;
background-color: var(--primary-bg);
color: var(--primary-text);
transition: all 0.3s ease;
}
.header {
background: #000;
color: white;
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
text-align: center;
}
.container {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 20px;
}
.full-width {
grid-column: 1 / -1;
}
.card {
background: var(--card-bg);
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
border: 1px solid var(--border-color);
color: var(--primary-text);
}
.card h3 {
color: var(--accent-color);
margin-top: 0;
text-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
font-weight: 600;
}
.metric {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px;
margin: 8px 0;
background: var(--bg-color);
border-radius: 8px;
border-left: 4px solid var(--accent-color);
color: var(--text-color);
transition: all 0.2s ease;
}
.metric:hover {
background: var(--border-color);
transform: translateX(2px);
}
.metric.warning {
border-left-color: var(--warning-color);
}
.metric.critical {
border-left-color: var(--critical-color);
}
.alert {
padding: 12px;
margin: 8px 0;
border-radius: 8px;
color: var(--text-color);
border-left: 4px solid;
background: var(--card-bg);
transition: all 0.2s ease;
}
.alert:hover {
transform: translateX(2px);
}
.alert.critical {
border-left-color: var(--critical-color);
background: rgba(214, 48, 49, 0.1);
}
.alert.high {
border-left-color: var(--error-color);
background: rgba(232, 67, 147, 0.1);
}
.alert.medium {
border-left-color: var(--warning-color);
background: rgba(253, 203, 110, 0.1);
}
.alert.low {
border-left-color: var(--success-color);
background: rgba(0, 184, 148, 0.1);
}
.suggestion {
padding: 16px;
margin: 12px 0;
border-radius: 8px;
border-left: 4px solid var(--accent-color-light);
background: var(--card-bg);
color: var(--text-color);
transition: all 0.2s ease;
}
.suggestion:hover {
background: var(--border-color);
transform: translateX(2px);
}
.suggestion h4 {
color: var(--accent-color-light);
margin-top: 0;
}
.chart-container {
height: 400px;
margin: 20px 0;
}
.status-indicator {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 8px;
box-shadow: 0 0 8px rgba(255,255,255,0.3);
}
.status-running {
background-color: var(--success-color);
box-shadow: 0 0 8px var(--success-color);
}
.status-stopped {
background-color: var(--critical-color);
box-shadow: 0 0 8px var(--critical-color);
}
.refresh-btn {
background: var(--accent-color);
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
cursor: pointer;
margin: 10px 5px;
font-weight: 500;
transition: all 0.2s ease;
box-shadow: 0 2px 8px rgba(139, 0, 0, 0.3);
}
.refresh-btn:hover {
background: var(--accent-color-light);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(197, 0, 0, 0.4);
}
/* Dark mode for Plotly charts */
.chart-container {
background: var(--card-bg);
border-radius: 8px;
padding: 10px;
margin: 20px 0;
}
/* LLM Model Management Styles */
.model-select-container {
margin: 15px 0;
}
.model-select {
width: 100%;
padding: 10px 12px;
border: 1px solid var(--border-color);
border-radius: 6px;
background: var(--bg-color);
color: var(--text-color);
font-size: 14px;
margin-bottom: 15px;
}
.model-select:focus {
outline: none;
border-color: var(--accent-color);
box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
}
.model-actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
align-items: center;
}
.model-info {
font-size: 12px;
color: var(--text-secondary);
margin-left: 10px;
flex: 1;
}
.model-btn {
background: var(--accent-color);
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
transition: all 0.2s ease;
}
.model-btn:hover {
background: var(--accent-color-light);
transform: translateY(-1px);
}
.model-btn.danger {
background: var(--critical-color);
}
.model-btn.danger:hover {
background: #b71c1c;
}
.model-btn.success {
background: var(--success-color);
}
.form-group {
margin: 15px 0;
}
.form-group label {
display: block;
margin-bottom: 5px;
color: var(--text-color);
font-weight: 500;
}
.form-group input, .form-group select {
width: 100%;
padding: 8px 12px;
border: 1px solid var(--border-color);
border-radius: 4px;
background: var(--bg-color);
color: var(--text-color);
font-size: 14px;
}
.form-group input:focus, .form-group select:focus {
outline: none;
border-color: var(--accent-color);
box-shadow: 0 0 0 2px rgba(139, 0, 0, 0.2);
}
.config-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
}
.upload-area {
border: 2px dashed var(--border-color);
border-radius: 8px;
padding: 30px;
text-align: center;
transition: all 0.2s ease;
cursor: pointer;
}
.upload-area:hover {
border-color: var(--accent-color);
background: rgba(139, 0, 0, 0.05);
}
.upload-area.dragover {
border-color: var(--success-color);
background: rgba(0, 184, 148, 0.1);
}
.status-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 12px;
font-size: 10px;
font-weight: 500;
text-transform: uppercase;
}
.status-loaded {
background: rgba(0, 184, 148, 0.2);
color: var(--success-color);
}
.status-available {
background: rgba(255, 68, 68, 0.2);
color: var(--accent-color);
text-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
}
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
}
.modal-content {
background-color: var(--card-bg);
margin: 5% auto;
padding: 20px;
border: 1px solid var(--border-color);
border-radius: 10px;
width: 80%;
max-width: 600px;
max-height: 80vh;
overflow-y: auto;
}
.close {
color: var(--text-secondary);
float: right;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
.close:hover {
color: var(--text-color);
}
/* Responsive Design */
@media (max-width: 768px) {
.container {