Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,8 +32,12 @@ def get_web_context(query: str) -> str:
|
|
| 32 |
response = tavily.search(query, search_depth="basic", max_results=3)
|
| 33 |
results = response.get("results", [])
|
| 34 |
if results:
|
| 35 |
-
snippets = [f"- {r.get('title', '')}: {r.get('content', '')}" for r in results]
|
| 36 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
except Exception:
|
| 38 |
pass
|
| 39 |
return ""
|
|
|
|
| 32 |
response = tavily.search(query, search_depth="basic", max_results=3)
|
| 33 |
results = response.get("results", [])
|
| 34 |
if results:
|
| 35 |
+
snippets = [f"- {r.get('title', '')} (Источник: {r.get('url', '')}): {r.get('content', '')}" for r in results]
|
| 36 |
+
return (
|
| 37 |
+
"ВНИМАНИЕ! Свежая информация из интернета по запросу пользователя:\n"
|
| 38 |
+
+ "\n".join(snippets)
|
| 39 |
+
+ "\n\nОпирайся строго на эти факты при ответе и ОБЯЗАТЕЛЬНО красиво укажи ссылки на источники в конце своего ответа."
|
| 40 |
+
)
|
| 41 |
except Exception:
|
| 42 |
pass
|
| 43 |
return ""
|