fix: handle null values in YAML output conversion
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -161,11 +161,18 @@ fn convert_outputs_to_string_map(
|
|||||||
) -> std::collections::HashMap<String, String> {
|
) -> std::collections::HashMap<String, String> {
|
||||||
let mut result = std::collections::HashMap::new();
|
let mut result = std::collections::HashMap::new();
|
||||||
for (key, value) in outputs {
|
for (key, value) in outputs {
|
||||||
if let Some(str_value) = value.as_str() {
|
match value {
|
||||||
result.insert(key.clone(), str_value.to_string());
|
serde_yaml::Value::Null => {
|
||||||
} else {
|
// For null, we want to output "null" as a string
|
||||||
// Convert non-string values to their YAML string representation
|
result.insert(key.clone(), "null".to_string());
|
||||||
result.insert(key.clone(), serde_yaml::to_string(value).unwrap_or_default());
|
}
|
||||||
|
serde_yaml::Value::String(s) => {
|
||||||
|
result.insert(key.clone(), s.clone());
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
// Convert other values to their YAML string representation
|
||||||
|
result.insert(key.clone(), serde_yaml::to_string(value).unwrap_or_default());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
|
|||||||
Reference in New Issue
Block a user