@wu529778790/open-im 1.11.4-beta.1 → 1.11.4-beta.11
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
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/clawbot/client.js
CHANGED
|
@@ -132,6 +132,10 @@ function startPolling() {
|
|
|
132
132
|
cacheContextToken(chatId, msg.context_token);
|
|
133
133
|
setClawbotContextToken(msg.context_token);
|
|
134
134
|
}
|
|
135
|
+
// Debug: log raw item_list for image messages
|
|
136
|
+
if (extracted === '[图片]') {
|
|
137
|
+
log.info(`Image message raw item_list: ${JSON.stringify(msg.item_list).substring(0, 500)}`);
|
|
138
|
+
}
|
|
135
139
|
// Extract and download images from message
|
|
136
140
|
const imagePaths = await extractImages(msg);
|
|
137
141
|
userMessages.push({ chatId, msgId, content: extracted, imagePaths: imagePaths.length > 0 ? imagePaths : undefined });
|
|
@@ -247,11 +251,15 @@ async function extractImages(msg) {
|
|
|
247
251
|
return [];
|
|
248
252
|
const paths = [];
|
|
249
253
|
for (const item of msg.item_list) {
|
|
254
|
+
// 调试:记录所有 item 类型
|
|
255
|
+
log.info(`Item type=${item.type}, has image_item=${!!item.image_item}, has media=${!!item.image_item?.media}, has cdn_url=${!!item.image_item?.media?.cdn_url}`);
|
|
250
256
|
if (item.type !== 2 /* MessageItemType.IMAGE */)
|
|
251
257
|
continue;
|
|
252
258
|
const media = item.image_item?.media;
|
|
253
|
-
if (!media?.cdn_url)
|
|
259
|
+
if (!media?.cdn_url) {
|
|
260
|
+
log.warn(`Image item missing cdn_url: ${JSON.stringify(item.image_item).substring(0, 200)}`);
|
|
254
261
|
continue;
|
|
262
|
+
}
|
|
255
263
|
try {
|
|
256
264
|
// Download from CDN
|
|
257
265
|
const response = await fetch(media.cdn_url, { signal: AbortSignal.timeout(30_000) });
|
|
@@ -23,10 +23,8 @@ export function setupClawbotHandlers(config, sessionManager) {
|
|
|
23
23
|
});
|
|
24
24
|
const stopTaskCleanup = startTaskCleanup(ctx.runningTasks);
|
|
25
25
|
const platformSender = {
|
|
26
|
-
sendThinkingMessage: async (
|
|
27
|
-
|
|
28
|
-
await sendTextReply(chatId, '🤔 正在处理...');
|
|
29
|
-
return 'clawbot_thinking';
|
|
26
|
+
sendThinkingMessage: async (_chatId, _replyToMessageId, _toolId) => {
|
|
27
|
+
return 'clawbot_no_thinking';
|
|
30
28
|
},
|
|
31
29
|
sendTextReply: async (chatId, text) => {
|
|
32
30
|
await sendTextReply(chatId, text);
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { randomBytes } from 'node:crypto';
|
|
7
7
|
import { createLogger } from '../logger.js';
|
|
8
|
-
import {
|
|
9
|
-
import { MAX_CLAWBOT_MESSAGE_LENGTH } from '../constants.js';
|
|
8
|
+
import { toReplyPlainText } from '../shared/utils.js';
|
|
10
9
|
import { getChannelState } from './client.js';
|
|
11
10
|
import { getActiveChatId, getClawbotContextToken } from '../shared/active-chats.js';
|
|
12
11
|
const log = createLogger('ClawBotSender');
|
|
@@ -94,20 +93,9 @@ async function postMessage(chatId, text, contextToken) {
|
|
|
94
93
|
*/
|
|
95
94
|
export async function sendTextReply(chatId, text, contextToken) {
|
|
96
95
|
const plainText = toReplyPlainText(text);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
await postMessage(chatId, plainText, contextToken);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
log.info(`Sending ClawBot reply in ${parts.length} parts to chatId=${chatId}, totalLen=${plainText.length}`);
|
|
104
|
-
for (let i = 0; i < parts.length; i++) {
|
|
105
|
-
const partText = i === 0
|
|
106
|
-
? `${parts[i]}\n\n_(1/${parts.length})_`
|
|
107
|
-
: `_(续 ${i + 1}/${parts.length})_\n\n${parts[i]}`;
|
|
108
|
-
await postMessage(chatId, partText, contextToken);
|
|
109
|
-
log.info(`ClawBot part ${i + 1}/${parts.length} sent`);
|
|
110
|
-
}
|
|
96
|
+
// 发送文字消息
|
|
97
|
+
log.info(`Sending ClawBot reply to chatId=${chatId}, len=${plainText.length}`);
|
|
98
|
+
await postMessage(chatId, plainText, contextToken);
|
|
111
99
|
}
|
|
112
100
|
/**
|
|
113
101
|
* Send error reply to a ClawBot chat.
|
|
@@ -26,10 +26,8 @@ export function setupWorkBuddyHandlers(config, sessionManager) {
|
|
|
26
26
|
const stopTaskCleanup = startTaskCleanup(ctx.runningTasks);
|
|
27
27
|
// WorkBuddy-specific sender callbacks
|
|
28
28
|
const platformSender = {
|
|
29
|
-
sendThinkingMessage: async (
|
|
30
|
-
|
|
31
|
-
await sendTextReply(null, chatId, '🤔 正在处理...', '');
|
|
32
|
-
return 'workbuddy_thinking';
|
|
29
|
+
sendThinkingMessage: async (_chatId, _replyToMessageId, _toolId) => {
|
|
30
|
+
return 'workbuddy_no_thinking';
|
|
33
31
|
},
|
|
34
32
|
sendTextReply: async (chatId, text) => {
|
|
35
33
|
await sendTextReply(null, chatId, text, '');
|
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.11",
|
|
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",
|
|
@@ -58,9 +58,13 @@
|
|
|
58
58
|
"@sentry/node": "^10.58.0",
|
|
59
59
|
"centrifuge": "^5.5.3",
|
|
60
60
|
"dingtalk-stream": "^2.1.4",
|
|
61
|
+
"edge-tts": "^1.0.1",
|
|
62
|
+
"https-proxy-agent": "^9.1.0",
|
|
63
|
+
"node-edge-tts": "^1.2.10",
|
|
61
64
|
"prompts": "^2.4.2",
|
|
65
|
+
"say": "^0.16.0",
|
|
62
66
|
"telegraf": "^4.16.3",
|
|
63
|
-
"ws": "^8.
|
|
67
|
+
"ws": "^8.21.0"
|
|
64
68
|
},
|
|
65
69
|
"devDependencies": {
|
|
66
70
|
"@eslint/js": "^9.15.0",
|