Spaces:
Sleeping
Sleeping
give 1 second for web search to grab data
Browse files
app.py
CHANGED
|
@@ -140,6 +140,11 @@ def chat_response(user_msg, chat_history, system_prompt,
|
|
| 140 |
enriched = system_prompt.strip() + "\n\nRelevant context:\n" + "\n".join(search_results)
|
| 141 |
else:
|
| 142 |
enriched = system_prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
prompt = format_conversation(history, enriched)
|
| 144 |
|
| 145 |
pipe = load_pipeline(model_name)
|
|
|
|
| 140 |
enriched = system_prompt.strip() + "\n\nRelevant context:\n" + "\n".join(search_results)
|
| 141 |
else:
|
| 142 |
enriched = system_prompt
|
| 143 |
+
|
| 144 |
+
# give search up to 1 second to fetch results, then proceed
|
| 145 |
+
if enable_search:
|
| 146 |
+
thread_search.join(timeout=1.0)
|
| 147 |
+
|
| 148 |
prompt = format_conversation(history, enriched)
|
| 149 |
|
| 150 |
pipe = load_pipeline(model_name)
|