Spaces:
Sleeping
Sleeping
Update app.py
Browse files312 unmodified lines313314315316317318319320321322323324325326327328329330331332333334335312 unmodified linesif 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)else:# For log messages (e.g., "[Orchestrator]", ...), ignore or handle separately.passexcept queue.Empty:passtime.sleep(0.1)# Final update if neededyield gr.Chatbot.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."}])returnhuman_event = threading.Event()human_input_queue = queue.Queue()312 unmodified lines313314315316317318319320321322323324325326327328329330331332333334335312 unmodified linesif isinstance(msg, tuple):if msg[0] in ("update", "result"):# Yield the updated conversation history in proper format.yield gr.update(value=convert_history(msg[1]), visible=True)else:# Log messages can be printed or handled here if needed.passexcept queue.Empty:passtime.sleep(0.1)# Final update if neededyield 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.update(value=[{"role": "assistant", "content": "Error: API key not provided."}])returnhuman_event = threading.Event()human_input_queue = queue.Queue()
app.py+4-4