claw-subagent-service 0.0.99 → 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
|
@@ -497,6 +497,9 @@ class MessageHandler {
|
|
|
497
497
|
const msgType = msg.messageType;
|
|
498
498
|
const content = msg.content;
|
|
499
499
|
|
|
500
|
+
// 调试:打印完整消息内容
|
|
501
|
+
this.log?.info(`[_extractMessageContent] msgType=${msgType}, content=${JSON.stringify(content).substring(0, 200)}`);
|
|
502
|
+
|
|
500
503
|
// 文本消息
|
|
501
504
|
if (msgType === 'RC:TxtMsg') {
|
|
502
505
|
return typeof content === 'string' ? content : (content?.content || JSON.stringify(content));
|
|
@@ -504,30 +507,75 @@ class MessageHandler {
|
|
|
504
507
|
|
|
505
508
|
// 图片消息
|
|
506
509
|
if (msgType === 'RC:ImgMsg') {
|
|
507
|
-
|
|
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
|
+
|
|
521
|
+
this.log?.info(`[_extractMessageContent] 图片消息: imageUri=${imageUri}`);
|
|
522
|
+
|
|
523
|
+
if (!imageUri) {
|
|
524
|
+
return '[图片](无法获取图片地址)';
|
|
525
|
+
}
|
|
526
|
+
|
|
508
527
|
return `[图片] ${imageUri}`;
|
|
509
528
|
}
|
|
510
529
|
|
|
511
530
|
// 视频消息
|
|
512
531
|
if (msgType === 'RC:SightMsg') {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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
|
+
|
|
544
|
+
this.log?.info(`[_extractMessageContent] 视频消息: sightUrl=${sightUrl}`);
|
|
516
545
|
return `[视频] ${sightUrl} ${name} ${duration}秒`;
|
|
517
546
|
}
|
|
518
547
|
|
|
519
548
|
// 文件消息
|
|
520
549
|
if (msgType === 'RC:FileMsg') {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
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
|
+
|
|
562
|
+
this.log?.info(`[_extractMessageContent] 文件消息: fileUrl=${fileUrl}`);
|
|
524
563
|
return `[文件] ${fileUrl} ${name} ${size}`;
|
|
525
564
|
}
|
|
526
565
|
|
|
527
566
|
// 语音消息
|
|
528
567
|
if (msgType === 'RC:HQVCMsg') {
|
|
529
|
-
|
|
530
|
-
|
|
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
|
+
|
|
578
|
+
this.log?.info(`[_extractMessageContent] 语音消息: remoteUrl=${remoteUrl}`);
|
|
531
579
|
return `[语音] ${remoteUrl} ${duration}秒`;
|
|
532
580
|
}
|
|
533
581
|
|