fix(provider): complete ChatResponse integration across runtime surfaces
This commit is contained in:
parent
3b4a4de457
commit
34306e32d8
3 changed files with 229 additions and 66 deletions
|
|
@ -220,15 +220,27 @@ impl Tool for DelegateTool {
|
|||
};
|
||||
|
||||
match result {
|
||||
Ok(response) => Ok(ToolResult {
|
||||
success: true,
|
||||
output: format!(
|
||||
"[Agent '{agent_name}' ({provider}/{model})]\n{response}",
|
||||
provider = agent_config.provider,
|
||||
model = agent_config.model
|
||||
),
|
||||
error: None,
|
||||
}),
|
||||
Ok(response) => {
|
||||
let has_tool_calls = response.has_tool_calls();
|
||||
let mut rendered = response.text.unwrap_or_default();
|
||||
if rendered.trim().is_empty() {
|
||||
if has_tool_calls {
|
||||
rendered = "[Tool-only response; no text content]".to_string();
|
||||
} else {
|
||||
rendered = "[Empty response]".to_string();
|
||||
}
|
||||
}
|
||||
|
||||
Ok(ToolResult {
|
||||
success: true,
|
||||
output: format!(
|
||||
"[Agent '{agent_name}' ({provider}/{model})]\n{rendered}",
|
||||
provider = agent_config.provider,
|
||||
model = agent_config.model
|
||||
),
|
||||
error: None,
|
||||
})
|
||||
}
|
||||
Err(e) => Ok(ToolResult {
|
||||
success: false,
|
||||
output: String::new(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue