File size: 839 Bytes
8c390e0 5f511f1 8c390e0 5f511f1 8c390e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import gradio as gr
from agent.src.llm.client import infer_model
from agent.src.tools.session_assistant.assistant import chat
def create_tab():
with gr.Tab("Session Assistant"):
gr.Markdown("## Session Assistant\n> Ask anything during your session. RAG lore context will be injected once the vector store is built.")
chatbot = gr.Chatbot(height=450)
with gr.Row():
msg = gr.Textbox(placeholder="Ask something...", show_label=False, scale=5)
send_btn = gr.Button("Send", variant="primary", scale=1)
clear_btn = gr.Button("Clear", variant="secondary")
send_btn.click(fn=chat, inputs=[msg, chatbot], outputs=[msg, chatbot])
msg.submit(fn=chat, inputs=[msg, chatbot], outputs=[msg, chatbot])
clear_btn.click(fn=lambda: ([], ""), outputs=[chatbot, msg])
|