feat: implement tray functionality with status updates and localization support

This commit is contained in:
duanshuwen
2026-04-22 07:19:53 +08:00
parent 197f644d53
commit be8298af2f
6 changed files with 341 additions and 120 deletions

View File

@@ -1,6 +1,7 @@
import { BrowserWindow } from 'electron';
import { windowManager } from '@electron/service/window-service';
import logManager from '@electron/service/logger';
import { updateTrayStatus } from '@electron/main/tray';
import type { GatewayEvent, RuntimeRefreshTopic } from './types';
import * as chatHandlers from './handlers/chat';
import * as providerHandlers from './handlers/provider';
@@ -20,15 +21,15 @@ class GatewayManager {
private setStatus(status: 'connected' | 'disconnected' | 'reconnecting'): void {
this.status = status;
updateTrayStatus(status);
this.broadcast({ type: 'gateway:status', status });
}
async init(): Promise<void> {
if (this.initialized) return;
this.initialized = true;
this.status = 'connected';
logManager.info('GatewayManager initialized');
this.broadcast({ type: 'gateway:status', status: 'connected' });
this.setStatus('connected');
}
async start(): Promise<void> {