claw-subagent-service 0.0.103 → 0.0.104
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
|
@@ -405,11 +405,30 @@ class OpenClawClient {
|
|
|
405
405
|
headers['Authorization'] = `Bearer ${gatewayToken}`;
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
// 检测消息是否包含图片 URL
|
|
409
|
+
const imageUrlMatch = message.match(/\[图片\]\s*(https?:\/\/[^\s]+)/);
|
|
410
|
+
let messages;
|
|
411
|
+
|
|
412
|
+
if (imageUrlMatch) {
|
|
413
|
+
// 多模态格式:图片 + 文本
|
|
414
|
+
const imageUrl = imageUrlMatch[1];
|
|
415
|
+
const textContent = message.replace(/\[图片\]\s*https?:\/\/[^\s]+/, '').trim();
|
|
416
|
+
|
|
417
|
+
messages = [{
|
|
418
|
+
role: 'user',
|
|
419
|
+
content: [
|
|
420
|
+
{ type: 'text', text: textContent || '描述这张图片' },
|
|
421
|
+
{ type: 'image_url', image_url: { url: imageUrl } }
|
|
422
|
+
]
|
|
423
|
+
}];
|
|
424
|
+
} else {
|
|
425
|
+
// 纯文本格式
|
|
426
|
+
messages = [{ role: 'user', content: message }];
|
|
427
|
+
}
|
|
428
|
+
|
|
408
429
|
const payload = {
|
|
409
430
|
model: 'openclaw',
|
|
410
|
-
messages:
|
|
411
|
-
{ role: 'user', content: message }
|
|
412
|
-
],
|
|
431
|
+
messages: messages,
|
|
413
432
|
stream: true,
|
|
414
433
|
max_tokens: 2048
|
|
415
434
|
};
|