Spaces:
Sleeping
Sleeping
Update app.py
Browse files312 unmodified lines313314315316316317318318319320321322323324325325326327328329330331332332333334335312 unmodified lines if isinstance(msg, tuple): if msg[0] in ("update", "result"): # Yield the updated conversation history in proper format. yield gr.Chatbot.update(value=convert_history(msg[1]), visible=True) yield gr.update(value=convert_history(msg[1]), visible=True) else: # For log messages (e.g., "[Orchestrator]", ...), ignore or handle separately. # Log messages can be printed or handled here if needed. pass except queue.Empty: pass time.sleep(0.1) # Final update if needed yield gr.Chatbot.update(visible=True) yield gr.update(visible=True)
# -------------------- Multi-Agent Chat Function --------------------def multi_agent_chat(message: str, openai_api_key: str = None) -> Generator[Any, None, None]: if not openai_api_key: openai_api_key = os.getenv("OPENAI_API_KEY") if not openai_api_key: yield gr.Chatbot.update(value=[{"role": "assistant", "content": "Error: API key not provided."}]) yield gr.update(value=[{"role": "assistant", "content": "Error: API key not provided."}]) return human_event = threading.Event() human_input_queue = queue.Queue()app.py+4-4