From fbeaa9cb2c5b7a8e0d9114a62c270c6fe8024c31 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 23 Oct 2024 17:22:11 +0800 Subject: feat: improve execute js/py code and collect results (#117) --- scripts/run-agent.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'scripts/run-agent.js') diff --git a/scripts/run-agent.js b/scripts/run-agent.js index b8dddd0..c59ff6e 100755 --- a/scripts/run-agent.js +++ b/scripts/run-agent.js @@ -87,9 +87,7 @@ async function loadEnv(filePath) { if (!process.env[envName]) { let envValue = valueParts.join("=").trim(); - if (envValue.startsWith('"') && envValue.endsWith('"')) { - envValue = envValue.slice(1, -1); - } else if (envValue.startsWith("'") && envValue.endsWith("'")) { + if ((envValue.startsWith('"') && envValue.endsWith('"')) || (envValue.startsWith("'") && envValue.endsWith("'"))) { envValue = envValue.slice(1, -1); } envVars.set(envName, envValue); @@ -129,7 +127,7 @@ function returnToLLM(value) { } const type = typeof value; if (type === "string" || type === "number" || type === "boolean") { - writer.write(value); + writer.write(value.toString()); } else if (type === "object") { const proto = Object.prototype.toString.call(value); if (proto === "[object Object]" || proto === "[object Array]") { -- cgit v1.2.3