Spaces:
Paused
Paused
Update app.py
Browse files65 unmodified lines6667686969707171727374757677767879788081828365 unmodified linesdef _log_call_start(func_name: str, **kwargs: Any) -> None: try: compact = {k: _serialize_input(v) for k, v in kwargs.items()} # Use sys.__stdout__ to avoid capturing logs in redirected output print(f"[TOOL CALL] {func_name} inputs: {json.dumps(compact, ensure_ascii=False)[:800]}", flush=True) print(f"[TOOL CALL] {func_name} inputs: {json.dumps(compact, ensure_ascii=False)[:800]}", flush=True, file=sys.__stdout__) except Exception as exc: print(f"[TOOL CALL] {func_name} (failed to log inputs: {exc})", flush=True) print(f"[TOOL CALL] {func_name} (failed to log inputs: {exc})", flush=True, file=sys.__stdout__)
def _log_call_end(func_name: str, output_desc: str) -> None: try: # Use sys.__stdout__ to avoid capturing logs in redirected output print(f"[TOOL RESULT] {func_name} output: {output_desc}", flush=True) print(f"[TOOL RESULT] {func_name} output: {output_desc}", flush=True, file=sys.__stdout__) except Exception as exc: print(f"[TOOL RESULT] {func_name} (failed to log output: {exc})", flush=True) print(f"[TOOL RESULT] {func_name} (failed to log output: {exc})", flush=True, file=sys.__stdout__)
# Ensure Tools modules can import 'app' when this file is executed as a script# (their code does `from app import ...`).app.py+6-4