assistant2: Only add context if it is non-empty (#22141)

This PR fixes an issue where we were attaching empty message content
even if there was no context.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-12-17 11:09:10 -05:00 committed by GitHub
parent a6b717b97b
commit 6fa5a17586
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -73,5 +73,7 @@ pub fn attach_context_to_message(
context_text.push_str(&thread_context);
}
message.content.push(MessageContent::Text(context_text));
if !context_text.is_empty() {
message.content.push(MessageContent::Text(context_text));
}
}