Skip to content

Commit de8168b

Browse files
authored
fix things (#633)
1 parent 1fc0c19 commit de8168b

File tree

1 file changed

+12
-14
lines changed
  • crates/q_cli/src/cli/chat

1 file changed

+12
-14
lines changed

crates/q_cli/src/cli/chat/mod.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,6 @@ Hi, I'm <g>Amazon Q</g>. I can answer questions about your workspace and tooling
401401
async fn prompt_and_send_request(&mut self) -> Result<Option<SendMessageOutput>> {
402402
// Tool uses that need to be executed.
403403
let mut queued_tools: Vec<(String, Tool)> = Vec::new();
404-
// Errors encountered while validating the tool uses.
405-
let mut tool_errors: Vec<ToolResult> = Vec::new();
406404

407405
// Validate the requested tools, updating queued_tools and tool_errors accordingly.
408406
if !self.tool_uses.is_empty() {
@@ -442,7 +440,7 @@ Hi, I'm <g>Amazon Q</g>. I can answer questions about your workspace and tooling
442440
queued_tools.push((tool_use_id, tool));
443441
},
444442
Err(err) => {
445-
tool_errors.push(ToolResult {
443+
tool_results.push(ToolResult {
446444
tool_use_id,
447445
content: vec![ToolResultContentBlock::Text(format!(
448446
"Failed to validate tool parameters: {err}"
@@ -460,18 +458,18 @@ Hi, I'm <g>Amazon Q</g>. I can answer questions about your workspace and tooling
460458
}
461459
self.tool_use_events.push(event_builder);
462460
}
463-
}
464461

465-
// If we have any validation errors, then return them immediately to the model.
466-
if !tool_errors.is_empty() {
467-
debug!(?tool_errors, "Error found in the model tools");
468-
self.conversation_state.add_tool_results(tool_errors);
469-
self.send_tool_use_telemetry().await;
470-
return Ok(Some(
471-
self.client
472-
.send_message(self.conversation_state.as_sendable_conversation_state())
473-
.await?,
474-
));
462+
// If we have any validation errors, then return them immediately to the model.
463+
if !tool_results.is_empty() {
464+
debug!(?tool_results, "Error found in the model tools");
465+
self.conversation_state.add_tool_results(tool_results);
466+
self.send_tool_use_telemetry().await;
467+
return Ok(Some(
468+
self.client
469+
.send_message(self.conversation_state.as_sendable_conversation_state())
470+
.await?,
471+
));
472+
}
475473
}
476474

477475
// If we have tool uses, display them to the user.

0 commit comments

Comments
 (0)