Skip to content

Commit 8ec2798

Browse files
committed
added persisted chart in history
1 parent 09b58ec commit 8ec2798

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

StreamLit-App/chat_bot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from openai import OpenAI
66
from utils.sidebar_info import display_sidebar_info, display_main_info
77
from utils.lakera_guard import LakeraGuard
8+
from streamlit_echarts import st_echarts
89

910
from utils.chatbot_utils import (
1011
handle_chat_message,
@@ -38,8 +39,11 @@ def chat_bot(username=None):
3839
content = message["content"]
3940
avatar = message.get("avatar")
4041

41-
with st.chat_message(role, avatar=avatar):
42-
st.markdown(content)
42+
if content == "chart":
43+
st_echarts(options=message["chart_options"], height="400px", theme="dark")
44+
else:
45+
with st.chat_message(role, avatar=avatar):
46+
st.markdown(content)
4347

4448
lakera_guard = LakeraGuard(lakera_guard_api_key)
4549
user_input = st.chat_input("Ingresa tu pregunta:")

StreamLit-App/utils/chart_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def display_chart_and_warning(
3333
if key
3434
else st_echarts(options=options, height=height, theme=theme)
3535
)
36+
st.session_state.chat_history.append(
37+
{"role": "assistant", "content": "chart", "chart_options": options}
38+
)
39+
3640
if write_s and s is not None:
3741
st.write(s)
3842
st.markdown(

StreamLit-App/utils/sidebar_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def display_sidebar_info():
154154
"Doc hazme una plantilla de email de problema de conexión",
155155
"doc ¿Quál es la operativa para responder un email?",
156156
"!como se llama el programa de ticketing? enumera los puntos de como utilizarlo",
157-
"! qual es el roadmap del proyecto, que se ha cumplido y que no?",
157+
"!Roadmap del proyecto, que se ha cumplido y que no? marca con un check y dame links",
158158
"!¿Qué podemos hacer con el chatbot?",
159159
"!Operativa flujo de trabajo con emails porfavor",
160160
]

0 commit comments

Comments
 (0)