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-tool.py | |
| 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-tool.py')
| -rwxr-xr-x | scripts/run-tool.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/scripts/run-tool.py b/scripts/run-tool.py index 6ea3361..e6c0c8f 100755 --- a/scripts/run-tool.py +++ b/scripts/run-tool.py @@ -72,9 +72,7 @@ def load_env(file_path): if env_name not in os.environ: env_value = "=".join(value_parts).strip() - if env_value.startswith('"') and env_value.endswith('"'): - env_value = env_value[1:-1] - elif env_value.startswith("'") and env_value.endswith("'"): + if (env_value.startswith('"') and env_value.endswith('"')) or (env_value.startswith("'") and env_value.endswith("'")): env_value = env_value[1:-1] env_vars[env_name] = env_value @@ -110,7 +108,7 @@ def return_to_llm(value): value_type = type(value).__name__ if value_type in ("str", "int", "float", "bool"): - writer.write(value) + writer.write(str(value)) elif value_type == "dict" or value_type == "list": value_str = json.dumps(value, indent=2) assert value == json.loads(value_str) |
