Fix scheduled recipe session params (#9553)
Signed-off-by: Angie Jones <jones.angie@gmail.com>
This commit is contained in:
@@ -468,27 +468,35 @@ async fn update_from_session(
|
||||
status: StatusCode::INTERNAL_SERVER_ERROR,
|
||||
})?;
|
||||
if let Some(recipe) = session.recipe {
|
||||
match build_recipe_with_parameter_values(
|
||||
&recipe,
|
||||
session.user_recipe_values.unwrap_or_default(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Some(recipe)) => {
|
||||
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
|
||||
agent
|
||||
.extend_system_prompt("recipe".to_string(), prompt)
|
||||
.await;
|
||||
if session.session_type == SessionType::Scheduled {
|
||||
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
|
||||
agent
|
||||
.extend_system_prompt("recipe".to_string(), prompt)
|
||||
.await;
|
||||
}
|
||||
} else {
|
||||
match build_recipe_with_parameter_values(
|
||||
&recipe,
|
||||
session.user_recipe_values.unwrap_or_default(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Some(recipe)) => {
|
||||
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
|
||||
agent
|
||||
.extend_system_prompt("recipe".to_string(), prompt)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
// Recipe has missing parameters
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(ErrorResponse {
|
||||
message: e.to_string(),
|
||||
status: StatusCode::INTERNAL_SERVER_ERROR,
|
||||
});
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
// Recipe has missing parameters
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(ErrorResponse {
|
||||
message: e.to_string(),
|
||||
status: StatusCode::INTERNAL_SERVER_ERROR,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -758,27 +766,35 @@ async fn restart_agent_internal(
|
||||
})?;
|
||||
|
||||
if let Some(ref recipe) = session.recipe {
|
||||
match build_recipe_with_parameter_values(
|
||||
recipe,
|
||||
session.user_recipe_values.clone().unwrap_or_default(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Some(recipe)) => {
|
||||
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
|
||||
agent
|
||||
.extend_system_prompt("recipe".to_string(), prompt)
|
||||
.await;
|
||||
if session.session_type == SessionType::Scheduled {
|
||||
if let Some(prompt) = apply_recipe_to_agent(&agent, recipe, true).await {
|
||||
agent
|
||||
.extend_system_prompt("recipe".to_string(), prompt)
|
||||
.await;
|
||||
}
|
||||
} else {
|
||||
match build_recipe_with_parameter_values(
|
||||
recipe,
|
||||
session.user_recipe_values.clone().unwrap_or_default(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Some(recipe)) => {
|
||||
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
|
||||
agent
|
||||
.extend_system_prompt("recipe".to_string(), prompt)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
// Recipe has missing parameters
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(ErrorResponse {
|
||||
message: e.to_string(),
|
||||
status: StatusCode::INTERNAL_SERVER_ERROR,
|
||||
});
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
// Recipe has missing parameters
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(ErrorResponse {
|
||||
message: e.to_string(),
|
||||
status: StatusCode::INTERNAL_SERVER_ERROR,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user