Add debug output to trace console routing
This commit is contained in:
parent
3e5803d41b
commit
161ddee138
1 changed files with 8 additions and 7 deletions
|
|
@ -125,18 +125,19 @@ async def handle_response_print(payload: ShoutedResponse, metadata: HandlerMetad
|
||||||
Print the final response to the console.
|
Print the final response to the console.
|
||||||
|
|
||||||
Routes output to the TUI console if available, otherwise prints to stdout.
|
Routes output to the TUI console if available, otherwise prints to stdout.
|
||||||
With TUI, stdout is patched so prints appear in the output area.
|
|
||||||
"""
|
"""
|
||||||
console = None
|
console = None
|
||||||
try:
|
try:
|
||||||
from run_organism import get_console
|
from run_organism import get_console
|
||||||
console = get_console()
|
console = get_console()
|
||||||
except ImportError:
|
except ImportError as e:
|
||||||
pass
|
print(f"[DEBUG] ImportError: {e}")
|
||||||
|
|
||||||
if console is not None and hasattr(console, 'on_response'):
|
if console is not None:
|
||||||
# Use TUI's output buffer directly (preferred)
|
if hasattr(console, 'on_response'):
|
||||||
console.on_response("shouter", payload)
|
console.on_response("shouter", payload)
|
||||||
|
else:
|
||||||
|
print(f"[DEBUG] console has no on_response: {type(console)}")
|
||||||
else:
|
else:
|
||||||
# Print to stdout (TUI patches this, simple mode shows directly)
|
print(f"[DEBUG] console is None, printing to stdout")
|
||||||
print(f"\033[36m[response] {payload.message}\033[0m")
|
print(f"\033[36m[response] {payload.message}\033[0m")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue