@@ -393,44 +393,45 @@ function _convertMessagesToOpenAIResponsesParams(
393
393
return input ;
394
394
}
395
395
396
- if ( role === "user" ) {
397
- return {
398
- type : "message" ,
399
- role : "user" ,
400
- content :
401
- typeof lcMsg . content === "string"
402
- ? lcMsg . content
403
- : lcMsg . content . flatMap ( ( item ) => {
404
- if ( item . type === "text" ) {
405
- return { type : "input_text" , text : item . text } ;
406
- }
396
+ const content =
397
+ typeof lcMsg . content === "string"
398
+ ? lcMsg . content
399
+ : lcMsg . content . flatMap ( ( item ) => {
400
+ if ( item . type === "text" ) {
401
+ return { type : "input_text" , text : item . text } ;
402
+ }
407
403
408
- if ( item . type === "image_url" ) {
409
- const image_url =
410
- typeof item . image_url === "string"
411
- ? item . image_url
412
- : item . image_url . url ;
413
- const detail =
414
- typeof item . image_url === "string"
415
- ? "auto"
416
- : item . image_url . detail ;
417
-
418
- return { type : "input_image" , image_url, detail } ;
419
- }
404
+ if ( item . type === "image_url" ) {
405
+ const image_url =
406
+ typeof item . image_url === "string"
407
+ ? item . image_url
408
+ : item . image_url . url ;
409
+ const detail =
410
+ typeof item . image_url === "string"
411
+ ? "auto"
412
+ : item . image_url . detail ;
413
+
414
+ return { type : "input_image" , image_url, detail } ;
415
+ }
420
416
421
- if (
422
- item . type === "input_text" ||
423
- item . type === "input_image" ||
424
- item . type === "input_file"
425
- ) {
426
- return item ;
427
- }
417
+ if (
418
+ item . type === "input_text" ||
419
+ item . type === "input_image" ||
420
+ item . type === "input_file"
421
+ ) {
422
+ return item ;
423
+ }
428
424
429
- return [ ] ;
430
- } ) ,
431
- } ;
425
+ return [ ] ;
426
+ } ) ;
427
+
428
+ if ( role === "user" || role === "system" || role === "developer" ) {
429
+ return { type : "message" , role, content } ;
432
430
}
433
431
432
+ console . warn (
433
+ `Unsupported role found when converting to OpenAI Responses API: ${ role } `
434
+ ) ;
434
435
return [ ] ;
435
436
}
436
437
) ;
0 commit comments