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> {
|
||||
let mut result = std::collections::HashMap::new();
|
||||
for (key, value) in outputs {
|
||||
if let Some(str_value) = value.as_str() {
|
||||
result.insert(key.clone(), str_value.to_string());
|
||||
} else {
|
||||
// Convert non-string values to their YAML string representation
|
||||
result.insert(key.clone(), serde_yaml::to_string(value).unwrap_or_default());
|
||||
match value {
|
||||
serde_yaml::Value::Null => {
|
||||
// For null, we want to output "null" as a string
|
||||
result.insert(key.clone(), "null".to_string());
|
||||
}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user