fix: agent loop for disable response storage (#543)

- Fixes post-merge of #506

---------

Co-authored-by: Ilan Bigio <ilan@openai.com>
This commit is contained in:
Fouad Matin
2025-04-22 13:49:10 -07:00
committed by GitHub
parent f99c9080fd
commit a30e79b768
2 changed files with 184 additions and 73 deletions

View File

@@ -81,7 +81,13 @@ export function parseToolCallArguments(
}
const { cmd, command } = json as Record<string, unknown>;
const commandArray = toStringArray(cmd) ?? toStringArray(command);
// The OpenAI model sometimes produces a single string instead of an array.
// Accept both shapes:
const commandArray =
toStringArray(cmd) ??
toStringArray(command) ??
(typeof cmd === "string" ? [cmd] : undefined) ??
(typeof command === "string" ? [command] : undefined);
if (commandArray == null) {
return undefined;
}