Spaces:
Sleeping
Sleeping
Upload agentic_rag.py
Browse files- agentic_rag.py +4 -11
agentic_rag.py
CHANGED
|
@@ -234,22 +234,15 @@ def tool_check_latest_news(lang: str = "ar"):
|
|
| 234 |
for tag in soup(["script","style","nav","footer","header"]):
|
| 235 |
tag.decompose()
|
| 236 |
text = soup.get_text(" ", strip=True)[:3000]
|
| 237 |
-
return
|
| 238 |
-
|
| 239 |
-
{text}", [{"url": url, "page_name": "الأخبار", "content": text[:500]}]
|
| 240 |
|
| 241 |
# نرجع النتائج كنص منظم
|
| 242 |
-
result =
|
| 243 |
-
|
| 244 |
-
"
|
| 245 |
for i, a in enumerate(articles[:5]):
|
| 246 |
result += f"{i+1}. {a['title']}"
|
| 247 |
if a['date']: result += f" — {a['date']}"
|
| 248 |
-
if a['url']: result +=
|
| 249 |
-
|
| 250 |
-
result += "
|
| 251 |
-
|
| 252 |
-
"
|
| 253 |
|
| 254 |
sources = [{"url": a["url"] or url, "page_name": a["title"], "content": a["title"]} for a in articles[:3]]
|
| 255 |
return result, sources
|
|
|
|
| 234 |
for tag in soup(["script","style","nav","footer","header"]):
|
| 235 |
tag.decompose()
|
| 236 |
text = soup.get_text(" ", strip=True)[:3000]
|
| 237 |
+
return "[\u0645\u0646 " + url + "]\n\n" + text, [{"url": url, "page_name": "\u0627\u0644\u0623\u062e\u0628\u0627\u0631", "content": text[:500]}]
|
|
|
|
|
|
|
| 238 |
|
| 239 |
# نرجع النتائج كنص منظم
|
| 240 |
+
result = "[\u0622\u062e\u0631 \u0627\u0644\u0623\u062e\u0628\u0627\u0631 \u0645\u0646 " + url + "]\n\n"
|
|
|
|
|
|
|
| 241 |
for i, a in enumerate(articles[:5]):
|
| 242 |
result += f"{i+1}. {a['title']}"
|
| 243 |
if a['date']: result += f" — {a['date']}"
|
| 244 |
+
if a['url']: result += "\n 🔗 " + a['url']
|
| 245 |
+
result += "\n\n"
|
|
|
|
|
|
|
|
|
|
| 246 |
|
| 247 |
sources = [{"url": a["url"] or url, "page_name": a["title"], "content": a["title"]} for a in articles[:3]]
|
| 248 |
return result, sources
|