From 9b6d626a0972c2d7a0110a2f7e1e3468a2338268 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Wed, 19 Mar 2025 14:59:48 +0530 Subject: [PATCH] Fix to store e2b code execution text output file content as string Previously was encoding E2B code execution text output content as b64. This was breaking - The AI model's ability to see the content of the file - Downloading the output text file with appropriately encoded content Issue created when adding E2B code sandbox in #1120 --- src/khoj/processor/tools/run_code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/processor/tools/run_code.py b/src/khoj/processor/tools/run_code.py index 12e65670..419e81ed 100644 --- a/src/khoj/processor/tools/run_code.py +++ b/src/khoj/processor/tools/run_code.py @@ -257,7 +257,7 @@ async def execute_e2b(code: str, input_files: list[dict]) -> dict[str, Any]: continue else: # Text files - encode utf-8 string as base64 - b64_data = base64.b64encode(content.encode("utf-8")).decode("utf-8") + b64_data = content output_files.append({"filename": f.name, "b64_data": b64_data}) # Collect output files from execution results