File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -797,22 +797,24 @@ pub async fn stream_response(
797
797
. collect ( ) ;
798
798
799
799
if let Some ( image_urls) = create_message_req_payload. image_urls . clone ( ) {
800
- open_ai_messages. push ( ChatMessage :: User {
801
- name : None ,
802
- content : ChatMessageContent :: ImageUrl (
803
- image_urls
804
- . iter ( )
805
- . map ( |url| ImageUrl {
806
- r#type : "image_url" . to_string ( ) ,
807
- text : None ,
808
- image_url : ImageUrlType {
809
- url : url. to_string ( ) ,
810
- detail : None ,
811
- } ,
812
- } )
813
- . collect ( ) ,
814
- ) ,
815
- } ) ;
800
+ if !image_urls. is_empty ( ) {
801
+ open_ai_messages. push ( ChatMessage :: User {
802
+ name : None ,
803
+ content : ChatMessageContent :: ImageUrl (
804
+ image_urls
805
+ . iter ( )
806
+ . map ( |url| ImageUrl {
807
+ r#type : "image_url" . to_string ( ) ,
808
+ text : None ,
809
+ image_url : ImageUrlType {
810
+ url : url. to_string ( ) ,
811
+ detail : None ,
812
+ } ,
813
+ } )
814
+ . collect ( ) ,
815
+ ) ,
816
+ } ) ;
817
+ }
816
818
} else if !images. is_empty ( ) {
817
819
if let Some ( LLMOptions {
818
820
image_config : Some ( ref image_config) ,
You can’t perform that action at this time.
0 commit comments