@aituber-onair/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +723 -0
  2. package/dist/constants/api.d.ts +4 -0
  3. package/dist/constants/api.js +13 -0
  4. package/dist/constants/api.js.map +1 -0
  5. package/dist/constants/index.d.ts +23 -0
  6. package/dist/constants/index.js +25 -0
  7. package/dist/constants/index.js.map +1 -0
  8. package/dist/constants/openaiApi.d.ts +15 -0
  9. package/dist/constants/openaiApi.js +15 -0
  10. package/dist/constants/openaiApi.js.map +1 -0
  11. package/dist/constants/prompts.d.ts +2 -0
  12. package/dist/constants/prompts.js +13 -0
  13. package/dist/constants/prompts.js.map +1 -0
  14. package/dist/core/AITuberOnAirCore.d.ts +142 -0
  15. package/dist/core/AITuberOnAirCore.js +316 -0
  16. package/dist/core/AITuberOnAirCore.js.map +1 -0
  17. package/dist/core/ChatProcessor.d.ts +86 -0
  18. package/dist/core/ChatProcessor.js +246 -0
  19. package/dist/core/ChatProcessor.js.map +1 -0
  20. package/dist/core/EventEmitter.d.ts +35 -0
  21. package/dist/core/EventEmitter.js +72 -0
  22. package/dist/core/EventEmitter.js.map +1 -0
  23. package/dist/core/MemoryManager.d.ts +98 -0
  24. package/dist/core/MemoryManager.js +208 -0
  25. package/dist/core/MemoryManager.js.map +1 -0
  26. package/dist/index.d.ts +24 -0
  27. package/dist/index.js +22 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/services/chat/ChatService.d.ts +21 -0
  30. package/dist/services/chat/ChatService.js +2 -0
  31. package/dist/services/chat/ChatService.js.map +1 -0
  32. package/dist/services/chat/ChatServiceFactory.d.ts +38 -0
  33. package/dist/services/chat/ChatServiceFactory.js +55 -0
  34. package/dist/services/chat/ChatServiceFactory.js.map +1 -0
  35. package/dist/services/chat/OpenAIChatService.d.ts +38 -0
  36. package/dist/services/chat/OpenAIChatService.js +166 -0
  37. package/dist/services/chat/OpenAIChatService.js.map +1 -0
  38. package/dist/services/chat/OpenAISummarizer.d.ts +25 -0
  39. package/dist/services/chat/OpenAISummarizer.js +70 -0
  40. package/dist/services/chat/OpenAISummarizer.js.map +1 -0
  41. package/dist/services/chat/providers/ChatServiceProvider.d.ts +44 -0
  42. package/dist/services/chat/providers/ChatServiceProvider.js +2 -0
  43. package/dist/services/chat/providers/ChatServiceProvider.js.map +1 -0
  44. package/dist/services/chat/providers/OpenAIChatServiceProvider.d.ts +33 -0
  45. package/dist/services/chat/providers/OpenAIChatServiceProvider.js +44 -0
  46. package/dist/services/chat/providers/OpenAIChatServiceProvider.js.map +1 -0
  47. package/dist/services/voice/VoiceEngineAdapter.d.ts +46 -0
  48. package/dist/services/voice/VoiceEngineAdapter.js +173 -0
  49. package/dist/services/voice/VoiceEngineAdapter.js.map +1 -0
  50. package/dist/services/voice/VoiceService.d.ts +55 -0
  51. package/dist/services/voice/VoiceService.js +2 -0
  52. package/dist/services/voice/VoiceService.js.map +1 -0
  53. package/dist/services/voice/engines/AivisSpeechEngine.d.ts +10 -0
  54. package/dist/services/voice/engines/AivisSpeechEngine.js +70 -0
  55. package/dist/services/voice/engines/AivisSpeechEngine.js.map +1 -0
  56. package/dist/services/voice/engines/NijiVoiceEngine.d.ts +12 -0
  57. package/dist/services/voice/engines/NijiVoiceEngine.js +105 -0
  58. package/dist/services/voice/engines/NijiVoiceEngine.js.map +1 -0
  59. package/dist/services/voice/engines/OpenAiEngine.d.ts +9 -0
  60. package/dist/services/voice/engines/OpenAiEngine.js +34 -0
  61. package/dist/services/voice/engines/OpenAiEngine.js.map +1 -0
  62. package/dist/services/voice/engines/VoiceEngine.d.ts +21 -0
  63. package/dist/services/voice/engines/VoiceEngine.js +2 -0
  64. package/dist/services/voice/engines/VoiceEngine.js.map +1 -0
  65. package/dist/services/voice/engines/VoiceEngineFactory.d.ts +14 -0
  66. package/dist/services/voice/engines/VoiceEngineFactory.js +34 -0
  67. package/dist/services/voice/engines/VoiceEngineFactory.js.map +1 -0
  68. package/dist/services/voice/engines/VoicePeakEngine.d.ts +13 -0
  69. package/dist/services/voice/engines/VoicePeakEngine.js +46 -0
  70. package/dist/services/voice/engines/VoicePeakEngine.js.map +1 -0
  71. package/dist/services/voice/engines/VoiceVoxEngine.d.ts +13 -0
  72. package/dist/services/voice/engines/VoiceVoxEngine.js +67 -0
  73. package/dist/services/voice/engines/VoiceVoxEngine.js.map +1 -0
  74. package/dist/services/voice/engines/index.d.ts +7 -0
  75. package/dist/services/voice/engines/index.js +7 -0
  76. package/dist/services/voice/engines/index.js.map +1 -0
  77. package/dist/services/voice/messages.d.ts +38 -0
  78. package/dist/services/voice/messages.js +49 -0
  79. package/dist/services/voice/messages.js.map +1 -0
  80. package/dist/services/youtube/YouTubeDataApiService.d.ts +69 -0
  81. package/dist/services/youtube/YouTubeDataApiService.js +255 -0
  82. package/dist/services/youtube/YouTubeDataApiService.js.map +1 -0
  83. package/dist/services/youtube/YouTubeService.d.ts +63 -0
  84. package/dist/services/youtube/YouTubeService.js +2 -0
  85. package/dist/services/youtube/YouTubeService.js.map +1 -0
  86. package/dist/types/index.d.ts +82 -0
  87. package/dist/types/index.js +5 -0
  88. package/dist/types/index.js.map +1 -0
  89. package/dist/types/nijiVoice.d.ts +27 -0
  90. package/dist/types/nijiVoice.js +2 -0
  91. package/dist/types/nijiVoice.js.map +1 -0
  92. package/dist/utils/index.d.ts +5 -0
  93. package/dist/utils/index.js +6 -0
  94. package/dist/utils/index.js.map +1 -0
  95. package/dist/utils/screenplay.d.ts +19 -0
  96. package/dist/utils/screenplay.js +42 -0
  97. package/dist/utils/screenplay.js.map +1 -0
  98. package/dist/utils/screenshot.d.ts +19 -0
  99. package/dist/utils/screenshot.js +44 -0
  100. package/dist/utils/screenshot.js.map +1 -0
  101. package/dist/utils/storage.d.ts +44 -0
  102. package/dist/utils/storage.js +103 -0
  103. package/dist/utils/storage.js.map +1 -0
  104. package/package.json +33 -0
