Skip to content

Commit f5df278

Browse files
authored
Merge pull request #9 from togethercomputer/fede/maybe-solves
Fede/maybe solves
2 parents b61054a + c9277bd commit f5df278

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

interpreter/code_executor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ async def execute(self, code: str, session: Session) -> Any:
7777
session.namespace.update(self.safe_builtins)
7878

7979
original_cwd = os.getcwd()
80+
os.chdir("/app/custom_data")
8081
try:
81-
os.chdir("/app/custom_data")
82-
82+
8383
with redirect_stdout(stdout_capture), redirect_stderr(stderr_capture):
8484
result = eval(
8585
compile(code, "<string>", "eval"),

open_data_scientist/utils/executors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ def execute_code_internal(
142142
outputs_list: list[dict[str, Any]] = []
143143
errors_list: list[str] = []
144144

145+
# NOTE: that here i am trying to reconstruct the output of TCI, but it is not perfect.
146+
# Seems to work for most cases, but not all.
147+
145148
if raw_response.get("success"):
146149
execution_summary_input["status"] = "success"
147150
result_data = raw_response.get("result")

open_data_scientist/utils/strings.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def save_image_to_disk(b64_image, filename=None):
301301
console.print(f"[dim]💾 Image saved as: {filename}[/dim]")
302302
return filename
303303
except Exception as e:
304-
console.print(f"[red]Error saving image: {e}[/red]")
304+
console.print(f"⚠️ [yellow]Warning/Issue Detected - Error saving image: {e}[/yellow]")
305305
return None
306306

307307

@@ -322,11 +322,11 @@ def print_rich_execution_result(
322322
if parsed.has_errors:
323323
error_text = "\n".join(parsed.errors)
324324
if text_output:
325-
text_output = f"{text_output}\n\n[bold red]Errors:[/bold red]\n{error_text}"
325+
text_output = f"{text_output}\n\n⚠️ [bold yellow]Warning/Issue Detected:[/bold yellow]\n{error_text}"
326326
else:
327-
text_output = f"[bold red]Error:[/bold red]\n{error_text}"
328-
emoji = ""
329-
border_style = "red"
327+
text_output = f"⚠️ [bold yellow]Warning/Issue Detected:[/bold yellow]\n{error_text}"
328+
emoji = "⚠️"
329+
border_style = "yellow"
330330
else:
331331
# If we have images, mention them in the text
332332
if parsed.has_images:

0 commit comments

Comments
 (0)