@wu529778790/open-im 1.11.4-beta.6 → 1.11.4-beta.8
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/README.md +21 -0
- package/dist/shared/tts.d.ts +1 -1
- package/dist/shared/tts.js +16 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -137,6 +137,27 @@ claude -c # 接上手机端的对话
|
|
|
137
137
|
}
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
### 语音回复(可选)
|
|
141
|
+
|
|
142
|
+
ClawBot 支持语音回复,需要 Python 3 + edge-tts:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# 安装依赖
|
|
146
|
+
pip3 install edge-tts
|
|
147
|
+
|
|
148
|
+
# 启用语音
|
|
149
|
+
# 在管理页面 http://127.0.0.1:39282 打开 ClawBot 的「语音回复」开关
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
支持的中文声音:
|
|
153
|
+
- 晓晓(女声,温柔)
|
|
154
|
+
- 晓伊(女声,活泼)
|
|
155
|
+
- 云希(男声,年轻)
|
|
156
|
+
- 云健(男声,沉稳)
|
|
157
|
+
- 云扬(男声,专业)
|
|
158
|
+
|
|
159
|
+
> 不安装 Python 也能正常使用 open-im,语音回复是可选功能。
|
|
160
|
+
|
|
140
161
|
### 环境变量
|
|
141
162
|
|
|
142
163
|
- **`ANTHROPIC_*`** — Claude API 配置
|
package/dist/shared/tts.d.ts
CHANGED
package/dist/shared/tts.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TTS (Text-to-Speech) 模块
|
|
3
|
-
* 使用
|
|
3
|
+
* 使用 Python edge-tts 生成语音(微软 Edge TTS)
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { execFile } from 'node:child_process';
|
|
6
6
|
import { createLogger } from '../logger.js';
|
|
7
7
|
import { mkdirSync, existsSync } from 'node:fs';
|
|
8
8
|
import { join } from 'node:path';
|
|
@@ -12,7 +12,7 @@ const log = createLogger('TTS');
|
|
|
12
12
|
/** 默认配置 */
|
|
13
13
|
const DEFAULT_TTS_CONFIG = {
|
|
14
14
|
enabled: false,
|
|
15
|
-
voice: 'zh',
|
|
15
|
+
voice: 'zh-CN-XiaoxiaoNeural',
|
|
16
16
|
};
|
|
17
17
|
let config = DEFAULT_TTS_CONFIG;
|
|
18
18
|
/**
|
|
@@ -21,7 +21,7 @@ let config = DEFAULT_TTS_CONFIG;
|
|
|
21
21
|
export function initTTS(cfg) {
|
|
22
22
|
config = { ...DEFAULT_TTS_CONFIG, ...cfg };
|
|
23
23
|
if (config.enabled) {
|
|
24
|
-
log.info(`TTS enabled,
|
|
24
|
+
log.info(`TTS enabled, voice: ${config.voice}`);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -56,9 +56,18 @@ export async function textToSpeech(text) {
|
|
|
56
56
|
mkdirSync(audioDir, { recursive: true });
|
|
57
57
|
}
|
|
58
58
|
const audioPath = join(audioDir, `tts-${randomBytes(8).toString('hex')}.mp3`);
|
|
59
|
-
// 调用
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
// 调用 Python edge-tts
|
|
60
|
+
await new Promise((resolve, reject) => {
|
|
61
|
+
execFile('python3', ['-m', 'edge_tts', '--voice', config.voice, '--text', cleanText, '--write-media', audioPath], { timeout: 30000 }, (error, stdout, stderr) => {
|
|
62
|
+
if (error) {
|
|
63
|
+
log.error('TTS exec failed:', error.message);
|
|
64
|
+
reject(error);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
resolve();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
62
71
|
log.info(`TTS generated: ${audioPath}`);
|
|
63
72
|
return audioPath;
|
|
64
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wu529778790/open-im",
|
|
3
|
-
"version": "1.11.4-beta.
|
|
3
|
+
"version": "1.11.4-beta.8",
|
|
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",
|