@aituber-onair/core 0.13.0 → 0.15.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 (82) hide show
  1. package/README.md +25 -1
  2. package/dist/constants/index.d.ts +0 -1
  3. package/dist/constants/index.js +0 -1
  4. package/dist/constants/index.js.map +1 -1
  5. package/dist/core/AITuberOnAirCore.d.ts +1 -1
  6. package/dist/core/AITuberOnAirCore.js +1 -1
  7. package/dist/core/AITuberOnAirCore.js.map +1 -1
  8. package/dist/index.d.ts +1 -3
  9. package/dist/index.js +10 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/services/chat/providers/claude/ClaudeChatService.js +2 -7
  12. package/dist/services/chat/providers/claude/ClaudeChatService.js.map +1 -1
  13. package/dist/services/chat/providers/gemini/GeminiChatService.js +5 -10
  14. package/dist/services/chat/providers/gemini/GeminiChatService.js.map +1 -1
  15. package/dist/services/chat/providers/openai/OpenAIChatService.js +8 -27
  16. package/dist/services/chat/providers/openai/OpenAIChatService.js.map +1 -1
  17. package/dist/types/index.d.ts +1 -7
  18. package/dist/types/index.js +0 -6
  19. package/dist/types/index.js.map +1 -1
  20. package/dist/utils/chatServiceHttpClient.d.ts +46 -0
  21. package/dist/utils/chatServiceHttpClient.js +126 -0
  22. package/dist/utils/chatServiceHttpClient.js.map +1 -0
  23. package/dist/utils/emotionParser.d.ts +45 -0
  24. package/dist/utils/emotionParser.js +55 -0
  25. package/dist/utils/emotionParser.js.map +1 -0
  26. package/dist/utils/index.d.ts +3 -0
  27. package/dist/utils/index.js +3 -0
  28. package/dist/utils/index.js.map +1 -1
  29. package/dist/utils/screenplay.js +5 -13
  30. package/dist/utils/screenplay.js.map +1 -1
  31. package/dist/utils/streamTextAccumulator.d.ts +24 -0
  32. package/dist/utils/streamTextAccumulator.js +43 -0
  33. package/dist/utils/streamTextAccumulator.js.map +1 -0
  34. package/package.json +4 -1
  35. package/dist/constants/voiceEngine.d.ts +0 -5
  36. package/dist/constants/voiceEngine.js +0 -6
  37. package/dist/constants/voiceEngine.js.map +0 -1
  38. package/dist/services/voice/VoiceEngineAdapter.d.ts +0 -46
  39. package/dist/services/voice/VoiceEngineAdapter.js +0 -192
  40. package/dist/services/voice/VoiceEngineAdapter.js.map +0 -1
  41. package/dist/services/voice/VoiceService.d.ts +0 -61
  42. package/dist/services/voice/VoiceService.js +0 -2
  43. package/dist/services/voice/VoiceService.js.map +0 -1
  44. package/dist/services/voice/engines/AivisSpeechEngine.d.ts +0 -16
  45. package/dist/services/voice/engines/AivisSpeechEngine.js +0 -80
  46. package/dist/services/voice/engines/AivisSpeechEngine.js.map +0 -1
  47. package/dist/services/voice/engines/NijiVoiceEngine.d.ts +0 -11
  48. package/dist/services/voice/engines/NijiVoiceEngine.js +0 -105
  49. package/dist/services/voice/engines/NijiVoiceEngine.js.map +0 -1
  50. package/dist/services/voice/engines/NoneEngine.d.ts +0 -28
  51. package/dist/services/voice/engines/NoneEngine.js +0 -34
  52. package/dist/services/voice/engines/NoneEngine.js.map +0 -1
  53. package/dist/services/voice/engines/OpenAiEngine.d.ts +0 -9
  54. package/dist/services/voice/engines/OpenAiEngine.js +0 -35
  55. package/dist/services/voice/engines/OpenAiEngine.js.map +0 -1
  56. package/dist/services/voice/engines/VoiceEngine.d.ts +0 -25
  57. package/dist/services/voice/engines/VoiceEngine.js +0 -2
  58. package/dist/services/voice/engines/VoiceEngine.js.map +0 -1
  59. package/dist/services/voice/engines/VoiceEngineFactory.d.ts +0 -15
  60. package/dist/services/voice/engines/VoiceEngineFactory.js +0 -37
  61. package/dist/services/voice/engines/VoiceEngineFactory.js.map +0 -1
  62. package/dist/services/voice/engines/VoicePeakEngine.d.ts +0 -19
  63. package/dist/services/voice/engines/VoicePeakEngine.js +0 -58
  64. package/dist/services/voice/engines/VoicePeakEngine.js.map +0 -1
  65. package/dist/services/voice/engines/VoiceVoxEngine.d.ts +0 -19
  66. package/dist/services/voice/engines/VoiceVoxEngine.js +0 -77
  67. package/dist/services/voice/engines/VoiceVoxEngine.js.map +0 -1
  68. package/dist/services/voice/engines/index.d.ts +0 -7
  69. package/dist/services/voice/engines/index.js +0 -7
  70. package/dist/services/voice/engines/index.js.map +0 -1
  71. package/dist/services/voice/messages.d.ts +0 -3
  72. package/dist/services/voice/messages.js +0 -43
  73. package/dist/services/voice/messages.js.map +0 -1
  74. package/dist/types/nijiVoice.d.ts +0 -27
  75. package/dist/types/nijiVoice.js +0 -2
  76. package/dist/types/nijiVoice.js.map +0 -1
  77. package/dist/types/voice.d.ts +0 -35
  78. package/dist/types/voice.js +0 -19
  79. package/dist/types/voice.js.map +0 -1
  80. package/dist/types/voiceEngine.d.ts +0 -1
  81. package/dist/types/voiceEngine.js +0 -2
  82. package/dist/types/voiceEngine.js.map +0 -1
