Update app.py
Browse files
app.py
CHANGED
@@ -120,13 +120,13 @@ if selected == "System Prompt":
|
|
120 |
elif selected == "Chatbot":
|
121 |
model = load_gemini_pro()
|
122 |
|
123 |
-
|
124 |
loaded_chat = load_chat_history()
|
125 |
-
|
126 |
st.session_state.chat_session = loaded_chat
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
st.session_state.chat_session.send_message(st.session_state.system_prompt)
|
131 |
|
132 |
st.title("Gnosticdev Chatbot")
|
@@ -145,7 +145,7 @@ elif selected == "Chatbot":
|
|
145 |
if user_prompt:
|
146 |
st.chat_message("user").markdown(user_prompt)
|
147 |
|
148 |
-
|
149 |
urls = st.session_state.get('cookie_urls', [])
|
150 |
fetched_contents = []
|
151 |
|
|
|
120 |
elif selected == "Chatbot":
|
121 |
model = load_gemini_pro()
|
122 |
|
123 |
+
if "chat_session" not in st.session_state:
|
124 |
loaded_chat = load_chat_history()
|
125 |
+
if loaded_chat:
|
126 |
st.session_state.chat_session = loaded_chat
|
127 |
+
else:
|
128 |
+
st.session_state.chat_session = model.start_chat(history=[])
|
129 |
+
if st.session_state.system_prompt:
|
130 |
st.session_state.chat_session.send_message(st.session_state.system_prompt)
|
131 |
|
132 |
st.title("Gnosticdev Chatbot")
|
|
|
145 |
if user_prompt:
|
146 |
st.chat_message("user").markdown(user_prompt)
|
147 |
|
148 |
+
# Obtener las URLs guardadas
|
149 |
urls = st.session_state.get('cookie_urls', [])
|
150 |
fetched_contents = []
|
151 |
|