diff options
| author | sigoden <sigoden@gmail.com> | 2024-10-23 17:22:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 17:22:11 +0800 |
| commit | fbeaa9cb2c5b7a8e0d9114a62c270c6fe8024c31 (patch) | |
| tree | c25b91f61ec2816b4425decedfd451967a003f49 /scripts/run-agent.js | |
| parent | d499954dbbfd9e4d9911d179092385ac0d161e56 (diff) | |
| download | llm-functions-docker-fbeaa9cb2c5b7a8e0d9114a62c270c6fe8024c31.tar.gz | |
feat: improve execute js/py code and collect results (#117)
Diffstat (limited to 'scripts/run-agent.js')
| -rwxr-xr-x | scripts/run-agent.js | 6 |
1 files changed, 2 insertions, 4 deletions
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]") { |
