@wu529778790/open-im 1.8.3-beta.11 → 1.8.3-beta.12
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.
|
@@ -145,20 +145,20 @@ export class WorkBuddyCentrifugeClient {
|
|
|
145
145
|
// WeChat KF messages: send via HTTP COPILOT_RESPONSE
|
|
146
146
|
if (this.config.httpBaseUrl && this.config.httpAccessToken) {
|
|
147
147
|
const message = payload.content?.map((c) => c.text).join('') || payload.error || '';
|
|
148
|
-
// chatId format: "<
|
|
149
|
-
//
|
|
148
|
+
// Incoming chatId format: "<wechatExternalUserId>::origin::wechatkfProxy"
|
|
149
|
+
// Server requires chatId = just the WeChat external user ID (the part before "::").
|
|
150
150
|
const chatIdFull = payload.session_id;
|
|
151
|
-
const
|
|
151
|
+
const chatId = chatIdFull.includes('::') ? chatIdFull.split('::')[0] : chatIdFull;
|
|
152
152
|
const httpPayload = {
|
|
153
153
|
type: 'COPILOT_RESPONSE',
|
|
154
154
|
msgId: payload.prompt_id,
|
|
155
|
-
chatId
|
|
156
|
-
toUser,
|
|
155
|
+
chatId, // WeChat external user ID only — server uses this as touser
|
|
157
156
|
success: payload.stop_reason === 'end_turn',
|
|
158
157
|
message,
|
|
159
158
|
metadata: {
|
|
160
159
|
sessionId: this.config.workspaceSessionId || payload.session_id,
|
|
161
|
-
|
|
160
|
+
requestId: payload.prompt_id,
|
|
161
|
+
state: payload.stop_reason === 'end_turn' ? 'completed' : payload.stop_reason,
|
|
162
162
|
},
|
|
163
163
|
};
|
|
164
164
|
const url = `${this.config.httpBaseUrl}/v2/backgroundagent/wecom/local-proxy/receive`;
|