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.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'scripts/run-agent.py') diff --git a/scripts/run-agent.py b/scripts/run-agent.py index 58595e4..780267d 100755 --- a/scripts/run-agent.py +++ b/scripts/run-agent.py @@ -77,9 +77,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 @@ -150,7 +148,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) -- cgit v1.2.3