openfox 0.2.3 → 1.0.0
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/dist/agent-defaults/builder.agent.md +3 -7
- package/dist/agent-defaults/code-reviewer.agent.md +1 -2
- package/dist/agent-defaults/debugger.agent.md +1 -2
- package/dist/agent-defaults/planner.agent.md +2 -9
- package/dist/agent-defaults/test-generator.agent.md +1 -1
- package/dist/agent-defaults/verifier.agent.md +4 -5
- package/dist/ask-3RK5YJZE.js +19 -0
- package/dist/auto-compaction-7LNZ5J3W.js +23 -0
- package/dist/{branch.api-WDHKZJS6.js → branch.api-XADFZZAA.js} +2 -2
- package/dist/chat-handler-T7SLWZ4E.js +201 -0
- package/dist/chunk-22CTURMH.js +128 -0
- package/dist/chunk-2KSCZSXQ.js +680 -0
- package/dist/{chunk-YMUIRZUI.js → chunk-2TBNG7CS.js} +12 -12
- package/dist/{chunk-4Z2OZ6NX.js → chunk-3EHGGBWE.js} +29 -2
- package/dist/{chunk-L475ND2Z.js → chunk-3UQACISJ.js} +162 -52
- package/dist/{chunk-AF7XS4OI.js → chunk-5YQAXUKO.js} +4 -1
- package/dist/{chunk-MTX5Y3V3.js → chunk-7IOZFJBW.js} +2 -2
- package/dist/chunk-BU2ZYOEA.js +1067 -0
- package/dist/chunk-M2C5GEQR.js +137 -0
- package/dist/{chunk-U62ZECSQ.js → chunk-PNBH3RAX.js} +2 -2
- package/dist/chunk-QDEKU5RL.js +75 -0
- package/dist/chunk-QYP5HQV4.js +438 -0
- package/dist/{chunk-3WOUSUW7.js → chunk-RAZQTQK2.js} +1353 -1134
- package/dist/chunk-S4QKTRGJ.js +343 -0
- package/dist/{chunk-ARFK3RZW.js → chunk-TPT6HP4H.js} +1 -1
- package/dist/chunk-TVQOONDR.js +75 -0
- package/dist/{chunk-5ZUU23XF.js → chunk-U6BUT37A.js} +286 -33
- package/dist/chunk-VZXXJKSQ.js +314 -0
- package/dist/{chunk-26NRL3HX.js → chunk-XFXOSPYH.js} +3 -2
- package/dist/{chunk-N2XYX4ZA.js → chunk-XKFPU2FA.js} +13 -2
- package/dist/{chunk-FUUYYDVG.js → chunk-YB2574C6.js} +2841 -4507
- package/dist/cli/dev.js +4 -3
- package/dist/cli/index.js +4 -3
- package/dist/{config-BMXSDOZB.js → config-GIFCEJDU.js} +11 -6
- package/dist/events-G6CKHDNZ.js +114 -0
- package/dist/folding-O52L65VN.js +37 -0
- package/dist/{init-PLRTRSDC.js → init-MKTUIGZU.js} +46 -13
- package/dist/orchestrator-UGXX7JRQ.js +39 -0
- package/dist/package.json +9 -2
- package/dist/{paths-4BPXWB2W.js → paths-MM76AWYB.js} +2 -2
- package/dist/processor-KLHKDILM.js +236 -0
- package/dist/{project-creator-CWPKRIKI.js → project-creator-KAQXMZCT.js} +9 -8
- package/dist/projects-GSMMEVSO.js +19 -0
- package/dist/{protocol-BFFz3WM0.d.ts → protocol-BZ6OIASP.d.ts} +71 -50
- package/dist/protocol-WQENDK72.js +88 -0
- package/dist/{provider-ETVY64A2.js → provider-4KTWU6IV.js} +41 -9
- package/dist/runtime-config-2XJJIMSC.js +9 -0
- package/dist/{serve-TL34LE77.js → serve-UK6B6G2O.js} +38 -18
- package/dist/server/index.d.ts +81 -27
- package/dist/server/index.js +19 -11
- package/dist/{settings-D5O3TMLD.js → settings-NCLN4JDZ.js} +4 -4
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/tools-SGBQE736.js +48 -0
- package/dist/vision-fallback-63VPBSEN.js +22 -0
- package/dist/web/assets/{index-DHmZmhnR.css → index-BsaaC0X0.css} +32 -1
- package/dist/web/assets/index-CvO7QkGh.js +141 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sounds/typing.mp3 +0 -0
- package/dist/workflow-defaults/default.workflow.json +1 -1
- package/package.json +9 -2
- package/dist/chunk-L4XDA3V7.js +0 -218
- package/dist/tools-QMIIDJTV.js +0 -48
- package/dist/web/assets/index-CAD7Iv_d.js +0 -122
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describeImageFromDataUrl,
|
|
3
|
+
ensureVisionFallbackConfigLoaded
|
|
4
|
+
} from "./chunk-M2C5GEQR.js";
|
|
1
5
|
import {
|
|
2
6
|
logger
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PNBH3RAX.js";
|
|
4
8
|
|
|
5
9
|
// src/server/llm/backend.ts
|
|
6
10
|
var BACKEND_CAPABILITIES = {
|
|
@@ -288,7 +292,8 @@ var DEFAULT_PROFILE = {
|
|
|
288
292
|
topP: 0.9,
|
|
289
293
|
supportsReasoning: false,
|
|
290
294
|
reasoningAsContent: false,
|
|
291
|
-
defaultMaxTokens: 4096
|
|
295
|
+
defaultMaxTokens: 4096,
|
|
296
|
+
supportsVision: true
|
|
292
297
|
};
|
|
293
298
|
var MOCK_PROFILE = {
|
|
294
299
|
name: "mock",
|
|
@@ -296,7 +301,8 @@ var MOCK_PROFILE = {
|
|
|
296
301
|
topP: 0.9,
|
|
297
302
|
supportsReasoning: false,
|
|
298
303
|
reasoningAsContent: false,
|
|
299
|
-
defaultMaxTokens: 1024
|
|
304
|
+
defaultMaxTokens: 1024,
|
|
305
|
+
supportsVision: false
|
|
300
306
|
};
|
|
301
307
|
var MODEL_PROFILES = [
|
|
302
308
|
{
|
|
@@ -307,7 +313,8 @@ var MODEL_PROFILES = [
|
|
|
307
313
|
topP: 0.9,
|
|
308
314
|
supportsReasoning: false,
|
|
309
315
|
reasoningAsContent: false,
|
|
310
|
-
defaultMaxTokens:
|
|
316
|
+
defaultMaxTokens: 16384,
|
|
317
|
+
supportsVision: false
|
|
311
318
|
}
|
|
312
319
|
},
|
|
313
320
|
{
|
|
@@ -321,7 +328,8 @@ var MODEL_PROFILES = [
|
|
|
321
328
|
// "This model supports only non-thinking mode and does not generate <think></think> blocks"
|
|
322
329
|
supportsReasoning: false,
|
|
323
330
|
reasoningAsContent: false,
|
|
324
|
-
defaultMaxTokens:
|
|
331
|
+
defaultMaxTokens: 16384,
|
|
332
|
+
supportsVision: false
|
|
325
333
|
}
|
|
326
334
|
},
|
|
327
335
|
{
|
|
@@ -332,7 +340,20 @@ var MODEL_PROFILES = [
|
|
|
332
340
|
topP: 0.9,
|
|
333
341
|
supportsReasoning: true,
|
|
334
342
|
reasoningAsContent: false,
|
|
335
|
-
defaultMaxTokens:
|
|
343
|
+
defaultMaxTokens: 16384,
|
|
344
|
+
supportsVision: false
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
pattern: "qwen3-vl",
|
|
349
|
+
profile: {
|
|
350
|
+
name: "Qwen3-VL",
|
|
351
|
+
temperature: 0.7,
|
|
352
|
+
topP: 0.9,
|
|
353
|
+
supportsReasoning: true,
|
|
354
|
+
reasoningAsContent: false,
|
|
355
|
+
defaultMaxTokens: 16384,
|
|
356
|
+
supportsVision: true
|
|
336
357
|
}
|
|
337
358
|
},
|
|
338
359
|
{
|
|
@@ -343,7 +364,72 @@ var MODEL_PROFILES = [
|
|
|
343
364
|
topP: 0.95,
|
|
344
365
|
supportsReasoning: true,
|
|
345
366
|
reasoningAsContent: false,
|
|
346
|
-
defaultMaxTokens:
|
|
367
|
+
defaultMaxTokens: 16384,
|
|
368
|
+
supportsVision: false
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
pattern: "minimax-m2.5",
|
|
373
|
+
profile: {
|
|
374
|
+
name: "MiniMax-M2.5",
|
|
375
|
+
temperature: 1,
|
|
376
|
+
topP: 0.95,
|
|
377
|
+
topK: 40,
|
|
378
|
+
supportsReasoning: true,
|
|
379
|
+
reasoningAsContent: false,
|
|
380
|
+
defaultMaxTokens: 16384,
|
|
381
|
+
supportsVision: false
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
pattern: "minimax-m2.7",
|
|
386
|
+
profile: {
|
|
387
|
+
name: "MiniMax-M2.7",
|
|
388
|
+
temperature: 1,
|
|
389
|
+
topP: 0.95,
|
|
390
|
+
topK: 40,
|
|
391
|
+
supportsReasoning: true,
|
|
392
|
+
reasoningAsContent: false,
|
|
393
|
+
defaultMaxTokens: 16384,
|
|
394
|
+
supportsVision: false
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
pattern: "minimax",
|
|
399
|
+
profile: {
|
|
400
|
+
name: "MiniMax",
|
|
401
|
+
temperature: 1,
|
|
402
|
+
topP: 0.95,
|
|
403
|
+
topK: 40,
|
|
404
|
+
supportsReasoning: true,
|
|
405
|
+
reasoningAsContent: false,
|
|
406
|
+
defaultMaxTokens: 16384,
|
|
407
|
+
supportsVision: false
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
pattern: "minimax-m3",
|
|
412
|
+
profile: {
|
|
413
|
+
name: "MiniMax-M3",
|
|
414
|
+
temperature: 1,
|
|
415
|
+
topP: 0.95,
|
|
416
|
+
topK: 40,
|
|
417
|
+
supportsReasoning: true,
|
|
418
|
+
reasoningAsContent: false,
|
|
419
|
+
defaultMaxTokens: 16384,
|
|
420
|
+
supportsVision: true
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
pattern: "llava",
|
|
425
|
+
profile: {
|
|
426
|
+
name: "LLaVA",
|
|
427
|
+
temperature: 0.7,
|
|
428
|
+
topP: 0.9,
|
|
429
|
+
supportsReasoning: false,
|
|
430
|
+
reasoningAsContent: false,
|
|
431
|
+
defaultMaxTokens: 16384,
|
|
432
|
+
supportsVision: true
|
|
347
433
|
}
|
|
348
434
|
},
|
|
349
435
|
{
|
|
@@ -354,7 +440,8 @@ var MODEL_PROFILES = [
|
|
|
354
440
|
topP: 0.9,
|
|
355
441
|
supportsReasoning: false,
|
|
356
442
|
reasoningAsContent: false,
|
|
357
|
-
defaultMaxTokens:
|
|
443
|
+
defaultMaxTokens: 16384,
|
|
444
|
+
supportsVision: false
|
|
358
445
|
}
|
|
359
446
|
},
|
|
360
447
|
{
|
|
@@ -365,7 +452,20 @@ var MODEL_PROFILES = [
|
|
|
365
452
|
topP: 0.9,
|
|
366
453
|
supportsReasoning: true,
|
|
367
454
|
reasoningAsContent: false,
|
|
368
|
-
defaultMaxTokens:
|
|
455
|
+
defaultMaxTokens: 16384,
|
|
456
|
+
supportsVision: false
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
pattern: "gemma-4",
|
|
461
|
+
profile: {
|
|
462
|
+
name: "Gemma 4",
|
|
463
|
+
temperature: 0.7,
|
|
464
|
+
topP: 0.9,
|
|
465
|
+
supportsReasoning: true,
|
|
466
|
+
reasoningAsContent: false,
|
|
467
|
+
defaultMaxTokens: 16384,
|
|
468
|
+
supportsVision: true
|
|
369
469
|
}
|
|
370
470
|
}
|
|
371
471
|
];
|
|
@@ -383,9 +483,50 @@ function getModelProfile(modelName) {
|
|
|
383
483
|
}
|
|
384
484
|
|
|
385
485
|
// src/server/llm/client-pure.ts
|
|
386
|
-
function
|
|
486
|
+
function convertAttachmentSync(attachment, modelSupportsVision) {
|
|
487
|
+
if (modelSupportsVision) {
|
|
488
|
+
return {
|
|
489
|
+
type: "image_url",
|
|
490
|
+
image_url: { url: attachment.data }
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
return {
|
|
494
|
+
type: "text",
|
|
495
|
+
text: `[Image: ${attachment.filename || "image"}] (vision not supported, cannot describe)`
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
async function convertAttachmentWithFallback(attachment, options) {
|
|
499
|
+
logger.debug("[VisionFallback] convertAttachmentWithFallback called", { filename: attachment.filename, id: attachment.id, hasCallbacks: !!options.onVisionFallbackStart });
|
|
500
|
+
if (options.modelSupportsVision) {
|
|
501
|
+
logger.debug("[VisionFallback] Model supports vision - passing image directly");
|
|
502
|
+
return {
|
|
503
|
+
type: "image_url",
|
|
504
|
+
image_url: { url: attachment.data }
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
if (!options.visionFallbackEnabled) {
|
|
508
|
+
logger.debug("[VisionFallback] Fallback disabled - returning placeholder");
|
|
509
|
+
return {
|
|
510
|
+
type: "text",
|
|
511
|
+
text: `[Image: ${attachment.filename || "image"}] (vision not supported)`
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
const attachmentId = attachment.id ?? crypto.randomUUID();
|
|
515
|
+
const filename = attachment.filename;
|
|
516
|
+
logger.debug("[VisionFallback] Starting delegation for:", { attachmentId, filename });
|
|
517
|
+
options.onVisionFallbackStart?.(attachmentId, filename);
|
|
518
|
+
const context = filename ? `File: ${filename}` : void 0;
|
|
519
|
+
const description = await describeImageFromDataUrl(attachment.data, context ? { context } : {});
|
|
520
|
+
logger.debug("[VisionFallback] Delegation complete:", { attachmentId, descriptionLength: description.length });
|
|
521
|
+
options.onVisionFallbackDone?.(attachmentId, description);
|
|
522
|
+
return {
|
|
523
|
+
type: "text",
|
|
524
|
+
text: `[Image: ${attachment.filename || "image"}] ${description}`
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function convertMessages(messages, options) {
|
|
387
528
|
const filtered = messages.filter((msg) => {
|
|
388
|
-
return !(msg.role === "assistant" && !msg.content?.trim() && !msg.toolCalls
|
|
529
|
+
return !(msg.role === "assistant" && !msg.content?.trim() && (!msg.toolCalls || msg.toolCalls.length === 0));
|
|
389
530
|
});
|
|
390
531
|
return filtered.map((msg) => {
|
|
391
532
|
if (msg.role === "tool") {
|
|
@@ -395,10 +536,7 @@ function convertMessages(messages) {
|
|
|
395
536
|
content.push({ type: "text", text: msg.content });
|
|
396
537
|
}
|
|
397
538
|
for (const attachment of msg.attachments) {
|
|
398
|
-
content.push(
|
|
399
|
-
type: "image_url",
|
|
400
|
-
image_url: { url: attachment.data }
|
|
401
|
-
});
|
|
539
|
+
content.push(convertAttachmentSync(attachment, options.modelSupportsVision));
|
|
402
540
|
}
|
|
403
541
|
return {
|
|
404
542
|
role: "tool",
|
|
@@ -432,13 +570,7 @@ function convertMessages(messages) {
|
|
|
432
570
|
content.push({ type: "text", text: msg.content });
|
|
433
571
|
}
|
|
434
572
|
for (const attachment of msg.attachments) {
|
|
435
|
-
content.push(
|
|
436
|
-
type: "image_url",
|
|
437
|
-
image_url: {
|
|
438
|
-
url: attachment.data
|
|
439
|
-
// base64 data URL
|
|
440
|
-
}
|
|
441
|
-
});
|
|
573
|
+
content.push(convertAttachmentSync(attachment, options.modelSupportsVision));
|
|
442
574
|
}
|
|
443
575
|
return {
|
|
444
576
|
role: "user",
|
|
@@ -451,6 +583,80 @@ function convertMessages(messages) {
|
|
|
451
583
|
};
|
|
452
584
|
});
|
|
453
585
|
}
|
|
586
|
+
async function convertMessagesWithFallback(messages, options) {
|
|
587
|
+
logger.debug("[VisionFallback] convertMessagesWithFallback called", { messageCount: messages.length });
|
|
588
|
+
const filtered = messages.filter((msg) => {
|
|
589
|
+
return !(msg.role === "assistant" && !msg.content?.trim() && (!msg.toolCalls || msg.toolCalls.length === 0));
|
|
590
|
+
});
|
|
591
|
+
const converted = [];
|
|
592
|
+
for (const msg of filtered) {
|
|
593
|
+
if (msg.role === "tool") {
|
|
594
|
+
if (msg.attachments && msg.attachments.length > 0) {
|
|
595
|
+
const content = [];
|
|
596
|
+
if (msg.content?.trim()) {
|
|
597
|
+
content.push({ type: "text", text: msg.content });
|
|
598
|
+
}
|
|
599
|
+
for (const attachment of msg.attachments) {
|
|
600
|
+
const convertedContent = await convertAttachmentWithFallback(
|
|
601
|
+
{ data: attachment.data, filename: attachment.filename, id: attachment.id },
|
|
602
|
+
options
|
|
603
|
+
);
|
|
604
|
+
content.push(convertedContent);
|
|
605
|
+
}
|
|
606
|
+
converted.push({
|
|
607
|
+
role: "tool",
|
|
608
|
+
content,
|
|
609
|
+
tool_call_id: msg.toolCallId
|
|
610
|
+
});
|
|
611
|
+
} else {
|
|
612
|
+
converted.push({
|
|
613
|
+
role: "tool",
|
|
614
|
+
content: msg.content,
|
|
615
|
+
tool_call_id: msg.toolCallId
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
if (msg.role === "assistant" && msg.toolCalls?.length) {
|
|
621
|
+
converted.push({
|
|
622
|
+
role: "assistant",
|
|
623
|
+
content: msg.content || null,
|
|
624
|
+
tool_calls: msg.toolCalls.map((toolCall) => ({
|
|
625
|
+
id: toolCall.id,
|
|
626
|
+
type: "function",
|
|
627
|
+
function: {
|
|
628
|
+
name: toolCall.name,
|
|
629
|
+
arguments: JSON.stringify(toolCall.arguments)
|
|
630
|
+
}
|
|
631
|
+
}))
|
|
632
|
+
});
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
if (msg.role === "user" && msg.attachments && msg.attachments.length > 0) {
|
|
636
|
+
const content = [];
|
|
637
|
+
if (msg.content?.trim()) {
|
|
638
|
+
content.push({ type: "text", text: msg.content });
|
|
639
|
+
}
|
|
640
|
+
for (const attachment of msg.attachments) {
|
|
641
|
+
const convertedContent = await convertAttachmentWithFallback(
|
|
642
|
+
{ data: attachment.data, filename: attachment.filename, id: attachment.id },
|
|
643
|
+
options
|
|
644
|
+
);
|
|
645
|
+
content.push(convertedContent);
|
|
646
|
+
}
|
|
647
|
+
converted.push({
|
|
648
|
+
role: "user",
|
|
649
|
+
content
|
|
650
|
+
});
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
converted.push({
|
|
654
|
+
role: msg.role,
|
|
655
|
+
content: msg.content
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
return converted;
|
|
659
|
+
}
|
|
454
660
|
function convertTools(tools) {
|
|
455
661
|
return tools.map((tool) => ({
|
|
456
662
|
type: "function",
|
|
@@ -461,11 +667,33 @@ function convertTools(tools) {
|
|
|
461
667
|
}
|
|
462
668
|
}));
|
|
463
669
|
}
|
|
464
|
-
function
|
|
465
|
-
const
|
|
670
|
+
function needsVisionFallback(messages, modelSupportsVision, visionFallbackEnabled) {
|
|
671
|
+
const hasAttachments = messages.some(
|
|
672
|
+
(msg) => msg.attachments && msg.attachments.length > 0 || msg.role === "tool" && msg.attachments && msg.attachments.length > 0
|
|
673
|
+
);
|
|
674
|
+
const result = hasAttachments && !modelSupportsVision && visionFallbackEnabled;
|
|
675
|
+
logger.debug("[VisionFallback] needsVisionFallback check", {
|
|
676
|
+
hasAttachments,
|
|
677
|
+
modelSupportsVision,
|
|
678
|
+
visionFallbackEnabled,
|
|
679
|
+
result
|
|
680
|
+
});
|
|
681
|
+
return result;
|
|
682
|
+
}
|
|
683
|
+
async function buildNonStreamingCreateParams(input) {
|
|
684
|
+
const { model, request, profile, capabilities, disableThinking, visionFallbackEnabled = false, onVisionFallbackStart, onVisionFallbackDone } = input;
|
|
685
|
+
const messages = request.messages;
|
|
686
|
+
const modelSupportsVision = profile.supportsVision ?? false;
|
|
687
|
+
const options = {
|
|
688
|
+
modelSupportsVision,
|
|
689
|
+
visionFallbackEnabled,
|
|
690
|
+
onVisionFallbackStart,
|
|
691
|
+
onVisionFallbackDone
|
|
692
|
+
};
|
|
693
|
+
const convertedMessages = needsVisionFallback(messages, modelSupportsVision, visionFallbackEnabled) ? await convertMessagesWithFallback(messages, options) : convertMessages(messages, { modelSupportsVision, visionFallbackEnabled: false });
|
|
466
694
|
const params = {
|
|
467
695
|
model,
|
|
468
|
-
messages:
|
|
696
|
+
messages: convertedMessages,
|
|
469
697
|
...request.tools ? { tools: convertTools(request.tools) } : {},
|
|
470
698
|
...request.toolChoice ? { tool_choice: request.toolChoice } : {},
|
|
471
699
|
temperature: request.temperature ?? profile.temperature,
|
|
@@ -483,11 +711,15 @@ function buildNonStreamingCreateParams(input) {
|
|
|
483
711
|
}
|
|
484
712
|
return params;
|
|
485
713
|
}
|
|
486
|
-
function buildStreamingCreateParams(input) {
|
|
487
|
-
const { model, request, profile, capabilities, disableThinking } = input;
|
|
714
|
+
async function buildStreamingCreateParams(input) {
|
|
715
|
+
const { model, request, profile, capabilities, disableThinking, visionFallbackEnabled = false, onVisionFallbackStart, onVisionFallbackDone } = input;
|
|
716
|
+
const messages = request.messages;
|
|
717
|
+
const modelSupportsVision = profile.supportsVision ?? false;
|
|
718
|
+
const options = { modelSupportsVision, visionFallbackEnabled, onVisionFallbackStart, onVisionFallbackDone };
|
|
719
|
+
const convertedMessages = needsVisionFallback(messages, modelSupportsVision, visionFallbackEnabled) ? await convertMessagesWithFallback(messages, options) : convertMessages(messages, { modelSupportsVision, visionFallbackEnabled: false });
|
|
488
720
|
const params = {
|
|
489
721
|
model,
|
|
490
|
-
messages:
|
|
722
|
+
messages: convertedMessages,
|
|
491
723
|
...request.tools ? { tools: convertTools(request.tools) } : {},
|
|
492
724
|
...request.toolChoice ? { tool_choice: request.toolChoice } : {},
|
|
493
725
|
temperature: request.temperature ?? profile.temperature,
|
|
@@ -585,13 +817,23 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
585
817
|
});
|
|
586
818
|
try {
|
|
587
819
|
const shouldDisableThinking = disableThinking || request.disableThinking === true;
|
|
588
|
-
|
|
820
|
+
await ensureVisionFallbackConfigLoaded();
|
|
821
|
+
const { isVisionFallbackEnabled } = await import("./vision-fallback-63VPBSEN.js");
|
|
822
|
+
const paramsOptions = {
|
|
589
823
|
model,
|
|
590
824
|
request,
|
|
591
825
|
profile,
|
|
592
826
|
capabilities,
|
|
593
|
-
disableThinking: shouldDisableThinking
|
|
594
|
-
|
|
827
|
+
disableThinking: shouldDisableThinking,
|
|
828
|
+
visionFallbackEnabled: isVisionFallbackEnabled()
|
|
829
|
+
};
|
|
830
|
+
if (request.onVisionFallbackStart) {
|
|
831
|
+
paramsOptions.onVisionFallbackStart = request.onVisionFallbackStart;
|
|
832
|
+
}
|
|
833
|
+
if (request.onVisionFallbackDone) {
|
|
834
|
+
paramsOptions.onVisionFallbackDone = request.onVisionFallbackDone;
|
|
835
|
+
}
|
|
836
|
+
const createParams = await buildNonStreamingCreateParams(paramsOptions);
|
|
595
837
|
const response = await openai.chat.completions.create(createParams, {
|
|
596
838
|
signal: request.signal
|
|
597
839
|
});
|
|
@@ -653,8 +895,19 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
653
895
|
idleTimeout
|
|
654
896
|
});
|
|
655
897
|
try {
|
|
898
|
+
await ensureVisionFallbackConfigLoaded();
|
|
899
|
+
const { isVisionFallbackEnabled } = await import("./vision-fallback-63VPBSEN.js");
|
|
656
900
|
const shouldDisableThinking = disableThinking || request.disableThinking === true;
|
|
657
|
-
const createParams = buildStreamingCreateParams({
|
|
901
|
+
const createParams = await buildStreamingCreateParams({
|
|
902
|
+
model,
|
|
903
|
+
request,
|
|
904
|
+
profile,
|
|
905
|
+
capabilities,
|
|
906
|
+
disableThinking: shouldDisableThinking,
|
|
907
|
+
visionFallbackEnabled: isVisionFallbackEnabled(),
|
|
908
|
+
onVisionFallbackStart: request.onVisionFallbackStart,
|
|
909
|
+
onVisionFallbackDone: request.onVisionFallbackDone
|
|
910
|
+
});
|
|
658
911
|
const stream = await openai.chat.completions.create(createParams, {
|
|
659
912
|
signal: request.signal
|
|
660
913
|
});
|
|
@@ -858,4 +1111,4 @@ export {
|
|
|
858
1111
|
getLlmStatus,
|
|
859
1112
|
clearModelCache
|
|
860
1113
|
};
|
|
861
|
-
//# sourceMappingURL=chunk-
|
|
1114
|
+
//# sourceMappingURL=chunk-U6BUT37A.js.map
|