silvanocerza commited on
Commit
cc59a7b
β€’
1 Parent(s): 8d18428

Show better sources

Browse files
Files changed (1) hide show
  1. main.py +5 -6
main.py CHANGED
@@ -148,7 +148,7 @@ with st.status(
148
  st.session_state["expanded"] = False
149
 
150
 
151
- st.header("Documentation finder", divider="rainbow")
152
 
153
  st.caption(
154
  f"Use this to search answers for {', '.join([d[0] for d in DOCUMENTATIONS])}"
@@ -164,14 +164,13 @@ if question := st.text_input(
164
  st.balloons()
165
  st.session_state["run_once"] = True
166
 
167
- print(answer.data)
168
  st.markdown(answer.data)
169
  with st.expander("See sources:"):
170
  for document in answer.documents:
171
  url_source = document.metadata.get("url_source", "")
172
- content = f"{url_source}: {document.text}" if url_source else document.text
173
- if document.metadata.get("type") == "md":
174
- st.markdown(content)
175
  else:
176
- st.write(content)
177
  st.divider()
 
148
  st.session_state["expanded"] = False
149
 
150
 
151
+ st.header("πŸ”Ž Documentation finder", divider="rainbow")
152
 
153
  st.caption(
154
  f"Use this to search answers for {', '.join([d[0] for d in DOCUMENTATIONS])}"
 
164
  st.balloons()
165
  st.session_state["run_once"] = True
166
 
 
167
  st.markdown(answer.data)
168
  with st.expander("See sources:"):
169
  for document in answer.documents:
170
  url_source = document.metadata.get("url_source", "")
171
+ st.write(url_source)
172
+ if document.metadata.get("suffix") == ".md":
173
+ st.markdown(document.text)
174
  else:
175
+ st.write(document.text)
176
  st.divider()