mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-17 22:27:19 +00:00
modified: server/openai.ts
modified: server/websocket.ts
This commit is contained in:
parent
fc6308676e
commit
106253255a
2 changed files with 10 additions and 2 deletions
|
|
@ -91,7 +91,15 @@ async function fetchRecentAlerts(): Promise<string> {
|
|||
if (recentAlerts.length === 0) return "No recent security alerts.";
|
||||
|
||||
return `RECENT ALERTS:
|
||||
${recentAlerts.map(alert => `- ${alert.type}: ${alert.message} (${new Date(alert.created_at).toLocaleString()})`).join('\n')}`;
|
||||
${recentAlerts.map(alert => {
|
||||
let dateStr = 'unknown';
|
||||
if (alert.created_at) {
|
||||
try {
|
||||
dateStr = new Date(alert.created_at).toLocaleString();
|
||||
} catch {}
|
||||
}
|
||||
return `- ${alert.type}: ${alert.message} (${dateStr})`;
|
||||
}).join('\n')}`;
|
||||
} catch (error) {
|
||||
return "Alert system offline - potential network intrusion.";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ function startPeriodicUpdates(io: SocketIOServer) {
|
|||
const alerts = await storage.getAlerts();
|
||||
const newAlerts = alerts.filter(a =>
|
||||
!a.is_resolved &&
|
||||
new Date(a.created_at) > lastAlertCheck
|
||||
a.created_at && !isNaN(new Date(a.created_at).getTime()) && new Date(a.created_at) > lastAlertCheck
|
||||
);
|
||||
|
||||
if (newAlerts.length > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue