@ynhcj/xiaoyi-channel 0.0.31-next → 0.0.32-next
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/dist/src/bot.js +11 -13
- package/package.json +1 -1
package/dist/src/bot.js
CHANGED
|
@@ -2,7 +2,6 @@ import { getXYRuntime } from "./runtime.js";
|
|
|
2
2
|
import { setCachedContext } from "./steer-injector.js";
|
|
3
3
|
import { createXYReplyDispatcher } from "./reply-dispatcher.js";
|
|
4
4
|
import { parseA2AMessage, extractTextFromParts, extractFileParts, extractPushId, extractTriggerData } from "./parser.js";
|
|
5
|
-
import { downloadFilesFromParts } from "./file-download.js";
|
|
6
5
|
import { resolveXYConfig } from "./config.js";
|
|
7
6
|
import { sendStatusUpdate, sendClearContextResponse, sendTasksCancelResponse, sendA2AResponse } from "./formatter.js";
|
|
8
7
|
import { registerSession, unregisterSession, runWithSessionContext } from "./tools/session-manager.js";
|
|
@@ -162,9 +161,8 @@ export async function handleXYMessage(params) {
|
|
|
162
161
|
// Extract text and files from parts
|
|
163
162
|
const text = extractTextFromParts(parsed.parts);
|
|
164
163
|
const fileParts = extractFileParts(parsed.parts);
|
|
165
|
-
//
|
|
166
|
-
const
|
|
167
|
-
const mediaPayload = buildXYMediaPayload(downloadedFiles);
|
|
164
|
+
// Build media payload directly from file URLs (no local download needed)
|
|
165
|
+
const mediaPayload = buildXYMediaPayload(fileParts);
|
|
168
166
|
// Resolve envelope format options (following feishu pattern)
|
|
169
167
|
const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(cfg);
|
|
170
168
|
// Build message body with speaker prefix (following feishu pattern)
|
|
@@ -296,19 +294,19 @@ export async function handleXYMessage(params) {
|
|
|
296
294
|
}
|
|
297
295
|
}
|
|
298
296
|
/**
|
|
299
|
-
* Build media payload for inbound context.
|
|
300
|
-
*
|
|
297
|
+
* Build media payload for inbound context using file URLs.
|
|
298
|
+
* OpenClaw natively supports MediaUrl/MediaUrls — no local download needed.
|
|
301
299
|
*
|
|
302
|
-
* @param
|
|
300
|
+
* @param fileParts - File parts extracted from A2A message (with uri field)
|
|
303
301
|
*/
|
|
304
|
-
function buildXYMediaPayload(
|
|
305
|
-
const first =
|
|
306
|
-
const
|
|
307
|
-
const mediaTypes =
|
|
302
|
+
function buildXYMediaPayload(fileParts) {
|
|
303
|
+
const first = fileParts[0];
|
|
304
|
+
const mediaUrls = fileParts.map((f) => f.uri);
|
|
305
|
+
const mediaTypes = fileParts.map((f) => f.mimeType).filter(Boolean);
|
|
308
306
|
return {
|
|
309
|
-
|
|
307
|
+
MediaUrl: first?.uri,
|
|
310
308
|
MediaType: first?.mimeType,
|
|
311
|
-
|
|
309
|
+
MediaUrls: mediaUrls.length > 0 ? mediaUrls : undefined,
|
|
312
310
|
MediaTypes: mediaTypes.length > 0 ? mediaTypes : undefined,
|
|
313
311
|
};
|
|
314
312
|
}
|