fix: handle non exist subrecipe path (#5287)

This commit is contained in:
Lifei Zhou
2025-10-22 09:05:18 +11:00
committed by GitHub
parent d836a10af1
commit e720733259
4 changed files with 67 additions and 18 deletions
@@ -242,18 +242,26 @@ settings:
temperature: 0.7
sub_recipes:
- path: existing_sub_recipe.yaml
name: existing_sub_recipe
name: existing_sub_recipe
response:
json_schema:
type: object
properties:
result:
type: string
"#;
let sub_recipe_content = r#"
title: existing_sub_recipe
description: An existing sub recipe
instructions: sub recipe instructions
prompt: sub recipe prompt
"#;
let temp_dir = tempfile::tempdir().unwrap();
let recipe_path: std::path::PathBuf = temp_dir.path().join("test_recipe.yaml");
let sub_recipe_path: std::path::PathBuf = temp_dir.path().join("existing_sub_recipe.yaml");
std::fs::write(&recipe_path, test_recipe_content).unwrap();
std::fs::write(&sub_recipe_path, sub_recipe_content).unwrap();
let canonical_recipe_path = recipe_path.canonicalize().unwrap();
(temp_dir, canonical_recipe_path)
}