@wu529778790/open-im 1.11.3-beta.1 → 1.11.3-beta.2
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.
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { WorkBuddyCentrifugeClient } from './centrifuge-client.js';
|
|
5
5
|
/**
|
|
6
|
-
* Send text reply to WeChat KF
|
|
6
|
+
* Send text reply to WeChat KF.
|
|
7
|
+
* 不拆分消息,直接发送完整内容(微信客服会自动截断过长的消息)
|
|
7
8
|
*/
|
|
8
9
|
export declare function sendTextReply(_client: WorkBuddyCentrifugeClient | null, chatId: string, text: string, msgId: string): Promise<void>;
|
|
9
10
|
/**
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WorkBuddy Message Sender - Send responses to WeChat KF
|
|
3
3
|
*/
|
|
4
|
-
import { randomUUID } from 'node:crypto';
|
|
5
4
|
import { createLogger } from '../logger.js';
|
|
6
|
-
import {
|
|
7
|
-
import { MAX_WORKBUDDY_MESSAGE_LENGTH } from '../constants.js';
|
|
5
|
+
import { toReplyPlainText } from '../shared/utils.js';
|
|
8
6
|
import { getCentrifugeClient } from './client.js';
|
|
9
7
|
const log = createLogger('WorkBuddySender');
|
|
10
8
|
/**
|
|
11
|
-
* Send text reply to WeChat KF
|
|
9
|
+
* Send text reply to WeChat KF.
|
|
10
|
+
* 不拆分消息,直接发送完整内容(微信客服会自动截断过长的消息)
|
|
12
11
|
*/
|
|
13
12
|
export async function sendTextReply(_client, chatId, text, msgId) {
|
|
14
13
|
const client = _client ?? getCentrifugeClient();
|
|
@@ -17,31 +16,13 @@ export async function sendTextReply(_client, chatId, text, msgId) {
|
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
const plainText = toReplyPlainText(text);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
stop_reason: 'end_turn',
|
|
28
|
-
});
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
log.info(`Sending WorkBuddy reply in ${parts.length} parts to chatId=${chatId}, msgId=${msgId}, totalLen=${plainText.length}`);
|
|
32
|
-
for (let i = 0; i < parts.length; i++) {
|
|
33
|
-
const partText = i === 0
|
|
34
|
-
? `${parts[i]}\n\n_(1/${parts.length})_`
|
|
35
|
-
: `_(续 ${i + 1}/${parts.length})_\n\n${parts[i]}`;
|
|
36
|
-
const partMsgId = i === 0 ? msgId : randomUUID();
|
|
37
|
-
await client.sendPromptResponse({
|
|
38
|
-
session_id: chatId,
|
|
39
|
-
prompt_id: partMsgId,
|
|
40
|
-
content: [{ type: 'text', text: partText }],
|
|
41
|
-
stop_reason: 'end_turn',
|
|
42
|
-
});
|
|
43
|
-
log.info(`WorkBuddy part ${i + 1}/${parts.length} sent, msgId=${partMsgId}`);
|
|
44
|
-
}
|
|
19
|
+
log.info(`Sending WorkBuddy reply to chatId=${chatId}, msgId=${msgId}, len=${plainText.length}`);
|
|
20
|
+
await client.sendPromptResponse({
|
|
21
|
+
session_id: chatId,
|
|
22
|
+
prompt_id: msgId,
|
|
23
|
+
content: [{ type: 'text', text: plainText }],
|
|
24
|
+
stop_reason: 'end_turn',
|
|
25
|
+
});
|
|
45
26
|
}
|
|
46
27
|
/**
|
|
47
28
|
* Send error response to WeChat KF
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wu529778790/open-im",
|
|
3
|
-
"version": "1.11.3-beta.
|
|
3
|
+
"version": "1.11.3-beta.2",
|
|
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",
|