mirror of
https://github.com/jeffusion/gitea-ai-assistant.git
synced 2026-03-27 10:05:50 +00:00
21 lines
837 B
TypeScript
21 lines
837 B
TypeScript
import { FeishuNotificationService } from './providers/feishu-notification-service.js';
|
|
import { WeComNotificationService } from './providers/wecom-notification-service.js';
|
|
import type { INotificationService, NotificationServiceConfig } from './types.js';
|
|
|
|
export function createNotificationService(config: NotificationServiceConfig): INotificationService {
|
|
switch (config.provider) {
|
|
case 'feishu':
|
|
return new FeishuNotificationService(config);
|
|
case 'wecom':
|
|
return new WeComNotificationService(config);
|
|
default:
|
|
throw new Error(`Unknown notification provider: ${config.provider}`);
|
|
}
|
|
}
|
|
|
|
export function createNotificationServices(
|
|
configs: NotificationServiceConfig[]
|
|
): INotificationService[] {
|
|
return configs.filter((c) => c.enabled && c.webhookUrl).map((c) => createNotificationService(c));
|
|
}
|