palz-connector 1.2.3 → 1.2.5
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/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/bot.ts +1 -0
- package/src/reply-dispatcher.ts +3 -0
- package/src/send.ts +5 -1
- package/src/types.ts +4 -0
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -400,6 +400,7 @@ async function dispatchPalzMessage(params: HandlePalzMessageParams): Promise<voi
|
|
|
400
400
|
conversationType: msg.conversation_type || "direct",
|
|
401
401
|
enableStreaming: useStream,
|
|
402
402
|
msgId: msg.msg_id,
|
|
403
|
+
msgType: msg.msg_type,
|
|
403
404
|
});
|
|
404
405
|
|
|
405
406
|
// STEP 6d: 分发消息给 AI
|
package/src/reply-dispatcher.ts
CHANGED
|
@@ -41,6 +41,7 @@ export interface CreatePalzReplyDispatcherParams {
|
|
|
41
41
|
conversationType: string;
|
|
42
42
|
enableStreaming: boolean;
|
|
43
43
|
msgId: string;
|
|
44
|
+
msgType?: string;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export function createPalzReplyDispatcher(params: CreatePalzReplyDispatcherParams) {
|
|
@@ -55,6 +56,7 @@ export function createPalzReplyDispatcher(params: CreatePalzReplyDispatcherParam
|
|
|
55
56
|
conversationType,
|
|
56
57
|
enableStreaming,
|
|
57
58
|
msgId,
|
|
59
|
+
msgType,
|
|
58
60
|
} = params;
|
|
59
61
|
|
|
60
62
|
const log = typeof runtime?.log === "function" ? runtime.log : console.log;
|
|
@@ -84,6 +86,7 @@ export function createPalzReplyDispatcher(params: CreatePalzReplyDispatcherParam
|
|
|
84
86
|
msgId,
|
|
85
87
|
senderId,
|
|
86
88
|
stream: streamOpts,
|
|
89
|
+
msgType,
|
|
87
90
|
});
|
|
88
91
|
log(`${tag}: [DISPATCHER←sendToIM] 输出: ${JSON.stringify(result)}`);
|
|
89
92
|
return result;
|
package/src/send.ts
CHANGED
|
@@ -14,7 +14,7 @@ function nextMsgId(): string {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export async function sendToPalzIM(params: SendToIMParams): Promise<any> {
|
|
17
|
-
const { config, conversationId, content, conversationType, msgId, senderId, stream } = params;
|
|
17
|
+
const { config, conversationId, content, conversationType, msgId, senderId, stream, msgType } = params;
|
|
18
18
|
const url = `${config.apiBaseUrl}/bot/send`;
|
|
19
19
|
const resolvedMsgId = msgId || nextMsgId();
|
|
20
20
|
|
|
@@ -30,6 +30,10 @@ export async function sendToPalzIM(params: SendToIMParams): Promise<any> {
|
|
|
30
30
|
reqBody.sender_id = senderId;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
if (msgType) {
|
|
34
|
+
reqBody.msg_type = msgType;
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
if (stream) {
|
|
34
38
|
reqBody.stream_id = stream.streamId;
|
|
35
39
|
reqBody.seq = stream.seq;
|
package/src/types.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface PalzMessageEvent {
|
|
|
29
29
|
agent_id?: string;
|
|
30
30
|
/** 群聊中是否 @了机器人 */
|
|
31
31
|
mentioned_bot?: boolean;
|
|
32
|
+
/** 可选,IM 下发的消息类型,回复时原样透传 */
|
|
33
|
+
msg_type?: string;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
// ============ 配置 ============
|
|
@@ -74,4 +76,6 @@ export interface SendToIMParams {
|
|
|
74
76
|
msgId?: string;
|
|
75
77
|
senderId?: string;
|
|
76
78
|
stream?: StreamChunkOpts;
|
|
79
|
+
/** IM 下发的消息类型,回复时原样透传 */
|
|
80
|
+
msgType?: string;
|
|
77
81
|
}
|