@aj-archipelago/cortex 1.4.30 → 1.4.32

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.
@@ -485,7 +485,7 @@ test('addFileToCollection should preserve original displayFilename for converted
485
485
 
486
486
  // Verify it was saved correctly
487
487
  const { loadFileCollection } = await import('../../../lib/fileUtils.js');
488
- const collection = await loadFileCollection(contextId, null, false);
488
+ const collection = await loadFileCollection(contextId, { useCache: false });
489
489
  t.is(collection.length, 1);
490
490
  t.is(collection[0].displayFilename, 'original-document.docx');
491
491
  t.is(collection[0].mimeType, 'text/markdown');
@@ -432,9 +432,9 @@ test('Gemini 1.5 image URL type handling', t => {
432
432
  { type: 'image_url', image_url: { url: 'gs://my-bucket/image1.jpg' } },
433
433
  // Base64 URL - should be converted to inlineData
434
434
  { type: 'image_url', image_url: { url: 'data:image/jpeg;base64,/9j/4AAQSkZJRg...' } },
435
- // Regular HTTP URL - should be dropped (return null)
435
+ // Regular HTTP URL - should be converted to fileData (Gemini supports HTTP URLs directly)
436
436
  { type: 'image_url', image_url: { url: 'https://example.com/image.jpg' } },
437
- // Azure blob URL - should be dropped (return null)
437
+ // Azure blob URL - should be converted to fileData (Gemini supports HTTP URLs directly)
438
438
  { type: 'image_url', image_url: { url: 'https://myaccount.blob.core.windows.net/container/image.jpg' } }
439
439
  ]}
440
440
  ];
@@ -442,20 +442,30 @@ test('Gemini 1.5 image URL type handling', t => {
442
442
  const { modifiedMessages } = gemini15.convertMessagesToGemini(messages);
443
443
 
444
444
  t.is(modifiedMessages.length, 1);
445
- t.is(modifiedMessages[0].parts.length, 3); // text + gcs + base64 (2 urls dropped)
446
-
445
+ t.is(modifiedMessages[0].parts.length, 5); // text + gcs + base64 + http + azure (all urls kept)
446
+
447
447
  // Check text part
448
448
  t.is(modifiedMessages[0].parts[0].text, 'Process these images:');
449
-
449
+
450
450
  // Check GCS URL handling
451
451
  t.true('fileData' in modifiedMessages[0].parts[1]);
452
452
  t.is(modifiedMessages[0].parts[1].fileData.fileUri, 'gs://my-bucket/image1.jpg');
453
453
  t.is(modifiedMessages[0].parts[1].fileData.mimeType, 'image/jpeg');
454
-
454
+
455
455
  // Check base64 URL handling
456
456
  t.true('inlineData' in modifiedMessages[0].parts[2]);
457
457
  t.is(modifiedMessages[0].parts[2].inlineData.mimeType, 'image/jpeg');
458
458
  t.is(modifiedMessages[0].parts[2].inlineData.data, '/9j/4AAQSkZJRg...');
459
+
460
+ // Check HTTP URL handling
461
+ t.true('fileData' in modifiedMessages[0].parts[3]);
462
+ t.is(modifiedMessages[0].parts[3].fileData.fileUri, 'https://example.com/image.jpg');
463
+ t.is(modifiedMessages[0].parts[3].fileData.mimeType, 'image/jpeg');
464
+
465
+ // Check Azure blob URL handling
466
+ t.true('fileData' in modifiedMessages[0].parts[4]);
467
+ t.is(modifiedMessages[0].parts[4].fileData.fileUri, 'https://myaccount.blob.core.windows.net/container/image.jpg');
468
+ t.is(modifiedMessages[0].parts[4].fileData.mimeType, 'image/jpeg');
459
469
  });
460
470
 
461
471
  // Test edge cases for image URLs in Gemini 1.5