Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -360,40 +360,4 @@ with chat_container:
|
|
360 |
typing_indicator = st.empty()
|
361 |
typing_indicator.markdown("*馃 RoboCopy est谩 escribiendo...*")
|
362 |
process_model_response(new_prompt)
|
363 |
-
update_chat_memory()
|
364 |
-
|
365 |
-
# Procesar nueva entrada si existe (mantener solo esta versi贸n)
|
366 |
-
if new_prompt:
|
367 |
-
with st.chat_message("user", avatar=USER_AVATAR_ICON):
|
368 |
-
st.markdown(new_prompt)
|
369 |
-
add_message("user", new_prompt, USER_AVATAR_ICON)
|
370 |
-
|
371 |
-
try:
|
372 |
-
title_response = st.session_state.model.generate_content(
|
373 |
-
f"T铆tulo para consulta: '{new_prompt}' (m谩ximo 4 palabras)"
|
374 |
-
)
|
375 |
-
st.session_state.chat_title = title_response.text.strip()[:25]
|
376 |
-
except Exception as e:
|
377 |
-
st.session_state.chat_title = f"Chat-{time.strftime('%H:%M')}"
|
378 |
-
|
379 |
-
st.session_state.chats_in_memory[st.session_state.current_chat_id] = {
|
380 |
-
'messages': st.session_state.messages,
|
381 |
-
'gemini_history': st.session_state.gemini_history,
|
382 |
-
'title': st.session_state.chat_title
|
383 |
-
}
|
384 |
-
|
385 |
-
process_model_response(new_prompt)
|
386 |
-
update_chat_memory()
|
387 |
-
# En la secci贸n del SIDEBAR
|
388 |
-
if st.button('馃摑 Nuevo Chat'):
|
389 |
-
st.session_state.update({
|
390 |
-
'current_chat_id': str(time.time()),
|
391 |
-
'messages': [],
|
392 |
-
'gemini_history': [],
|
393 |
-
'chat_title': 'Nuevo Chat',
|
394 |
-
'show_examples': True
|
395 |
-
})
|
396 |
-
st.session_state.chat = st.session_state.model.start_chat(history=[])
|
397 |
-
st.session_state.chat.send_message(SYSTEM_PROMPT)
|
398 |
-
st.session_state.gemini_history = st.session_state.chat.history
|
399 |
-
st.rerun()
|
|
|
360 |
typing_indicator = st.empty()
|
361 |
typing_indicator.markdown("*馃 RoboCopy est谩 escribiendo...*")
|
362 |
process_model_response(new_prompt)
|
363 |
+
update_chat_memory()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|