@@ -1,15 +0,0 @@
1
- import { VoiceEngine } from './VoiceEngine';
2
- import { VoiceEngineType } from '../../../types';
3
- /**
4
- * Voice engine factory
5
- * Generate appropriate voice engine instances based on voice engine type
6
- */
7
- export declare class VoiceEngineFactory {
8
- /**
9
- * Get the voice engine for the specified engine type
10
- * @param engineType string of engine type ('voicevox', 'voicepeak', etc.)
11
- * @returns voice engine instance
12
- * @throws error if engine type is unknown
13
- */
14
- static getEngine(engineType: VoiceEngineType): VoiceEngine;
15
- }
@@ -1,37 +0,0 @@
1
- import { VoiceVoxEngine } from './VoiceVoxEngine';
2
- import { VoicePeakEngine } from './VoicePeakEngine';
3
- import { AivisSpeechEngine } from './AivisSpeechEngine';
4
- import { OpenAiEngine } from './OpenAiEngine';
5
- import { NijiVoiceEngine } from './NijiVoiceEngine';
6
- import { NoneEngine } from './NoneEngine';
7
- /**
8
- * Voice engine factory
9
- * Generate appropriate voice engine instances based on voice engine type
10
- */
11
- export class VoiceEngineFactory {
12
- /**
13
- * Get the voice engine for the specified engine type
14
- * @param engineType string of engine type ('voicevox', 'voicepeak', etc.)
15
- * @returns voice engine instance
16
- * @throws error if engine type is unknown
17
- */
18
- static getEngine(engineType) {
19
- switch (engineType) {
20
- case 'voicevox':
21
- return new VoiceVoxEngine();
22
- case 'voicepeak':
23
- return new VoicePeakEngine();
24
- case 'aivisSpeech':
25
- return new AivisSpeechEngine();
26
- case 'openai':
27
- return new OpenAiEngine();
28
- case 'nijivoice':
29
- return new NijiVoiceEngine();
30
- case 'none':
31
- return new NoneEngine();
32
- default:
33
- throw new Error(`Unsupported voice engine type: ${engineType}`);
34
- }
35
- }
36
- }
37
- //# sourceMappingURL=VoiceEngineFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VoiceEngineFactory.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/VoiceEngineFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,UAA2B;QAC1C,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,UAAU;gBACb,OAAO,IAAI,cAAc,EAAE,CAAC;YAC9B,KAAK,WAAW;gBACd,OAAO,IAAI,eAAe,EAAE,CAAC;YAC/B,KAAK,aAAa;gBAChB,OAAO,IAAI,iBAAiB,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,IAAI,YAAY,EAAE,CAAC;YAC5B,KAAK,WAAW;gBACd,OAAO,IAAI,eAAe,EAAE,CAAC;YAC/B,KAAK,MAAM;gBACT,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B;gBACE,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import { Talk } from '../../../types';
2
- import { VoiceEngine } from './VoiceEngine';
3
- /**
4
- * VoicePeak voice synthesis engine
5
- */
6
- export declare class VoicePeakEngine implements VoiceEngine {
7
- private apiEndpoint;
8
- fetchAudio(input: Talk, speaker: string): Promise<ArrayBuffer>;
9
- /**
10
- * Map emotion style to VoicePeak's emotion parameters
11
- */
12
- private mapEmotionStyle;
13
- getTestMessage(textVoiceText?: string): string;
14
- /**
15
- * Set custom API endpoint URL
16
- * @param apiUrl custom API endpoint URL
17
- */
18
- setApiEndpoint(apiUrl: string): void;
19
- }
@@ -1,58 +0,0 @@
1
- import { VOICEPEAK_API_URL } from '../../../constants';
2
- /**
3
- * VoicePeak voice synthesis engine
4
- */
5
- export class VoicePeakEngine {
6
- constructor() {
7
- this.apiEndpoint = VOICEPEAK_API_URL;
8
- }
9
- async fetchAudio(input, speaker) {
10
- const talk = input;
11
- const ttsQueryResponse = await fetch(`${this.apiEndpoint}/audio_query?speaker=${speaker}&text=${encodeURIComponent(talk.message)}`, { method: 'POST' });
12
- if (!ttsQueryResponse.ok) {
13
- throw new Error('Failed to fetch TTS query.');
14
- }
15
- const ttsQueryJson = await ttsQueryResponse.json();
16
- // set emotion from talk.style
17
- ttsQueryJson['emotion'] = this.mapEmotionStyle(talk.style || 'neutral');
18
- const synthesisResponse = await fetch(`${this.apiEndpoint}/synthesis?speaker=${speaker}`, {
19
- method: 'POST',
20
- headers: { 'Content-Type': 'application/json' },
21
- body: JSON.stringify(ttsQueryJson),
22
- });
23
- if (!synthesisResponse.ok) {
24
- throw new Error('Failed to fetch TTS synthesis result.');
25
- }
26
- const blob = await synthesisResponse.blob();
27
- return await blob.arrayBuffer();
28
- }
29
- /**
30
- * Map emotion style to VoicePeak's emotion parameters
31
- */
32
- mapEmotionStyle(style) {
33
- switch (style.toLowerCase()) {
34
- case 'happy':
35
- case 'fun':
36
- return 'happy';
37
- case 'angry':
38
- return 'angry';
39
- case 'sad':
40
- return 'sad';
41
- case 'surprised':
42
- return 'surprised';
43
- default:
44
- return 'neutral';
45
- }
46
- }
47
- getTestMessage(textVoiceText) {
48
- return textVoiceText || 'ボイスピークを使用します';
49
- }
50
- /**
51
- * Set custom API endpoint URL
52
- * @param apiUrl custom API endpoint URL
53
- */
54
- setApiEndpoint(apiUrl) {
55
- this.apiEndpoint = apiUrl;
56
- }
57
- }
58
- //# sourceMappingURL=VoicePeakEngine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VoicePeakEngine.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/VoicePeakEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;GAEG;AACH,MAAM,OAAO,eAAe;IAA5B;QACU,gBAAW,GAAW,iBAAiB,CAAC;IAkElD,CAAC;IAhEC,KAAK,CAAC,UAAU,CAAC,KAAW,EAAE,OAAe;QAC3C,MAAM,IAAI,GAAG,KAAa,CAAC;QAE3B,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAClC,GAAG,IAAI,CAAC,WAAW,wBAAwB,OAAO,SAAS,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAC7F,EAAE,MAAM,EAAE,MAAM,EAAE,CACnB,CAAC;QAEF,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;QAEnD,8BAA8B;QAC9B,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;QAExE,MAAM,iBAAiB,GAAG,MAAM,KAAK,CACnC,GAAG,IAAI,CAAC,WAAW,sBAAsB,OAAO,EAAE,EAClD;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;SACnC,CACF,CAAC;QAEF,IAAI,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAC5C,OAAO,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,KAAa;QACnC,QAAQ,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YAC5B,KAAK,OAAO,CAAC;YACb,KAAK,KAAK;gBACR,OAAO,OAAO,CAAC;YACjB,KAAK,OAAO;gBACV,OAAO,OAAO,CAAC;YACjB,KAAK,KAAK;gBACR,OAAO,KAAK,CAAC;YACf,KAAK,WAAW;gBACd,OAAO,WAAW,CAAC;YACrB;gBACE,OAAO,SAAS,CAAC;QACrB,CAAC;IACH,CAAC;IAED,cAAc,CAAC,aAAsB;QACnC,OAAO,aAAa,IAAI,cAAc,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,MAAc;QAC3B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import { Talk } from '../../../types';
2
- import { VoiceEngine } from './VoiceEngine';
3
- /**
4
- * VoiceVox voice synthesis engine
5
- */
6
- export declare class VoiceVoxEngine implements VoiceEngine {
7
- private apiEndpoint;
8
- fetchAudio(input: Talk, speaker: string): Promise<ArrayBuffer>;
9
- /**
10
- * Adjust parameters according to emotion
11
- */
12
- private adjustEmotionParameters;
13
- getTestMessage(textVoiceText?: string): string;
14
- /**
15
- * Set custom API endpoint URL
16
- * @param apiUrl custom API endpoint URL
17
- */
18
- setApiEndpoint(apiUrl: string): void;
19
- }
@@ -1,77 +0,0 @@
1
- import { VOICE_VOX_API_URL } from '../../../constants';
2
- /**
3
- * VoiceVox voice synthesis engine
4
- */
5
- export class VoiceVoxEngine {
6
- constructor() {
7
- this.apiEndpoint = VOICE_VOX_API_URL;
8
- }
9
- async fetchAudio(input, speaker) {
10
- const talk = input;
11
- // get emotion from talk.style
12
- const emotion = talk.style || 'neutral';
13
- const ttsQueryResponse = await fetch(`${this.apiEndpoint}/audio_query?speaker=${speaker}&text=${encodeURIComponent(talk.message)}`, { method: 'POST' });
14
- if (!ttsQueryResponse.ok) {
15
- throw new Error('Failed to fetch TTS query.');
16
- }
17
- const ttsQueryJson = await ttsQueryResponse.json();
18
- // adjust parameters according to emotion
19
- this.adjustEmotionParameters(ttsQueryJson, emotion);
20
- const synthesisResponse = await fetch(`${this.apiEndpoint}/synthesis?speaker=${speaker}`, {
21
- method: 'POST',
22
- headers: {
23
- 'Content-Type': 'application/json',
24
- 'Transfer-Encoding': 'chunked',
25
- },
26
- body: JSON.stringify(ttsQueryJson),
27
- });
28
- if (!synthesisResponse.ok) {
29
- throw new Error('Failed to fetch TTS synthesis result.');
30
- }
31
- const blob = await synthesisResponse.blob();
32
- return await blob.arrayBuffer();
33
- }
34
- /**
35
- * Adjust parameters according to emotion
36
- */
37
- adjustEmotionParameters(ttsQueryJson, emotion) {
38
- // default values
39
- ttsQueryJson.speedScale = 1.16;
40
- ttsQueryJson.pitchScale = -0.02;
41
- ttsQueryJson.intonationScale = 1.26;
42
- switch (emotion.toLowerCase()) {
43
- case 'happy':
44
- ttsQueryJson.speedScale = 1.25;
45
- ttsQueryJson.pitchScale = 0.05;
46
- ttsQueryJson.intonationScale = 1.4;
47
- break;
48
- case 'sad':
49
- ttsQueryJson.speedScale = 1.0;
50
- ttsQueryJson.pitchScale = -0.1;
51
- ttsQueryJson.intonationScale = 1.0;
52
- break;
53
- case 'angry':
54
- ttsQueryJson.speedScale = 1.2;
55
- ttsQueryJson.pitchScale = -0.05;
56
- ttsQueryJson.intonationScale = 1.5;
57
- break;
58
- case 'surprised':
59
- ttsQueryJson.speedScale = 1.3;
60
- ttsQueryJson.pitchScale = 0.1;
61
- ttsQueryJson.intonationScale = 1.4;
62
- break;
63
- // default: "neutral" etc. other than default values
64
- }
65
- }
66
- getTestMessage(textVoiceText) {
67
- return textVoiceText || 'ボイスボックスを使用します';
68
- }
69
- /**
70
- * Set custom API endpoint URL
71
- * @param apiUrl custom API endpoint URL
72
- */
73
- setApiEndpoint(apiUrl) {
74
- this.apiEndpoint = apiUrl;
75
- }
76
- }
77
- //# sourceMappingURL=VoiceVoxEngine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VoiceVoxEngine.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/VoiceVoxEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;GAEG;AACH,MAAM,OAAO,cAAc;IAA3B;QACU,gBAAW,GAAW,iBAAiB,CAAC;IAqFlD,CAAC;IAnFC,KAAK,CAAC,UAAU,CAAC,KAAW,EAAE,OAAe;QAC3C,MAAM,IAAI,GAAG,KAAa,CAAC;QAC3B,8BAA8B;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;QAExC,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAClC,GAAG,IAAI,CAAC,WAAW,wBAAwB,OAAO,SAAS,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAC7F,EAAE,MAAM,EAAE,MAAM,EAAE,CACnB,CAAC;QAEF,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;QACnD,yCAAyC;QACzC,IAAI,CAAC,uBAAuB,CAAC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,YAAY,CAAC,eAAe,GAAG,GAAG,CAAC;gBACnC,MAAM;YACR,KAAK,WAAW;gBACd,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC;gBAC9B,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC;gBAC9B,YAAY,CAAC,eAAe,GAAG,GAAG,CAAC;gBACnC,MAAM;YACR,oDAAoD;QACtD,CAAC;IACH,CAAC;IAED,cAAc,CAAC,aAAsB;QACnC,OAAO,aAAa,IAAI,eAAe,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,MAAc;QAC3B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- export type { VoiceEngine } from './VoiceEngine';
2
- export { VoiceEngineFactory } from './VoiceEngineFactory';
3
- export { VoiceVoxEngine } from './VoiceVoxEngine';
4
- export { VoicePeakEngine } from './VoicePeakEngine';
5
- export { AivisSpeechEngine } from './AivisSpeechEngine';
6
- export { OpenAiEngine } from './OpenAiEngine';
7
- export { NijiVoiceEngine } from './NijiVoiceEngine';
@@ -1,7 +0,0 @@
1
- export { VoiceEngineFactory } from './VoiceEngineFactory';
2
- export { VoiceVoxEngine } from './VoiceVoxEngine';
3
- export { VoicePeakEngine } from './VoicePeakEngine';
4
- export { AivisSpeechEngine } from './AivisSpeechEngine';
5
- export { OpenAiEngine } from './OpenAiEngine';
6
- export { NijiVoiceEngine } from './NijiVoiceEngine';
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { VoiceScreenplay } from '../../types';
2
- export declare const splitSentence: (text: string) => string[];
3
- export declare const textsToScreenplay: (texts: string[]) => VoiceScreenplay[];
@@ -1,43 +0,0 @@
1
- import { emotions } from '../../types';
2
- export const splitSentence = (text) => {
3
- const splitMessages = text.split(/(?<=[。.!?\n])/g);
4
- return splitMessages.filter((msg) => msg !== '');
5
- };
6
- export const textsToScreenplay = (texts) => {
7
- const screenplays = [];
8
- let prevExpression = 'neutral';
9
- for (let i = 0; i < texts.length; i++) {
10
- const text = texts[i];
11
- const match = text.match(/\[(.*?)\]/);
12
- const tag = match?.[1] || prevExpression;
13
- const message = text.replace(/\[(.*?)\]/g, '');
14
- let expression = prevExpression;
15
- if (emotions.includes(tag)) {
16
- expression = tag;
17
- prevExpression = tag;
18
- }
19
- screenplays.push({
20
- expression: expression,
21
- talk: {
22
- style: emotionToTalkStyle(expression),
23
- message: message,
24
- },
25
- });
26
- }
27
- return screenplays;
28
- };
29
- const emotionToTalkStyle = (emotion) => {
30
- switch (emotion) {
31
- case 'angry':
32
- return 'angry';
33
- case 'happy':
34
- return 'happy';
35
- case 'sad':
36
- return 'sad';
37
- case 'surprised':
38
- return 'surprised';
39
- default:
40
- return 'talk';
41
- }
42
- };
43
- //# sourceMappingURL=messages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/services/voice/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEhF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAY,EAAE;IACtD,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACnD,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EA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,MAAM,CAAC;IAClB,CAAC;AACH,CAAC,CAAC"}
@@ -1,27 +0,0 @@
1
- export interface VoiceActor {
2
- id: string;
3
- name: string;
4
- nameReading?: string;
5
- age?: number;
6
- gender: string;
7
- birthMonth?: number;
8
- birthDay?: number;
9
- smallImageUrl: string;
10
- mediumImageUrl: string;
11
- largeImageUrl: string;
12
- sampleVoiceUrl: string;
13
- sampleScript: string;
14
- recommendedVoiceSpeed: number;
15
- recommendedEmotionalLevel: number;
16
- recommendedSoundDuration: number;
17
- voiceStyles: Array<{
18
- id: number;
19
- style: string;
20
- }>;
21
- }
22
- export interface VoiceActorResponse {
23
- voice_actors: VoiceActor[];
24
- }
25
- export interface GeneratedVoiceResponse {
26
- audio_base64: string;
27
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=nijiVoice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nijiVoice.js","sourceRoot":"","sources":["../../src/types/nijiVoice.ts"],"names":[],"mappings":""}
@@ -1,35 +0,0 @@
1
- /**
2
- * Voice related type definitions
3
- */
4
- import { VRMExpressionPresetName } from '@pixiv/three-vrm';
5
- export declare const talkStyles: readonly ["talk", "happy", "sad", "angry", "surprised"];
6
- /**
7
- * TalkStyle - Style of speech for voice synthesis
8
- */
9
- export type TalkStyle = (typeof talkStyles)[number];
10
- /**
11
- * Talk - Set of message and talk style
12
- */
13
- export type Talk = {
14
- style: TalkStyle;
15
- message: string;
16
- };
17
- /**
18
- * Types of emotional expressions
19
- */
20
- export declare const emotions: readonly ["neutral", "happy", "angry", "sad", "surprised", "relaxed"];
21
- export type EmotionType = (typeof emotions)[number] & VRMExpressionPresetName;
22
- /**
23
- * Emotion types for VoicePeak
24
- */
25
- export type EmotionTypeForVoicepeak = 'happy' | 'fun' | 'angry' | 'sad' | 'neutral' | 'surprised';
26
- /**
27
- * Screenplay - Text with emotion expression
28
- * This has a different structure from the Screenplay type in chat.ts.
29
- * Be careful of name conflicts when importing both types.
30
- * Example: import { Screenplay as VoiceScreenplay } from '../types/voice';
31
- */
32
- export type Screenplay = {
33
- expression: EmotionType;
34
- talk: Talk;
35
- };
@@ -1,19 +0,0 @@
1
- export const talkStyles = [
2
- 'talk',
3
- 'happy',
4
- 'sad',
5
- 'angry',
6
- 'surprised',
7
- ];
8
- /**
9
- * Types of emotional expressions
10
- */
11
- export const emotions = [
12
- 'neutral',
13
- 'happy',
14
- 'angry',
15
- 'sad',
16
- 'surprised',
17
- 'relaxed',
18
- ];
19
- //# sourceMappingURL=voice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"voice.js","sourceRoot":"","sources":["../../src/types/voice.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;IACP,WAAW;CACH,CAAC;AAeX;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,SAAS;IACT,OAAO;IACP,OAAO;IACP,KAAK;IACL,WAAW;IACX,SAAS;CACD,CAAC"}
@@ -1 +0,0 @@
1
- export type VoiceEngineType = 'voicevox' | 'voicepeak' | 'openai' | 'nijivoice' | 'aivisSpeech' | 'none';
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=voiceEngine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"voiceEngine.js","sourceRoot":"","sources":["../../src/types/voiceEngine.ts"],"names":[],"mappings":""}