Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def get_response(user_input, history, api_url=API_URL):
|
|
| 49 |
if not is_valid:
|
| 50 |
return error_message
|
| 51 |
|
| 52 |
-
# Incluir el historial en el payload
|
| 53 |
payload = {"question": user_input, "history": history}
|
| 54 |
response = query(payload, api_url)
|
| 55 |
return response.get('text', "Error: No API response.")
|
|
@@ -106,6 +106,9 @@ with st.form(key='my_form', clear_on_submit=True):
|
|
| 106 |
st.session_state['generated'].append(output)
|
| 107 |
st.session_state['history'].append({"user": user_input, "bot": output})
|
| 108 |
|
|
|
|
|
|
|
|
|
|
| 109 |
# Mostrar el historial del chat
|
| 110 |
with chat_container.container():
|
| 111 |
for i in range(len(st.session_state['generated'])):
|
|
|
|
| 49 |
if not is_valid:
|
| 50 |
return error_message
|
| 51 |
|
| 52 |
+
# Incluir el historial completo en el payload
|
| 53 |
payload = {"question": user_input, "history": history}
|
| 54 |
response = query(payload, api_url)
|
| 55 |
return response.get('text', "Error: No API response.")
|
|
|
|
| 106 |
st.session_state['generated'].append(output)
|
| 107 |
st.session_state['history'].append({"user": user_input, "bot": output})
|
| 108 |
|
| 109 |
+
# Crear una nueva sesi贸n con todo el historial
|
| 110 |
+
st.session_state['history'] = [{"user": user_input, "bot": output} for user_input, output in zip(st.session_state['past'], st.session_state['generated'])]
|
| 111 |
+
|
| 112 |
# Mostrar el historial del chat
|
| 113 |
with chat_container.container():
|
| 114 |
for i in range(len(st.session_state['generated'])):
|