mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: serialize non-string text_result in pure ref path
text_result can be a JSON object/number/boolean, not just a string. Serialize non-string values to text instead of dropping them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -318,10 +318,13 @@ impl CodeExecutionClient {
|
||||
.output
|
||||
.as_ref()
|
||||
.and_then(|v| v.get("text_result"))
|
||||
.and_then(|v| v.as_str())
|
||||
.filter(|s| !s.is_empty())
|
||||
.unwrap_or("Tool returned rich content.");
|
||||
let mut contents = vec![Content::text(text_fallback)];
|
||||
.and_then(|v| match v {
|
||||
Value::String(s) if !s.is_empty() => Some(s.clone()),
|
||||
Value::Null | Value::String(_) => None,
|
||||
other => Some(other.to_string()),
|
||||
})
|
||||
.unwrap_or_else(|| "Tool returned rich content.".to_string());
|
||||
let mut contents = vec![Content::text(&text_fallback)];
|
||||
contents.extend(rich_contents);
|
||||
Ok(contents)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user