mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 00:02:30 +00:00
fix: require a user message when provided messages are empty
This commit is contained in:
@@ -995,7 +995,8 @@ pub async fn run_agent(
|
||||
.map(|m| !m.is_empty())
|
||||
.unwrap_or(false);
|
||||
|
||||
if !matches!(history, HistorySource::Messages(_)) && !has_user_message {
|
||||
// An empty list, such as a messages expression that evaluated to null, is no conversation to send.
|
||||
if !matches!(&history, HistorySource::Messages(m) if !m.is_empty()) && !has_user_message {
|
||||
return Err(Error::internal_err(
|
||||
"Either 'messages' or 'user_message' must be provided".to_string(),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user