Update app.py
Browse files
app.py
CHANGED
|
@@ -90,15 +90,18 @@ def respond(message, system_prompt, history, model, temperature, num_calls, use_
|
|
| 90 |
full_response = ""
|
| 91 |
for main_content, sources in get_response_with_search(message, model, num_calls=num_calls, temperature=temperature, use_embeddings=use_embeddings, system_prompt=system_prompt):
|
| 92 |
full_response += main_content
|
| 93 |
-
|
|
|
|
| 94 |
|
| 95 |
if sources:
|
| 96 |
full_response += f"\n\nSources:\n{sources}"
|
| 97 |
-
|
|
|
|
| 98 |
except Exception as e:
|
| 99 |
logging.error(f"Error with {model}: {str(e)}")
|
| 100 |
error_message = f"An error occurred with the {model} model: {str(e)}. Please try again or select a different model."
|
| 101 |
-
|
|
|
|
| 102 |
|
| 103 |
def create_web_search_vectors(search_results):
|
| 104 |
embed = get_embeddings()
|
|
|
|
| 90 |
full_response = ""
|
| 91 |
for main_content, sources in get_response_with_search(message, model, num_calls=num_calls, temperature=temperature, use_embeddings=use_embeddings, system_prompt=system_prompt):
|
| 92 |
full_response += main_content
|
| 93 |
+
new_history = history + [(message, full_response)]
|
| 94 |
+
yield new_history
|
| 95 |
|
| 96 |
if sources:
|
| 97 |
full_response += f"\n\nSources:\n{sources}"
|
| 98 |
+
new_history = history + [(message, full_response)]
|
| 99 |
+
yield new_history
|
| 100 |
except Exception as e:
|
| 101 |
logging.error(f"Error with {model}: {str(e)}")
|
| 102 |
error_message = f"An error occurred with the {model} model: {str(e)}. Please try again or select a different model."
|
| 103 |
+
new_history = history + [(message, error_message)]
|
| 104 |
+
yield new_history
|
| 105 |
|
| 106 |
def create_web_search_vectors(search_results):
|
| 107 |
embed = get_embeddings()
|