From 8ebab5a25dd026474c4f8c1029092ab4a07b7c62 Mon Sep 17 00:00:00 2001 From: Daniel Campagnoli Date: Thu, 16 Jan 2025 14:27:58 +0800 Subject: [PATCH] Unproxy function call arguments set on agent state in codegen agent Firestore was failing when trying to save a non-simple object --- src/agent/codeGenAgentRunner.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agent/codeGenAgentRunner.ts b/src/agent/codeGenAgentRunner.ts index 655577e..d827bc8 100644 --- a/src/agent/codeGenAgentRunner.ts +++ b/src/agent/codeGenAgentRunner.ts @@ -165,8 +165,8 @@ export async function runCodeGenAgent(agent: AgentContext): Promise { - // // Un-proxy any JsProxy objects. https://pyodide.org/en/stable/usage/type-conversions.html - // args = args.map(arg => typeof arg.toJs === 'function' ? arg.toJs() : arg) + // Un-proxy any JsProxy objects. https://pyodide.org/en/stable/usage/type-conversions.html + args = args.map((arg) => (typeof arg?.toJs === 'function' ? arg.toJs() : arg)); // Convert arg array to parameters name/value map const parameters: { [key: string]: any } = {};