@ducci/jarvis 1.0.41 → 1.0.42
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/server/agent.js +13 -0
package/package.json
CHANGED
package/src/server/agent.js
CHANGED
|
@@ -648,6 +648,19 @@ async function _runHandleChat(config, sessionId, userMessage, attachments = [])
|
|
|
648
648
|
if (finalStatus === 'model_error' || finalStatus === 'format_error') {
|
|
649
649
|
if (finalStatus === 'model_error' && isImageUnsupportedError(run.errorDetail)) {
|
|
650
650
|
finalResponse = 'This model does not support image input. Please switch to a multimodal model (e.g. claude-3.5-sonnet, gpt-4o) in settings.';
|
|
651
|
+
// Strip the image from the user message that caused the failure so it
|
|
652
|
+
// does not permanently break the session on every subsequent call.
|
|
653
|
+
// Replace with a text placeholder so the model knows a image was present.
|
|
654
|
+
for (let i = session.messages.length - 1; i >= 0; i--) {
|
|
655
|
+
const msg = session.messages[i];
|
|
656
|
+
if (msg.role === 'user' && Array.isArray(msg.content)) {
|
|
657
|
+
const textPart = msg.content.find(c => c.type === 'text')?.text || '';
|
|
658
|
+
msg.content = textPart
|
|
659
|
+
? `${textPart}\n[image removed — model does not support image input]`
|
|
660
|
+
: '[image removed — model does not support image input]';
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
651
664
|
}
|
|
652
665
|
session.messages.splice(runStartIndex, session.messages.length - runStartIndex);
|
|
653
666
|
const errorDetail = run.errorDetail ? ` Error detail: ${JSON.stringify(run.errorDetail)}` : '';
|