Spaces:
Running
Running
feat: PythonInterpreter via SandboxFusion, fix parse_tool_call for code tags
Browse files
app.py
CHANGED
|
@@ -2963,7 +2963,9 @@ def build_research_agent(
|
|
| 2963 |
yield _emit()
|
| 2964 |
elif tool_name == "PythonInterpreter":
|
| 2965 |
code = str(tool_args.get("code", "")).strip()
|
| 2966 |
-
|
|
|
|
|
|
|
| 2967 |
status_lines.append(f"π turn {turn}: running Python β `{code_preview}`")
|
| 2968 |
yield _emit()
|
| 2969 |
py_result = _call_python_interpreter(code)
|
|
|
|
| 2963 |
yield _emit()
|
| 2964 |
elif tool_name == "PythonInterpreter":
|
| 2965 |
code = str(tool_args.get("code", "")).strip()
|
| 2966 |
+
# Show first non-empty line as preview
|
| 2967 |
+
first_line = next((l.strip() for l in code.splitlines() if l.strip()), code)
|
| 2968 |
+
code_preview = (first_line[:120] + "β¦") if len(first_line) > 120 else first_line
|
| 2969 |
status_lines.append(f"π turn {turn}: running Python β `{code_preview}`")
|
| 2970 |
yield _emit()
|
| 2971 |
py_result = _call_python_interpreter(code)
|