Skip to content

Commit 64de7c4

Browse files
committed
Refactor processOutput to streamline result type handling
1 parent 18d48cf commit 64de7c4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/agent/src/Toolbox/AgentProcessor.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,24 @@ public function processInput(Input $input): void
7676

7777
public function processOutput(Output $output): void
7878
{
79-
if ($output->getResult() instanceof GenericStreamResponse) {
79+
$result = $output->getResult();
80+
81+
if ($result instanceof GenericStreamResponse) {
8082
$output->setResult(
81-
new ToolboxStreamResponse($output->getResult()->getContent(), $this->handleToolCallsCallback($output))
83+
new ToolboxStreamResponse(
84+
$result,
85+
$this->handleToolCallsCallback($output)
86+
)
8287
);
8388

8489
return;
8590
}
8691

87-
if (!$output->getResult() instanceof ToolCallResult) {
92+
if (!$result instanceof ToolCallResult) {
8893
return;
8994
}
9095

91-
$output->setResult($this->handleToolCallsCallback($output)($output->getResult()));
96+
$output->setResult($this->handleToolCallsCallback($output)($result));
9297
}
9398

9499
/**

0 commit comments

Comments
 (0)