Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -287,22 +287,33 @@ def search_glossary(query):
|
|
| 287 |
st.code(response2[1], language="python", line_numbers=True, wrap_lines=True)
|
| 288 |
|
| 289 |
# When saving results, pass the container
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
# Show responses in a code format with line numbers
|
| 303 |
-
st.markdown("### ๐ Response Outputs with Line Numbers")
|
| 304 |
-
st.code(f"Response 1: \n{format_with_line_numbers(response1)}\n\nResponse 2: \n{format_with_line_numbers(response2)}", language="json")
|
| 305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
|
| 307 |
|
| 308 |
|
|
|
|
| 287 |
st.code(response2[1], language="python", line_numbers=True, wrap_lines=True)
|
| 288 |
|
| 289 |
# When saving results, pass the container
|
| 290 |
+
try:
|
| 291 |
+
save_to_cosmos_db(st.session_state.cosmos_container, query, result, result)
|
| 292 |
+
save_to_cosmos_db(st.session_state.cosmos_container, query, result2, result2)
|
| 293 |
+
save_to_cosmos_db(st.session_state.cosmos_container, query, result3, result3)
|
| 294 |
+
save_to_cosmos_db(st.session_state.cosmos_container, query, response2[0], response2[0])
|
| 295 |
+
save_to_cosmos_db(st.session_state.cosmos_container, query, response2[1], response2[1])
|
| 296 |
+
except exceptions.CosmosHttpResponseError as e:
|
| 297 |
+
return False, f"HTTP error occurred: {str(e)} ๐จ"
|
| 298 |
+
except Exception as e:
|
| 299 |
+
return False, f"An unexpected error occurred: {str(e)} ๐ฑ"
|
| 300 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
|
| 302 |
+
try:
|
| 303 |
+
# Aggregate hyperlinks and show with emojis
|
| 304 |
+
hyperlinks = extract_hyperlinks([response1, response2])
|
| 305 |
+
st.markdown("### ๐ Aggregated Hyperlinks")
|
| 306 |
+
for link in hyperlinks:
|
| 307 |
+
st.markdown(f"๐ [{link}]({link})")
|
| 308 |
+
|
| 309 |
+
# Show responses in a code format with line numbers
|
| 310 |
+
st.markdown("### ๐ Response Outputs with Line Numbers")
|
| 311 |
+
st.code(f"Response 1: \n{format_with_line_numbers(response1)}\n\nResponse 2: \n{format_with_line_numbers(response2)}", language="json")
|
| 312 |
+
except exceptions.CosmosHttpResponseError as e:
|
| 313 |
+
return False, f"HTTP error occurred: {str(e)} ๐จ"
|
| 314 |
+
except Exception as e:
|
| 315 |
+
return False, f"An unexpected error occurred: {str(e)} ๐ฑ"
|
| 316 |
+
|
| 317 |
|
| 318 |
|
| 319 |
|