|
123456789101112131415161718192021222324252627282930313233 |
- import { SummarizerEventEmitter } from './common';
- import {
- CreateYouTubeSummarizerParams,
- YouTubeSummarizerEventEmitter,
- } from './video-types/youtube';
-
- export enum VideoType {
- YOUTUBE = 'youtube',
- }
-
- export interface CreateSummarizerParams extends CreateYouTubeSummarizerParams {
- type: VideoType;
- }
-
- export const createSummarizer = (params: CreateSummarizerParams): SummarizerEventEmitter => {
- const {
- type: videoType,
- openAiParams,
- } = params;
-
- switch (videoType as string) {
- case VideoType.YOUTUBE:
- return new YouTubeSummarizerEventEmitter({
- openAiParams,
- });
- default:
- break;
- }
-
- throw new TypeError(`Invalid video type: "${videoType}". Valid values are: ${JSON.stringify(Object.values(VideoType))}`);
- };
-
- export * from './common';
|