claw-subagent-service 0.0.100 → 0.0.101
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
CHANGED
|
@@ -507,33 +507,74 @@ class MessageHandler {
|
|
|
507
507
|
|
|
508
508
|
// 图片消息
|
|
509
509
|
if (msgType === 'RC:ImgMsg') {
|
|
510
|
-
|
|
510
|
+
// content 可能是对象(包含 imageUri)或字符串(base64 缩略图)
|
|
511
|
+
let imageUri = '';
|
|
512
|
+
|
|
513
|
+
if (typeof content === 'string') {
|
|
514
|
+
// content 是 base64 缩略图,需要查找其他字段获取 URL
|
|
515
|
+
imageUri = msg.imageUri || msg.imageUrl || msg.url || msg.localPath || '';
|
|
516
|
+
} else if (typeof content === 'object' && content !== null) {
|
|
517
|
+
// content 是对象,包含 imageUri
|
|
518
|
+
imageUri = content.imageUri || content.imageUrl || content.url || '';
|
|
519
|
+
}
|
|
520
|
+
|
|
511
521
|
this.log?.info(`[_extractMessageContent] 图片消息: imageUri=${imageUri}`);
|
|
522
|
+
|
|
523
|
+
if (!imageUri) {
|
|
524
|
+
return '[图片](无法获取图片地址)';
|
|
525
|
+
}
|
|
526
|
+
|
|
512
527
|
return `[图片] ${imageUri}`;
|
|
513
528
|
}
|
|
514
529
|
|
|
515
530
|
// 视频消息
|
|
516
531
|
if (msgType === 'RC:SightMsg') {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
532
|
+
let sightUrl = '';
|
|
533
|
+
let name = '未知视频';
|
|
534
|
+
let duration = 0;
|
|
535
|
+
|
|
536
|
+
if (typeof content === 'object' && content !== null) {
|
|
537
|
+
sightUrl = content.sightUrl || content.url || '';
|
|
538
|
+
name = content.name || '未知视频';
|
|
539
|
+
duration = content.duration || 0;
|
|
540
|
+
} else {
|
|
541
|
+
sightUrl = msg.sightUrl || msg.url || msg.localPath || '';
|
|
542
|
+
}
|
|
543
|
+
|
|
520
544
|
this.log?.info(`[_extractMessageContent] 视频消息: sightUrl=${sightUrl}`);
|
|
521
545
|
return `[视频] ${sightUrl} ${name} ${duration}秒`;
|
|
522
546
|
}
|
|
523
547
|
|
|
524
548
|
// 文件消息
|
|
525
549
|
if (msgType === 'RC:FileMsg') {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
550
|
+
let fileUrl = '';
|
|
551
|
+
let name = '未知文件';
|
|
552
|
+
let size = 0;
|
|
553
|
+
|
|
554
|
+
if (typeof content === 'object' && content !== null) {
|
|
555
|
+
fileUrl = content.fileUrl || content.fileUri || content.url || '';
|
|
556
|
+
name = content.name || '未知文件';
|
|
557
|
+
size = content.size || 0;
|
|
558
|
+
} else {
|
|
559
|
+
fileUrl = msg.fileUrl || msg.fileUri || msg.url || msg.localPath || '';
|
|
560
|
+
}
|
|
561
|
+
|
|
529
562
|
this.log?.info(`[_extractMessageContent] 文件消息: fileUrl=${fileUrl}`);
|
|
530
563
|
return `[文件] ${fileUrl} ${name} ${size}`;
|
|
531
564
|
}
|
|
532
565
|
|
|
533
566
|
// 语音消息
|
|
534
567
|
if (msgType === 'RC:HQVCMsg') {
|
|
535
|
-
|
|
536
|
-
|
|
568
|
+
let remoteUrl = '';
|
|
569
|
+
let duration = 0;
|
|
570
|
+
|
|
571
|
+
if (typeof content === 'object' && content !== null) {
|
|
572
|
+
remoteUrl = content.remoteUrl || content.url || '';
|
|
573
|
+
duration = content.duration || 0;
|
|
574
|
+
} else {
|
|
575
|
+
remoteUrl = msg.remoteUrl || msg.url || msg.localPath || '';
|
|
576
|
+
}
|
|
577
|
+
|
|
537
578
|
this.log?.info(`[_extractMessageContent] 语音消息: remoteUrl=${remoteUrl}`);
|
|
538
579
|
return `[语音] ${remoteUrl} ${duration}秒`;
|
|
539
580
|
}
|