JeCabrera commited on
Commit
bfb4d5a
·
verified ·
1 Parent(s): c876db8

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -262,14 +262,12 @@ if not st.session_state.gemini_history:
262
  st.session_state.gemini_history = st.session_state.chat.history
263
 
264
  # === MOSTRAR MENSAJES DEL HISTORIAL ===
265
- for message in st.session_state.messages:
266
- with st.chat_message(name=message['role'], avatar=message.get('avatar', USER_AVATAR_ICON if message['role'] == 'user' else AI_AVATAR_ICON)):
267
- st.markdown(message['content'])
268
 
269
- # === SECCIÓN DE EJEMPLOS ===
270
- if st.session_state.show_examples and not st.session_state.messages:
271
- main_container = st.container()
272
- with main_container:
273
  st.title("💡 RoboCopy - Asistente de PUVs")
274
  st.markdown("### Tu experto en crear Propuestas Únicas de Valor que convierten")
275
  st.markdown("### 🎯 Prueba estos ejemplos:")
@@ -295,11 +293,16 @@ if st.session_state.show_examples and not st.session_state.messages:
295
  # === ENTRADA DEL USUARIO ===
296
  chat_input_container = st.container()
297
 
 
 
 
 
 
 
298
  if 'user_input' in st.session_state:
299
  prompt = st.session_state.user_input
300
  del st.session_state.user_input
301
 
302
- # Simular el envío del mensaje
303
  with st.chat_message("user", avatar=USER_AVATAR_ICON):
304
  st.markdown(prompt)
305
  add_message("user", prompt, USER_AVATAR_ICON)
@@ -323,7 +326,7 @@ if 'user_input' in st.session_state:
323
  process_model_response(prompt)
324
  update_chat_memory()
325
 
326
- # Mantener el chat_input siempre visible
327
  with chat_input_container:
328
  new_prompt = st.chat_input('¿En qué puedo ayudarte hoy?')
329
  if new_prompt:
 
262
  st.session_state.gemini_history = st.session_state.chat.history
263
 
264
  # === MOSTRAR MENSAJES DEL HISTORIAL ===
265
+ messages_container = st.container()
266
+ chat_input_container = st.container()
 
267
 
268
+ with messages_container:
269
+ # === SECCIÓN DE EJEMPLOS ===
270
+ if st.session_state.show_examples and not st.session_state.messages:
 
271
  st.title("💡 RoboCopy - Asistente de PUVs")
272
  st.markdown("### Tu experto en crear Propuestas Únicas de Valor que convierten")
273
  st.markdown("### 🎯 Prueba estos ejemplos:")
 
293
  # === ENTRADA DEL USUARIO ===
294
  chat_input_container = st.container()
295
 
296
+ # Mostrar mensajes existentes
297
+ for message in st.session_state.messages:
298
+ with st.chat_message(name=message['role'], avatar=message.get('avatar', USER_AVATAR_ICON if message['role'] == 'user' else AI_AVATAR_ICON)):
299
+ st.markdown(message['content'])
300
+
301
+ # Procesar entrada del usuario si existe
302
  if 'user_input' in st.session_state:
303
  prompt = st.session_state.user_input
304
  del st.session_state.user_input
305
 
 
306
  with st.chat_message("user", avatar=USER_AVATAR_ICON):
307
  st.markdown(prompt)
308
  add_message("user", prompt, USER_AVATAR_ICON)
 
326
  process_model_response(prompt)
327
  update_chat_memory()
328
 
329
+ # Mantener el chat_input siempre visible al final
330
  with chat_input_container:
331
  new_prompt = st.chat_input('¿En qué puedo ayudarte hoy?')
332
  if new_prompt: