@wu529778790/open-im 1.11.4-beta.5 → 1.11.4-beta.6

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.
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ const PLATFORM_MODULES = {
108
108
  const { initTTS } = await import('./shared/tts.js');
109
109
  initTTS({
110
110
  enabled: pc.tts?.enabled ?? false,
111
- voice: pc.tts?.voice ?? 'zh-CN-XiaoxiaoNeural',
111
+ voice: pc.tts?.voice ?? 'zh',
112
112
  });
113
113
  }
114
114
  const handle = setupClawbotHandlers(config, sessionManager);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TTS (Text-to-Speech) 模块
3
- * 使用 edge-tts-node 调用微软 Edge TTS 服务
3
+ * 使用 gTTS(Google Text-to-Speech)生成语音
4
4
  */
5
5
  /** TTS 配置 */
6
6
  export interface TTSConfig {
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * TTS (Text-to-Speech) 模块
3
- * 使用 edge-tts-node 调用微软 Edge TTS 服务
3
+ * 使用 gTTS(Google Text-to-Speech)生成语音
4
4
  */
5
- import { MsEdgeTTS, OUTPUT_FORMAT } from 'edge-tts-node';
5
+ import gTTS from 'gtts';
6
6
  import { createLogger } from '../logger.js';
7
7
  import { mkdirSync, existsSync } from 'node:fs';
8
8
  import { join } from 'node:path';
@@ -12,18 +12,16 @@ const log = createLogger('TTS');
12
12
  /** 默认配置 */
13
13
  const DEFAULT_TTS_CONFIG = {
14
14
  enabled: false,
15
- voice: 'zh-CN-XiaoxiaoNeural',
15
+ voice: 'zh',
16
16
  };
17
17
  let config = DEFAULT_TTS_CONFIG;
18
- let tts = null;
19
18
  /**
20
19
  * 初始化 TTS
21
20
  */
22
21
  export function initTTS(cfg) {
23
22
  config = { ...DEFAULT_TTS_CONFIG, ...cfg };
24
23
  if (config.enabled) {
25
- tts = new MsEdgeTTS({ enableLogger: false });
26
- log.info(`TTS enabled, voice: ${config.voice}`);
24
+ log.info(`TTS enabled, language: ${config.voice}`);
27
25
  }
28
26
  }
29
27
  /**
@@ -37,7 +35,7 @@ export function getTTSConfig() {
37
35
  * @returns 音频文件路径
38
36
  */
39
37
  export async function textToSpeech(text) {
40
- if (!config.enabled || !tts) {
38
+ if (!config.enabled) {
41
39
  return null;
42
40
  }
43
41
  try {
@@ -58,10 +56,9 @@ export async function textToSpeech(text) {
58
56
  mkdirSync(audioDir, { recursive: true });
59
57
  }
60
58
  const audioPath = join(audioDir, `tts-${randomBytes(8).toString('hex')}.mp3`);
61
- // 设置 TTS 元数据
62
- await tts.setMetadata(config.voice, OUTPUT_FORMAT.AUDIO_24KHZ_96KBITRATE_MONO_MP3);
63
- // 调用 TTS
64
- await tts.toFile(audioPath, cleanText);
59
+ // 调用 gTTS
60
+ const tts = new gTTS(cleanText, config.voice);
61
+ await tts.save(audioPath);
65
62
  log.info(`TTS generated: ${audioPath}`);
66
63
  return audioPath;
67
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.11.4-beta.5",
3
+ "version": "1.11.4-beta.6",
4
4
  "description": "Your AI coding assistant, in every chat app. Multi-platform IM bridge for Claude Code, Codex, and CodeBuddy.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",