File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -447,8 +447,10 @@ export async function aixCGR_ChatSequence_FromDMessagesOrThrow(
447447
448448 case 'image' :
449449 // dereference the Zync Image Asset, converting it to an inline image
450+ const legacyImageRefPart = refPart . _legacyImageRefPart ;
451+ const imageSize = legacyImageRefPart && legacyImageRefPart . dataRef . reftype === 'dblob' ? legacyImageRefPart ?. dataRef ?. bytesSize ?? 0 : 0 ;
450452 const isLastAssistantMessage = _index === lastAssistantMessageIndex ;
451- const resizeMode = isLastAssistantMessage ? false : 'openai-low -res' ;
453+ const resizeMode = ! isLastAssistantMessage ? 'openai-low-res' : imageSize > 400_000 ? 'openai-high -res' : false ;
452454 try {
453455 const aixPart = await aixConvertZyncImageAssetRefToInlineImageOrThrow ( refPart , resizeMode ) ;
454456 modelMessage . parts . push ( _vnd ? { ...aixPart , _vnd } : aixPart ) ;
@@ -491,8 +493,9 @@ export async function aixCGR_ChatSequence_FromDMessagesOrThrow(
491493 * FIXME for GEMINI IMAGE GENERATION
492494 * For now we upload ONLY THE LAST IMAGE as full quality, while all others are resized before transmission.
493495 */
496+ const imageSize = aPart . dataRef . reftype === 'dblob' ? aPart . dataRef ?. bytesSize ?? 0 : 0 ;
494497 const isLastAssistantMessage = _index === lastAssistantMessageIndex ;
495- const resizeMode = isLastAssistantMessage ? false : 'openai-low -res' ;
498+ const resizeMode = ! isLastAssistantMessage ? 'openai-low-res' : imageSize > 400_000 ? 'openai-high -res' : false ;
496499 try {
497500 const aixPart = await aixConvertImageRefToInlineImageOrThrow ( aPart , resizeMode ) ;
498501 modelMessage . parts . push ( _vnd ? { ...aixPart , _vnd } : aixPart ) ;
You can’t perform that action at this time.
0 commit comments