Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -293,6 +293,8 @@ if st.session_state.show_examples and not st.session_state.messages:
|
|
293 |
st.markdown("---")
|
294 |
|
295 |
# === ENTRADA DEL USUARIO ===
|
|
|
|
|
296 |
if 'user_input' in st.session_state:
|
297 |
prompt = st.session_state.user_input
|
298 |
del st.session_state.user_input
|
@@ -321,18 +323,19 @@ if 'user_input' in st.session_state:
|
|
321 |
process_model_response(prompt)
|
322 |
update_chat_memory()
|
323 |
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
327 |
# Simular el envío del mensaje
|
328 |
with st.chat_message("user", avatar=USER_AVATAR_ICON):
|
329 |
-
st.markdown(
|
330 |
-
add_message("user",
|
331 |
|
332 |
# Actualizar título antes de procesar
|
333 |
try:
|
334 |
title_response = st.session_state.model.generate_content(
|
335 |
-
f"Título para consulta: '{
|
336 |
)
|
337 |
st.session_state.chat_title = title_response.text.strip()[:25]
|
338 |
except Exception as e:
|
@@ -345,5 +348,5 @@ else:
|
|
345 |
}
|
346 |
|
347 |
# Procesar la respuesta una sola vez
|
348 |
-
process_model_response(
|
349 |
update_chat_memory()
|
|
|
293 |
st.markdown("---")
|
294 |
|
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
|
|
|
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:
|
330 |
# Simular el envío del mensaje
|
331 |
with st.chat_message("user", avatar=USER_AVATAR_ICON):
|
332 |
+
st.markdown(new_prompt)
|
333 |
+
add_message("user", new_prompt, USER_AVATAR_ICON)
|
334 |
|
335 |
# Actualizar título antes de procesar
|
336 |
try:
|
337 |
title_response = st.session_state.model.generate_content(
|
338 |
+
f"Título para consulta: '{new_prompt}' (máximo 4 palabras)"
|
339 |
)
|
340 |
st.session_state.chat_title = title_response.text.strip()[:25]
|
341 |
except Exception as e:
|
|
|
348 |
}
|
349 |
|
350 |
# Procesar la respuesta una sola vez
|
351 |
+
process_model_response(new_prompt)
|
352 |
update_chat_memory()
|