import gradio as gr from controllers.chat import chat_controller from services.state import get_state from utilities.constants import FW_DEFAULT_OPTION, CHAT_EXAMPLES def chats_yielding(prompt: str, histories: list[list]): for msg in chat_controller(prompt, histories, get_state('fw_option', FW_DEFAULT_OPTION)): yield msg def chat_interface(): return gr.ChatInterface( title="Chat AI", fn=chats_yielding, examples=CHAT_EXAMPLES, retry_btn=None, undo_btn=None )