@xgjktech/xg_cwork_im 1.10.2 → 1.10.3
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/package.json +1 -1
- package/src/channel.ts +8 -9
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -257,8 +257,7 @@ function buildInboundDisplayText(msgContent: WsMessageContent | undefined, fileI
|
|
|
257
257
|
if (fileItems.length > 0) {
|
|
258
258
|
const lines = fileItems.map((f) => {
|
|
259
259
|
const name = f.name?.trim() || f.fileId || "未命名文件";
|
|
260
|
-
|
|
261
|
-
return mime ? `- \`${name}\` (${mime})` : `- \`${name}\``;
|
|
260
|
+
return `- \`${name}\``;
|
|
262
261
|
});
|
|
263
262
|
const block = `**附件(${fileItems.length})**\n${lines.join("\n")}`;
|
|
264
263
|
rawText = rawText.trim() ? `${rawText.trim()}\n\n${block}` : block;
|
|
@@ -275,6 +274,11 @@ function buildInboundDisplayText(msgContent: WsMessageContent | undefined, fileI
|
|
|
275
274
|
const parsedBlock = `**附件解析内容**\n\n${parsedParts.join("\n\n")}`;
|
|
276
275
|
rawText = `${rawText.trim()}\n\n${parsedBlock}`;
|
|
277
276
|
}
|
|
277
|
+
|
|
278
|
+
const urlGuard =
|
|
279
|
+
"**附件 URL 使用约束**\n" +
|
|
280
|
+
"处理附件时必须逐字原样使用消息中提供的完整 URL;禁止修改、删除或重排任何 query 参数。";
|
|
281
|
+
rawText = `${rawText.trim()}\n\n${urlGuard}`;
|
|
278
282
|
}
|
|
279
283
|
return rawText;
|
|
280
284
|
}
|
|
@@ -297,20 +301,15 @@ function isActuallyMentioned(
|
|
|
297
301
|
|
|
298
302
|
function mediaFieldsFromFileItems(fileItems: MsgFileVO[]): Record<string, unknown> {
|
|
299
303
|
if (fileItems.length === 0) return {};
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
);
|
|
303
|
-
// OpenClaw 入站展示与媒体拉取以 MediaPath(s) 为准;[media attached: …] 依赖 Path,仅写 MediaUrl 时该段不出现。
|
|
304
|
-
// 不要同时写 Path 与 Url(同链接会被拼成两段,出现 `url | url`)。
|
|
304
|
+
// 只传 MediaPath(s),不传 MediaType(s)。
|
|
305
|
+
// 预签名 URL 的 query 中常含 response-content-type;若额外给 MediaType,模型/工具更容易“改写 URL”导致签名失效。
|
|
305
306
|
if (fileItems.length === 1) {
|
|
306
307
|
return {
|
|
307
308
|
MediaPath: fileItems[0]!.url,
|
|
308
|
-
MediaType: mimes[0],
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
return {
|
|
312
312
|
MediaPaths: fileItems.map((f) => f.url),
|
|
313
|
-
MediaTypes: mimes,
|
|
314
313
|
};
|
|
315
314
|
}
|
|
316
315
|
|