Spaces:
Running
Running
Pulastya B commited on
Commit Β·
6222009
1
Parent(s): 1750ce2
FIX CRITICAL: Remove emoji from print statements causing Unicode encoding errors
Browse files- src/api/app.py +3 -3
- src/orchestrator.py +3 -3
- src/progress_manager.py +3 -3
src/api/app.py
CHANGED
|
@@ -192,7 +192,7 @@ async def stream_progress(session_id: str):
|
|
| 192 |
- token_update: Token budget updates
|
| 193 |
- analysis_complete: When the entire workflow finishes
|
| 194 |
"""
|
| 195 |
-
print(f"
|
| 196 |
|
| 197 |
async def event_generator():
|
| 198 |
try:
|
|
@@ -331,7 +331,7 @@ async def run_analysis(
|
|
| 331 |
|
| 332 |
# Set HTTP session key for SSE streaming (so orchestrator emits to correct stream)
|
| 333 |
agent.http_session_key = session_key
|
| 334 |
-
print(f"
|
| 335 |
|
| 336 |
try:
|
| 337 |
# Agent's session memory should resolve file_path from context
|
|
@@ -450,7 +450,7 @@ async def run_analysis(
|
|
| 450 |
|
| 451 |
# Set HTTP session key for SSE streaming (so orchestrator emits to correct stream)
|
| 452 |
agent.http_session_key = session_key
|
| 453 |
-
print(f"
|
| 454 |
|
| 455 |
# Call existing agent logic
|
| 456 |
logger.info(f"Starting analysis with task: {task_description}")
|
|
|
|
| 192 |
- token_update: Token budget updates
|
| 193 |
- analysis_complete: When the entire workflow finishes
|
| 194 |
"""
|
| 195 |
+
print(f"[SSE] ENDPOINT: Client connected for session_id={session_id}")
|
| 196 |
|
| 197 |
async def event_generator():
|
| 198 |
try:
|
|
|
|
| 331 |
|
| 332 |
# Set HTTP session key for SSE streaming (so orchestrator emits to correct stream)
|
| 333 |
agent.http_session_key = session_key
|
| 334 |
+
print(f"[SSE] SET agent.http_session_key = {session_key}")
|
| 335 |
|
| 336 |
try:
|
| 337 |
# Agent's session memory should resolve file_path from context
|
|
|
|
| 450 |
|
| 451 |
# Set HTTP session key for SSE streaming (so orchestrator emits to correct stream)
|
| 452 |
agent.http_session_key = session_key
|
| 453 |
+
print(f"[SSE] SET agent.http_session_key = {session_key} (file upload)")
|
| 454 |
|
| 455 |
# Call existing agent logic
|
| 456 |
logger.info(f"Starting analysis with task: {task_description}")
|
src/orchestrator.py
CHANGED
|
@@ -3039,10 +3039,10 @@ You are a DOER. Complete workflows based on user intent."""
|
|
| 3039 |
if not session_key_for_emit and hasattr(self, 'session') and self.session:
|
| 3040 |
session_key_for_emit = self.session.session_id
|
| 3041 |
|
| 3042 |
-
print(f"
|
| 3043 |
|
| 3044 |
if session_key_for_emit:
|
| 3045 |
-
print(f"
|
| 3046 |
progress_manager.emit(session_key_for_emit, {
|
| 3047 |
'type': 'tool_executing',
|
| 3048 |
'tool': tool_name,
|
|
@@ -3050,7 +3050,7 @@ You are a DOER. Complete workflows based on user intent."""
|
|
| 3050 |
'arguments': tool_args
|
| 3051 |
})
|
| 3052 |
else:
|
| 3053 |
-
print(f"
|
| 3054 |
|
| 3055 |
# Execute tool
|
| 3056 |
tool_result = self._execute_tool(tool_name, tool_args)
|
|
|
|
| 3039 |
if not session_key_for_emit and hasattr(self, 'session') and self.session:
|
| 3040 |
session_key_for_emit = self.session.session_id
|
| 3041 |
|
| 3042 |
+
print(f"[SSE] DEBUG EMIT: http_session_key={getattr(self, 'http_session_key', 'NOT SET')}, session={hasattr(self, 'session')}, final_key={session_key_for_emit}")
|
| 3043 |
|
| 3044 |
if session_key_for_emit:
|
| 3045 |
+
print(f"[SSE] EMITTING tool_executing for session: {session_key_for_emit}, tool: {tool_name}")
|
| 3046 |
progress_manager.emit(session_key_for_emit, {
|
| 3047 |
'type': 'tool_executing',
|
| 3048 |
'tool': tool_name,
|
|
|
|
| 3050 |
'arguments': tool_args
|
| 3051 |
})
|
| 3052 |
else:
|
| 3053 |
+
print(f"[SSE] WARNING: SKIPPING EMIT: No session key available")
|
| 3054 |
|
| 3055 |
# Execute tool
|
| 3056 |
tool_result = self._execute_tool(tool_name, tool_args)
|
src/progress_manager.py
CHANGED
|
@@ -36,7 +36,7 @@ class ProgressManager:
|
|
| 36 |
session_id: Session identifier
|
| 37 |
event: Event data (must include 'type' and 'message')
|
| 38 |
"""
|
| 39 |
-
print(f"
|
| 40 |
|
| 41 |
# Add timestamp
|
| 42 |
event['timestamp'] = datetime.now().isoformat()
|
|
@@ -48,11 +48,11 @@ class ProgressManager:
|
|
| 48 |
if len(self._history[session_id]) > 500:
|
| 49 |
self._history[session_id] = self._history[session_id][-500:]
|
| 50 |
|
| 51 |
-
print(f"
|
| 52 |
|
| 53 |
# Send to all active subscribers
|
| 54 |
if session_id in self._queues:
|
| 55 |
-
print(f"
|
| 56 |
dead_queues = []
|
| 57 |
for queue in self._queues[session_id]:
|
| 58 |
try:
|
|
|
|
| 36 |
session_id: Session identifier
|
| 37 |
event: Event data (must include 'type' and 'message')
|
| 38 |
"""
|
| 39 |
+
print(f"[SSE] PROGRESS_MANAGER EMIT: session={session_id}, event_type={event.get('type')}, msg={event.get('message', '')[:50]}")
|
| 40 |
|
| 41 |
# Add timestamp
|
| 42 |
event['timestamp'] = datetime.now().isoformat()
|
|
|
|
| 48 |
if len(self._history[session_id]) > 500:
|
| 49 |
self._history[session_id] = self._history[session_id][-500:]
|
| 50 |
|
| 51 |
+
print(f"[SSE] History stored, total events for {session_id}: {len(self._history[session_id])}")
|
| 52 |
|
| 53 |
# Send to all active subscribers
|
| 54 |
if session_id in self._queues:
|
| 55 |
+
print(f"[SSE] Found {len(self._queues[session_id])} subscribers for {session_id}")
|
| 56 |
dead_queues = []
|
| 57 |
for queue in self._queues[session_id]:
|
| 58 |
try:
|