segoedu commited on
Commit
5c45ef1
1 Parent(s): 5266c29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -46,7 +46,7 @@ def mostrar_logs(logs,hints):
46
  st.sidebar.header("Registro de preguntas")
47
  for entry in logs:
48
  st.sidebar.write(f"**Pregunta: {entry['Pregunta']}**")
49
- st.sidebar.write(f"Respuesta: green[{str(result)}]")
50
 
51
 
52
  # Lista para almacenar preguntas y respuestas
@@ -58,7 +58,12 @@ if user_question:
58
  # Obtenemos la respuesta
59
  respuesta = qa.invoke(user_question)
60
  docs = respuesta['source_documents']
61
- result = respuesta['result']
 
 
 
 
 
62
 
63
  # Mostrar la variable en color verde
64
  st.subheader("Respuesta")
 
46
  st.sidebar.header("Registro de preguntas")
47
  for entry in logs:
48
  st.sidebar.write(f"**Pregunta: {entry['Pregunta']}**")
49
+ st.sidebar.write(f"Respuesta: {entry['Respuesta']}")
50
 
51
 
52
  # Lista para almacenar preguntas y respuestas
 
58
  # Obtenemos la respuesta
59
  respuesta = qa.invoke(user_question)
60
  docs = respuesta['source_documents']
61
+ #result = respuesta['result']
62
+ if isinstance(respuesta['result'], list):
63
+ result = respuesta['result'][0] # Tomar el primer elemento de la lista
64
+ else:
65
+ result = respuesta['result']
66
+
67
 
68
  # Mostrar la variable en color verde
69
  st.subheader("Respuesta")