@ducci/jarvis 1.0.40 → 1.0.41
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 +9 -0
package/package.json
CHANGED
package/src/server/agent.js
CHANGED
|
@@ -50,6 +50,12 @@ async function callModel(client, model, messages, tools) {
|
|
|
50
50
|
return await client.chat.completions.create(params);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function isImageUnsupportedError(apiErrors) {
|
|
54
|
+
if (!apiErrors) return false;
|
|
55
|
+
return [apiErrors.primary?.message, apiErrors.fallback?.message]
|
|
56
|
+
.some(m => m?.toLowerCase().includes('image input'));
|
|
57
|
+
}
|
|
58
|
+
|
|
53
59
|
function extractApiError(err, model) {
|
|
54
60
|
return {
|
|
55
61
|
model,
|
|
@@ -640,6 +646,9 @@ async function _runHandleChat(config, sessionId, userMessage, attachments = [])
|
|
|
640
646
|
// windows). The synthetic note is sufficient context; tool results are preserved
|
|
641
647
|
// in the JSONL log and accessible via read_session_log.
|
|
642
648
|
if (finalStatus === 'model_error' || finalStatus === 'format_error') {
|
|
649
|
+
if (finalStatus === 'model_error' && isImageUnsupportedError(run.errorDetail)) {
|
|
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
|
+
}
|
|
643
652
|
session.messages.splice(runStartIndex, session.messages.length - runStartIndex);
|
|
644
653
|
const errorDetail = run.errorDetail ? ` Error detail: ${JSON.stringify(run.errorDetail)}` : '';
|
|
645
654
|
session.messages.push({
|