aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/run-tool.js
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-10-23 17:22:11 +0800
committerGitHub <noreply@github.com>2024-10-23 17:22:11 +0800
commitfbeaa9cb2c5b7a8e0d9114a62c270c6fe8024c31 (patch)
treec25b91f61ec2816b4425decedfd451967a003f49 /scripts/run-tool.js
parentd499954dbbfd9e4d9911d179092385ac0d161e56 (diff)
downloadllm-functions-docker-fbeaa9cb2c5b7a8e0d9114a62c270c6fe8024c31.tar.gz
feat: improve execute js/py code and collect results (#117)
Diffstat (limited to 'scripts/run-tool.js')
-rwxr-xr-xscripts/run-tool.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/scripts/run-tool.js b/scripts/run-tool.js
index e4ac434..4a806f3 100755
--- a/scripts/run-tool.js
+++ b/scripts/run-tool.js
@@ -74,9 +74,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);
@@ -116,7 +114,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]") {