@@ -0,0 +1,4 @@
1
+ export declare const VOICE_VOX_API_URL = "http://localhost:50021";
2
+ export declare const VOICEPEAK_API_URL = "http://localhost:20202";
3
+ export declare const AIVIS_SPEECH_API_URL = "http://localhost:10101";
4
+ export declare const NIJI_VOICE_API_URL = "https://api.nijivoice.com/api/platform/v1";
@@ -0,0 +1,13 @@
1
+ /*
2
+ export const VOICE_VOX_API_URL =
3
+ process.env.NEXT_PUBLIC_VOICE_VOX_API_URL || 'http://localhost:50021';
4
+ export const VOICEPEAK_API_URL =
5
+ process.env.NEXT_PUBLIC_VOICEPEAK_API_URL || 'http://localhost:20202';
6
+ export const AIVIS_SPEECH_API_URL =
7
+ process.env.NEXT_PUBLIC_AIVIS_SPEECH_API_URL || 'http://localhost:10101';
8
+ */
9
+ export const VOICE_VOX_API_URL = 'http://localhost:50021';
10
+ export const VOICEPEAK_API_URL = 'http://localhost:20202';
11
+ export const AIVIS_SPEECH_API_URL = 'http://localhost:10101';
12
+ export const NIJI_VOICE_API_URL = 'https://api.nijivoice.com/api/platform/v1';
13
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/constants/api.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,2CAA2C,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Constants for AITuber OnAir Core
3
+ */
4
+ export declare const ENDPOINT_OPENAI_CHAT_COMPLETIONS_API = "https://api.openai.com/v1/chat/completions";
5
+ export declare const ENDPOINT_YOUTUBE_API = "https://youtube.googleapis.com/youtube/v3";
6
+ export declare const VOICE_VOX_API_URL = "http://localhost:50021";
7
+ export declare const VOICEPEAK_API_URL = "http://localhost:20202";
8
+ export declare const AIVIS_SPEECH_API_URL = "http://localhost:10101";
9
+ export declare const NIJI_VOICE_API_URL = "https://api.nijivoice.com/api/platform/v1";
10
+ export declare const MODEL_GPT_4O_MINI = "gpt-4o-mini";
11
+ export declare const CHAT_RESPONSE_LENGTH: {
12
+ readonly VERY_SHORT: "veryShort";
13
+ readonly SHORT: "short";
14
+ readonly MEDIUM: "medium";
15
+ readonly LONG: "long";
16
+ };
17
+ export declare const MAX_TOKENS_BY_LENGTH: {
18
+ readonly veryShort: 40;
19
+ readonly short: 100;
20
+ readonly medium: 200;
21
+ readonly long: 300;
22
+ };
23
+ export type ChatResponseLength = (typeof CHAT_RESPONSE_LENGTH)[keyof typeof CHAT_RESPONSE_LENGTH];
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Constants for AITuber OnAir Core
3
+ */
4
+ export const ENDPOINT_OPENAI_CHAT_COMPLETIONS_API = 'https://api.openai.com/v1/chat/completions';
5
+ export const ENDPOINT_YOUTUBE_API = 'https://youtube.googleapis.com/youtube/v3';
6
+ export const VOICE_VOX_API_URL = 'http://localhost:50021';
7
+ export const VOICEPEAK_API_URL = 'http://localhost:20202';
8
+ export const AIVIS_SPEECH_API_URL = 'http://localhost:10101';
9
+ export const NIJI_VOICE_API_URL = 'https://api.nijivoice.com/api/platform/v1';
10
+ // gpt model
11
+ export const MODEL_GPT_4O_MINI = 'gpt-4o-mini';
12
+ // chat response length
13
+ export const CHAT_RESPONSE_LENGTH = {
14
+ VERY_SHORT: 'veryShort',
15
+ SHORT: 'short',
16
+ MEDIUM: 'medium',
17
+ LONG: 'long',
18
+ };
19
+ export const MAX_TOKENS_BY_LENGTH = {
20
+ [CHAT_RESPONSE_LENGTH.VERY_SHORT]: 40,
21
+ [CHAT_RESPONSE_LENGTH.SHORT]: 100,
22
+ [CHAT_RESPONSE_LENGTH.MEDIUM]: 200,
23
+ [CHAT_RESPONSE_LENGTH.LONG]: 300,
24
+ };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAC/C,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,2CAA2C,CAAC;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,2CAA2C,CAAC;AAE9E,YAAY;AACZ,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE/C,uBAAuB;AACvB,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,WAAW;IACvB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,EAAE;IACrC,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,GAAG;IACjC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,GAAG;IAClC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG;CACxB,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare const MODEL_GPT_4O_MINI = "gpt-4o-mini";
2
+ export declare const CHAT_COMPLETION_API_V1 = "https://api.openai.com/v1/chat/completions";
3
+ export declare const CHAT_RESPONSE_LENGTH: {
4
+ readonly VERY_SHORT: "veryShort";
5
+ readonly SHORT: "short";
6
+ readonly MEDIUM: "medium";
7
+ readonly LONG: "long";
8
+ };
9
+ export declare const MAX_TOKENS_BY_LENGTH: {
10
+ readonly veryShort: 40;
11
+ readonly short: 100;
12
+ readonly medium: 200;
13
+ readonly long: 300;
14
+ };
15
+ export type ChatResponseLength = (typeof CHAT_RESPONSE_LENGTH)[keyof typeof CHAT_RESPONSE_LENGTH];
@@ -0,0 +1,15 @@
1
+ export const MODEL_GPT_4O_MINI = 'gpt-4o-mini';
2
+ export const CHAT_COMPLETION_API_V1 = 'https://api.openai.com/v1/chat/completions';
3
+ export const CHAT_RESPONSE_LENGTH = {
4
+ VERY_SHORT: 'veryShort',
5
+ SHORT: 'short',
6
+ MEDIUM: 'medium',
7
+ LONG: 'long',
8
+ };
9
+ export const MAX_TOKENS_BY_LENGTH = {
10
+ [CHAT_RESPONSE_LENGTH.VERY_SHORT]: 40,
11
+ [CHAT_RESPONSE_LENGTH.SHORT]: 100,
12
+ [CHAT_RESPONSE_LENGTH.MEDIUM]: 200,
13
+ [CHAT_RESPONSE_LENGTH.LONG]: 300,
14
+ };
15
+ //# sourceMappingURL=openaiApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openaiApi.js","sourceRoot":"","sources":["../../src/constants/openaiApi.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,MAAM,CAAC,MAAM,sBAAsB,GACjC,4CAA4C,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,WAAW;IACvB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,EAAE;IACrC,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,GAAG;IACjC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,GAAG;IAClC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG;CACxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_VISION_PROMPT = "You are a friendly AI avatar. Comment on the situation based on the broadcast screen.";
2
+ export declare const DEFAULT_SUMMARY_PROMPT_TEMPLATE = "You are a skilled summarizing assistant. \nAnalyze the following conversation and produce a summary in the **same language** as the majority of the conversation:\n- Summaries should highlight key points\n- Stay concise (around {maxLength} characters if possible)\n- No redundant expressions\n\nIf the conversation is in Japanese, summarize in Japanese.\nIf it's in English, summarize in English.\nIf it's in another language, summarize in that language.\n";
@@ -0,0 +1,13 @@
1
+ // Default prompts
2
+ export const DEFAULT_VISION_PROMPT = 'You are a friendly AI avatar. Comment on the situation based on the broadcast screen.';
3
+ export const DEFAULT_SUMMARY_PROMPT_TEMPLATE = `You are a skilled summarizing assistant.
4
+ Analyze the following conversation and produce a summary in the **same language** as the majority of the conversation:
5
+ - Summaries should highlight key points
6
+ - Stay concise (around {maxLength} characters if possible)
7
+ - No redundant expressions
8
+
9
+ If the conversation is in Japanese, summarize in Japanese.
10
+ If it's in English, summarize in English.
11
+ If it's in another language, summarize in that language.
12
+ `;
13
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/constants/prompts.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,MAAM,CAAC,MAAM,qBAAqB,GAChC,uFAAuF,CAAC;AAC1F,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;CAS9C,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { EventEmitter } from './EventEmitter';
2
+ import { ChatProcessorOptions } from './ChatProcessor';
3
+ import { MemoryOptions } from './MemoryManager';
4
+ import { VoiceServiceOptions } from '../services/voice/VoiceService';
5
+ import { Message, MemoryStorage } from '../types';
6
+ /**
7
+ * Setting options for AITuberOnAirCore
8
+ */
9
+ export interface AITuberOnAirCoreOptions {
10
+ /** AI provider name */
11
+ chatProvider?: string;
12
+ /** AI API key */
13
+ apiKey: string;
14
+ /** AI model name (default is provider's default model) */
15
+ model?: string;
16
+ /** ChatProcessor options */
17
+ chatOptions: Omit<ChatProcessorOptions, 'useMemory'>;
18
+ /** Memory options (disabled by default) */
19
+ memoryOptions?: MemoryOptions;
20
+ /** Memory storage for persistence (optional) */
21
+ memoryStorage?: MemoryStorage;
22
+ /** Voice service options */
23
+ voiceOptions?: VoiceServiceOptions;
24
+ /** Debug mode */
25
+ debug?: boolean;
26
+ /** ChatService provider-specific options (optional) */
27
+ providerOptions?: Record<string, any>;
28
+ }
29
+ /**
30
+ * Event types for AITuberOnAirCore
31
+ */
32
+ export declare enum AITuberOnAirCoreEvent {
33
+ /** Processing started */
34
+ PROCESSING_START = "processingStart",
35
+ /** Processing ended */
36
+ PROCESSING_END = "processingEnd",
37
+ /** Assistant (partial) response */
38
+ ASSISTANT_PARTIAL = "assistantPartial",
39
+ /** Assistant response completed */
40
+ ASSISTANT_RESPONSE = "assistantResponse",
41
+ /** Speech started */
42
+ SPEECH_START = "speechStart",
43
+ /** Speech ended */
44
+ SPEECH_END = "speechEnd",
45
+ /** Error occurred */
46
+ ERROR = "error"
47
+ }
48
+ /**
49
+ * AITuberOnAirCore is a core class that integrates the main features of AITuber
50
+ * - Chat processing (ChatService, ChatProcessor)
51
+ * - Speech synthesis (VoiceService)
52
+ * - Memory management (MemoryManager)
53
+ */
54
+ export declare class AITuberOnAirCore extends EventEmitter {
55
+ private chatService;
56
+ private chatProcessor;
57
+ private memoryManager?;
58
+ private voiceService?;
59
+ private isProcessing;
60
+ private debug;
61
+ /**
62
+ * Constructor
63
+ * @param options Configuration options
64
+ */
65
+ constructor(options: AITuberOnAirCoreOptions);
66
+ /**
67
+ * Process text chat
68
+ * @param text User input text
69
+ * @returns Success or failure of processing
70
+ */
71
+ processChat(text: string): Promise<boolean>;
72
+ /**
73
+ * Process image-based chat
74
+ * @param imageDataUrl Image data URL
75
+ * @param visionPrompt Custom prompt for describing the image (optional)
76
+ * @returns Success or failure of processing
77
+ */
78
+ processVisionChat(imageDataUrl: string, visionPrompt?: string): Promise<boolean>;
79
+ /**
80
+ * Stop speech playback
81
+ */
82
+ stopSpeech(): void;
83
+ /**
84
+ * Get chat history
85
+ */
86
+ getChatHistory(): Message[];
87
+ /**
88
+ * Clear chat history
89
+ */
90
+ clearChatHistory(): void;
91
+ /**
92
+ * Update voice service
93
+ * @param options New voice service options
94
+ */
95
+ updateVoiceService(options: VoiceServiceOptions): void;
96
+ /**
97
+ * Speak text with custom voice options
98
+ * @param text Text to speak
99
+ * @param options Speech options
100
+ * @returns Promise that resolves when speech is complete
101
+ */
102
+ speakTextWithOptions(text: string, options?: {
103
+ enableAnimation?: boolean;
104
+ temporaryVoiceOptions?: Partial<VoiceServiceOptions>;
105
+ audioElementId?: string;
106
+ }): Promise<void>;
107
+ /**
108
+ * Setup forwarding of ChatProcessor events
109
+ */
110
+ private setupEventForwarding;
111
+ /**
112
+ * Output debug log (only in debug mode)
113
+ */
114
+ private log;
115
+ /**
116
+ * Check if memory functionality is enabled
117
+ */
118
+ isMemoryEnabled(): boolean;
119
+ /**
120
+ * Remove all event listeners
121
+ */
122
+ offAll(): void;
123
+ /**
124
+ * Get current provider information
125
+ * @returns Provider information object
126
+ */
127
+ getProviderInfo(): {
128
+ name: string;
129
+ model?: string;
130
+ };
131
+ /**
132
+ * Get list of available providers
133
+ * @returns Array of available provider names
134
+ */
135
+ static getAvailableProviders(): string[];
136
+ /**
137
+ * Get list of models supported by the specified provider
138
+ * @param providerName Provider name
139
+ * @returns Array of supported models
140
+ */
141
+ static getSupportedModels(providerName: string): string[];
142
+ }
@@ -0,0 +1,316 @@
1
+ import { EventEmitter } from './EventEmitter';
2
+ import { ChatProcessor } from './ChatProcessor';
3
+ import { MemoryManager } from './MemoryManager';
4
+ import { OpenAISummarizer } from '../services/chat/OpenAISummarizer';
5
+ import { VoiceEngineAdapter } from '../services/voice/VoiceEngineAdapter';
6
+ import { textToScreenplay, screenplayToText } from '../utils/screenplay';
7
+ import { ChatServiceFactory } from '../services/chat/ChatServiceFactory';
8
+ import { MODEL_GPT_4O_MINI } from '../constants';
9
+ /**
10
+ * Event types for AITuberOnAirCore
11
+ */
12
+ export var AITuberOnAirCoreEvent;
13
+ (function (AITuberOnAirCoreEvent) {
14
+ /** Processing started */
15
+ AITuberOnAirCoreEvent["PROCESSING_START"] = "processingStart";
16
+ /** Processing ended */
17
+ AITuberOnAirCoreEvent["PROCESSING_END"] = "processingEnd";
18
+ /** Assistant (partial) response */
19
+ AITuberOnAirCoreEvent["ASSISTANT_PARTIAL"] = "assistantPartial";
20
+ /** Assistant response completed */
21
+ AITuberOnAirCoreEvent["ASSISTANT_RESPONSE"] = "assistantResponse";
22
+ /** Speech started */
23
+ AITuberOnAirCoreEvent["SPEECH_START"] = "speechStart";
24
+ /** Speech ended */
25
+ AITuberOnAirCoreEvent["SPEECH_END"] = "speechEnd";
26
+ /** Error occurred */
27
+ AITuberOnAirCoreEvent["ERROR"] = "error";
28
+ })(AITuberOnAirCoreEvent || (AITuberOnAirCoreEvent = {}));
29
+ /**
30
+ * AITuberOnAirCore is a core class that integrates the main features of AITuber
31
+ * - Chat processing (ChatService, ChatProcessor)
32
+ * - Speech synthesis (VoiceService)
33
+ * - Memory management (MemoryManager)
34
+ */
35
+ export class AITuberOnAirCore extends EventEmitter {
36
+ /**
37
+ * Constructor
38
+ * @param options Configuration options
39
+ */
40
+ constructor(options) {
41
+ super();
42
+ this.isProcessing = false;
43
+ this.debug = options.debug || false;
44
+ // Determine provider name (default is 'openai')
45
+ const providerName = options.chatProvider || 'openai';
46
+ // Build chat service options
47
+ const chatServiceOptions = {
48
+ apiKey: options.apiKey,
49
+ model: options.model,
50
+ ...options.providerOptions,
51
+ };
52
+ // Initialize ChatService
53
+ this.chatService = ChatServiceFactory.createChatService(providerName, chatServiceOptions);
54
+ // Initialize MemoryManager (optional)
55
+ if (options.memoryOptions && options.memoryOptions.enableSummarization) {
56
+ const summarizer = new OpenAISummarizer(options.apiKey, MODEL_GPT_4O_MINI, options.memoryOptions.summaryPromptTemplate);
57
+ this.memoryManager = new MemoryManager(options.memoryOptions, summarizer, options.memoryStorage);
58
+ }
59
+ // Initialize ChatProcessor
60
+ this.chatProcessor = new ChatProcessor(this.chatService, {
61
+ ...options.chatOptions,
62
+ useMemory: !!this.memoryManager,
63
+ }, this.memoryManager);
64
+ // Forward events
65
+ this.setupEventForwarding();
66
+ // Initialize VoiceService (optional)
67
+ if (options.voiceOptions) {
68
+ this.voiceService = new VoiceEngineAdapter(options.voiceOptions);
69
+ }
70
+ this.log('AITuberOnAirCore initialized');
71
+ }
72
+ /**
73
+ * Process text chat
74
+ * @param text User input text
75
+ * @returns Success or failure of processing
76
+ */
77
+ async processChat(text) {
78
+ if (this.isProcessing) {
79
+ this.log('Already processing another chat');
80
+ return false;
81
+ }
82
+ try {
83
+ this.isProcessing = true;
84
+ this.emit(AITuberOnAirCoreEvent.PROCESSING_START, { text });
85
+ // Process text chat
86
+ await this.chatProcessor.processTextChat(text);
87
+ return true;
88
+ }
89
+ catch (error) {
90
+ this.log('Error in processChat:', error);
91
+ this.emit(AITuberOnAirCoreEvent.ERROR, error);
92
+ return false;
93
+ }
94
+ finally {
95
+ this.isProcessing = false;
96
+ this.emit(AITuberOnAirCoreEvent.PROCESSING_END);
97
+ }
98
+ }
99
+ /**
100
+ * Process image-based chat
101
+ * @param imageDataUrl Image data URL
102
+ * @param visionPrompt Custom prompt for describing the image (optional)
103
+ * @returns Success or failure of processing
104
+ */
105
+ async processVisionChat(imageDataUrl, visionPrompt) {
106
+ if (this.isProcessing) {
107
+ this.log('Already processing another chat');
108
+ return false;
109
+ }
110
+ try {
111
+ this.isProcessing = true;
112
+ this.emit(AITuberOnAirCoreEvent.PROCESSING_START, { type: 'vision' });
113
+ // Update vision prompt if provided
114
+ if (visionPrompt) {
115
+ this.chatProcessor.updateOptions({ visionPrompt });
116
+ }
117
+ // Process image in ChatProcessor
118
+ await this.chatProcessor.processVisionChat(imageDataUrl);
119
+ return true;
120
+ }
121
+ catch (error) {
122
+ this.log('Error in processVisionChat:', error);
123
+ this.emit(AITuberOnAirCoreEvent.ERROR, error);
124
+ return false;
125
+ }
126
+ finally {
127
+ this.isProcessing = false;
128
+ this.emit(AITuberOnAirCoreEvent.PROCESSING_END);
129
+ }
130
+ }
131
+ /**
132
+ * Stop speech playback
133
+ */
134
+ stopSpeech() {
135
+ if (this.voiceService) {
136
+ this.voiceService.stop();
137
+ this.emit(AITuberOnAirCoreEvent.SPEECH_END);
138
+ }
139
+ }
140
+ /**
141
+ * Get chat history
142
+ */
143
+ getChatHistory() {
144
+ return this.chatProcessor.getChatLog();
145
+ }
146
+ /**
147
+ * Clear chat history
148
+ */
149
+ clearChatHistory() {
150
+ this.chatProcessor.clearChatLog();
151
+ if (this.memoryManager) {
152
+ this.memoryManager.clearAllMemories();
153
+ }
154
+ }
155
+ /**
156
+ * Update voice service
157
+ * @param options New voice service options
158
+ */
159
+ updateVoiceService(options) {
160
+ if (this.voiceService) {
161
+ this.voiceService.updateOptions(options);
162
+ }
163
+ else {
164
+ this.voiceService = new VoiceEngineAdapter(options);
165
+ }
166
+ }
167
+ /**
168
+ * Speak text with custom voice options
169
+ * @param text Text to speak
170
+ * @param options Speech options
171
+ * @returns Promise that resolves when speech is complete
172
+ */
173
+ async speakTextWithOptions(text, options) {
174
+ if (!this.voiceService) {
175
+ this.log('Voice service is not initialized');
176
+ return;
177
+ }
178
+ this.log(`Speaking text with options: ${JSON.stringify(options)}`);
179
+ // Store the original voice options
180
+ let originalVoiceOptions;
181
+ try {
182
+ // Apply temporary voice options if provided
183
+ if (options?.temporaryVoiceOptions) {
184
+ // We'll save what we're currently using and restore it later
185
+ originalVoiceOptions = {
186
+ speaker: this.voiceService.options?.speaker,
187
+ engineType: this.voiceService.options?.engineType,
188
+ apiKey: this.voiceService.options?.apiKey,
189
+ };
190
+ // Apply temporary options
191
+ this.voiceService.updateOptions(options.temporaryVoiceOptions);
192
+ }
193
+ // Set up audio options
194
+ const audioOptions = {
195
+ enableAnimation: options?.enableAnimation,
196
+ audioElementId: options?.audioElementId,
197
+ };
198
+ const screenplay = textToScreenplay(text);
199
+ // generate raw text(text with emotion tags)
200
+ const rawText = screenplayToText(screenplay);
201
+ // pass screenplay object as event data
202
+ this.emit(AITuberOnAirCoreEvent.SPEECH_START, { screenplay, rawText });
203
+ // Play the audio
204
+ await this.voiceService.speakText(screenplay.text, audioOptions);
205
+ // Speech end event
206
+ this.emit(AITuberOnAirCoreEvent.SPEECH_END);
207
+ }
208
+ catch (error) {
209
+ this.log('Error in speakTextWithOptions:', error);
210
+ this.emit(AITuberOnAirCoreEvent.ERROR, error);
211
+ }
212
+ finally {
213
+ // Restore original options if they were changed
214
+ if (originalVoiceOptions && this.voiceService) {
215
+ this.voiceService.updateOptions(originalVoiceOptions);
216
+ }
217
+ }
218
+ }
219
+ /**
220
+ * Setup forwarding of ChatProcessor events
221
+ */
222
+ setupEventForwarding() {
223
+ this.chatProcessor.on('processingStart', (data) => {
224
+ this.emit(AITuberOnAirCoreEvent.PROCESSING_START, data);
225
+ });
226
+ this.chatProcessor.on('processingEnd', () => {
227
+ this.emit(AITuberOnAirCoreEvent.PROCESSING_END);
228
+ });
229
+ this.chatProcessor.on('assistantPartialResponse', (text) => {
230
+ this.emit(AITuberOnAirCoreEvent.ASSISTANT_PARTIAL, text);
231
+ });
232
+ this.chatProcessor.on('assistantResponse', async (data) => {
233
+ const { message, screenplay } = data;
234
+ // Generate the raw text with emotion tags using utility function
235
+ const rawText = screenplayToText(screenplay);
236
+ // Fire assistant response event
237
+ this.emit(AITuberOnAirCoreEvent.ASSISTANT_RESPONSE, {
238
+ message,
239
+ screenplay,
240
+ rawText,
241
+ });
242
+ // Speech synthesis and playback (if VoiceService exists)
243
+ if (this.voiceService) {
244
+ try {
245
+ this.emit(AITuberOnAirCoreEvent.SPEECH_START, screenplay);
246
+ await this.voiceService.speak(screenplay, {
247
+ enableAnimation: true,
248
+ });
249
+ this.emit(AITuberOnAirCoreEvent.SPEECH_END);
250
+ }
251
+ catch (error) {
252
+ this.log('Error in speech synthesis:', error);
253
+ this.emit(AITuberOnAirCoreEvent.ERROR, error);
254
+ }
255
+ }
256
+ });
257
+ this.chatProcessor.on('error', (error) => {
258
+ this.emit(AITuberOnAirCoreEvent.ERROR, error);
259
+ });
260
+ if (this.memoryManager) {
261
+ this.memoryManager.on('error', (error) => {
262
+ this.emit(AITuberOnAirCoreEvent.ERROR, error);
263
+ });
264
+ }
265
+ }
266
+ /**
267
+ * Output debug log (only in debug mode)
268
+ */
269
+ log(...args) {
270
+ if (this.debug) {
271
+ console.log('[AITuberOnAirCore]', ...args);
272
+ }
273
+ }
274
+ /**
275
+ * Check if memory functionality is enabled
276
+ */
277
+ isMemoryEnabled() {
278
+ return !!this.memoryManager;
279
+ }
280
+ /**
281
+ * Remove all event listeners
282
+ */
283
+ offAll() {
284
+ this.removeAllListeners();
285
+ }
286
+ /**
287
+ * Get current provider information
288
+ * @returns Provider information object
289
+ */
290
+ getProviderInfo() {
291
+ // Safe method to get internal information without depending on specific provider implementation
292
+ // If only available in specific provider implementations, cast to any type
293
+ const provider = this.chatService.provider;
294
+ const model = this.chatService.model;
295
+ return {
296
+ name: provider ? provider : 'unknown',
297
+ model: model ? model : undefined,
298
+ };
299
+ }
300
+ /**
301
+ * Get list of available providers
302
+ * @returns Array of available provider names
303
+ */
304
+ static getAvailableProviders() {
305
+ return ChatServiceFactory.getAvailableProviders();
306
+ }
307
+ /**
308
+ * Get list of models supported by the specified provider
309
+ * @param providerName Provider name
310
+ * @returns Array of supported models
311
+ */
312
+ static getSupportedModels(providerName) {
313
+ return ChatServiceFactory.getSupportedModels(providerName);
314
+ }
315
+ }
316
+ //# sourceMappingURL=AITuberOnAirCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AITuberOnAirCore.js","sourceRoot":"","sources":["../../src/core/AITuberOnAirCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,aAAa,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