redhairedshanks1 commited on
Commit
5c130f4
·
1 Parent(s): f950b83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -299,18 +299,37 @@ def chatbot_response_streaming(message: str, history: List, session_id: str, fil
299
  "status": event.get("status", "running"),
300
  "executor": event.get("executor", "unknown")
301
  }
 
 
 
 
 
 
 
 
 
302
  steps_completed.append(step_info)
303
  executor_used = event.get("executor", executor_used)
304
 
 
 
 
 
 
 
 
 
305
  progress_status = {
306
  "status": "executing",
307
- "message": f"📍 Step {event.get('step', 0)}: {event.get('tool', 'processing')}...",
308
  "pipeline": plan.get("pipeline_name", ""),
309
  "executor": executor_used,
 
310
  "steps_completed": steps_completed
311
  }
312
  accumulated_response = f"```json\n{json.dumps(progress_status, indent=2)}\n```"
313
  yield format_chat_history(history, message, accumulated_response)
 
314
 
315
  # Final result
316
  elif event_type == "final":
 
299
  "status": event.get("status", "running"),
300
  "executor": event.get("executor", "unknown")
301
  }
302
+
303
+ # Add observation if available (tool output)
304
+ if "observation" in event:
305
+ step_info["observation"] = event.get("observation")
306
+
307
+ # Add tool input if available
308
+ if "input" in event:
309
+ step_info["input"] = event.get("input")
310
+
311
  steps_completed.append(step_info)
312
  executor_used = event.get("executor", executor_used)
313
 
314
+ # Create more informative status message
315
+ status_message = f"📍 Step {event.get('step', 0)}: {event.get('tool', 'processing')}"
316
+ if event.get('status') == 'completed' and 'observation' in event:
317
+ obs_preview = str(event.get('observation'))[:100]
318
+ status_message += f" ✅\n Output: {obs_preview}..."
319
+ elif event.get('status') == 'executing':
320
+ status_message += " ⏳"
321
+
322
  progress_status = {
323
  "status": "executing",
324
+ "message": status_message,
325
  "pipeline": plan.get("pipeline_name", ""),
326
  "executor": executor_used,
327
+ "current_step": step_info,
328
  "steps_completed": steps_completed
329
  }
330
  accumulated_response = f"```json\n{json.dumps(progress_status, indent=2)}\n```"
331
  yield format_chat_history(history, message, accumulated_response)
332
+
333
 
334
  # Final result
335
  elif event_type == "final":