matuteiglesias's picture
πŸš€ First full upload of tech support chat agent
e601bf1 verified
raw
history blame
2.14 kB
# from Registry.agents.tech_support_chat.agent import ChatSupportAgent
# # /home/matias/dev/my-agents/Registry/agents/tech_support_agent/agent.py
# import gradio as gr
# # from agent import ChatSupportAgent # assumes this matches your current structure
# agent = ChatSupportAgent(agent_name="tech_support_agent")
# def chat_with_agent(user_input, history):
# print("USER INPUT: ", user_input)
# result = agent.run(user_input)['result']
# print("RESULT: ", result)
# response = result#.get("result", "⚠️ Error: No response!!")
# history.append((user_input, response))
# return history, history
# with gr.Blocks() as demo:
# gr.Markdown("# πŸ’» Tech Support Chat Agent\nHelping you solve your tech issues!")
# chatbot = gr.Chatbot()
# msg = gr.Textbox(label="Your question", placeholder="e.g. Why is Python indentation important?")
# state = gr.State([])
# def submit_message(user_message, history):
# return chat_with_agent(user_message, history)
# msg.submit(submit_message, [msg, state], [chatbot, state])
# gr.Button("Clear").click(lambda: ([], []), None, [chatbot, state])
# gr.Markdown("---")
# gr.Markdown("Built with ❀️ using Cerebrum & Gradio")
# demo.launch()
# app.py
import gradio as gr
from Registry.agents.tech_support_chat.agent import ChatSupportAgent
agent = ChatSupportAgent(agent_name="demo_agent")
def chat_with_agent(user_input, history):
result = agent.run(user_input)['result']
history.append((user_input, result))
return history, history
with gr.Blocks() as demo:
gr.Markdown("## πŸ“š Demo Agent – AI Research Assistant")
chatbot = gr.Chatbot()
msg = gr.Textbox(label="Ask a question", placeholder="e.g. Recent papers about LLMs in education")
state = gr.State([])
def submit_message(user_message, history):
return chat_with_agent(user_message, history)
msg.submit(submit_message, [msg, state], [chatbot, state])
gr.Button("Clear").click(lambda: ([], []), None, [chatbot, state])
gr.Markdown("πŸ€– Powered by Cerebrum")
if __name__ == "__main__":
demo.launch()