Skip to content

Commit

Permalink
bugfix: include image urls when they are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
densumesh committed Jan 9, 2025
1 parent 26445f6 commit 0c46f20
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions server/src/operators/message_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,6 @@ pub async fn stream_response(
.filter_map(|image| image.clone())
.collect::<Vec<_>>()
})
.chain(
create_message_req_payload
.image_urls
.clone()
.unwrap_or_default(),
)
.collect();

// replace the last message with the last message with evidence
Expand Down Expand Up @@ -802,7 +796,24 @@ pub async fn stream_response(
})
.collect();

if !images.is_empty() {
if let Some(image_urls) = create_message_req_payload.image_urls.clone() {
open_ai_messages.push(ChatMessage::User {
name: None,
content: ChatMessageContent::ImageUrl(
image_urls
.iter()
.map(|url| ImageUrl {
r#type: "image_url".to_string(),
text: None,
image_url: ImageUrlType {
url: url.to_string(),
detail: None,
},
})
.collect(),
),
});
} else if !images.is_empty() {
if let Some(LLMOptions {
image_config: Some(ref image_config),
..
Expand Down

0 comments on commit 0c46f20

Please sign in to comment.