-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
26 lines (20 loc) · 863 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import streamlit as st
from ethan.ethan_agent import EthanAgent
ethanAgent = EthanAgent()
st.title("💬 Ethan SQL Assistant")
if "messages" not in st.session_state:
st.session_state["messages"] = [
{"role": "assistant",
"content": """Hi, I'm Ethan, a SQL assistant.
I'm here to help you query and generate reports on your Music Database.
How can I help you?
"""}]
for msg in st.session_state.messages:
st.chat_message(msg["role"]).write(msg["content"])
if prompt := st.chat_input():
st.session_state.messages.append({"role": "user", "content": prompt})
st.chat_message("user").write(prompt)
response = ethanAgent.run(prompt, st.session_state["messages"])
st.session_state.messages.append(
{"role": "assistant", "content": response})
st.chat_message("assistant").write(response)