Spaces:
Running
Running
Enhance islamic references
Browse files
app.py
CHANGED
|
@@ -319,8 +319,6 @@ def fetch_islamic_reference(query: str, category: str = "General", max_retries:
|
|
| 319 |
Dynamically fetch Quran / Hadith references with URL resilience and safe fallback.
|
| 320 |
Designed specifically for Abdullah Bot API (single-function, production-safe).
|
| 321 |
"""
|
| 322 |
-
import requests
|
| 323 |
-
|
| 324 |
query = (query or "").strip()
|
| 325 |
category = (category or "").lower()
|
| 326 |
|
|
@@ -358,7 +356,7 @@ def fetch_islamic_reference(query: str, category: str = "General", max_retries:
|
|
| 358 |
|
| 359 |
m = matches[0]
|
| 360 |
surah = m.get("surah", {}).get("number")
|
| 361 |
-
ayah = m.get("
|
| 362 |
text = m.get("text")
|
| 363 |
|
| 364 |
if surah and ayah and text:
|
|
@@ -383,7 +381,10 @@ def fetch_islamic_reference(query: str, category: str = "General", max_retries:
|
|
| 383 |
"prayer": "Quranic Principle: Prayer restrains from immorality and wrongdoing (29:45).",
|
| 384 |
"salah": "Quranic Principle: Establish prayer for My remembrance (20:14).",
|
| 385 |
"knowledge": "Quranic Principle: Say, My Lord, increase me in knowledge (20:114).",
|
| 386 |
-
"tawakkul": "Quranic Principle: Whoever relies upon Allah, He is sufficient for him (65:3)."
|
|
|
|
|
|
|
|
|
|
| 387 |
}
|
| 388 |
|
| 389 |
for key, value in principle_map.items():
|
|
|
|
| 319 |
Dynamically fetch Quran / Hadith references with URL resilience and safe fallback.
|
| 320 |
Designed specifically for Abdullah Bot API (single-function, production-safe).
|
| 321 |
"""
|
|
|
|
|
|
|
| 322 |
query = (query or "").strip()
|
| 323 |
category = (category or "").lower()
|
| 324 |
|
|
|
|
| 356 |
|
| 357 |
m = matches[0]
|
| 358 |
surah = m.get("surah", {}).get("number")
|
| 359 |
+
ayah = m.get("numberInSurah")
|
| 360 |
text = m.get("text")
|
| 361 |
|
| 362 |
if surah and ayah and text:
|
|
|
|
| 381 |
"prayer": "Quranic Principle: Prayer restrains from immorality and wrongdoing (29:45).",
|
| 382 |
"salah": "Quranic Principle: Establish prayer for My remembrance (20:14).",
|
| 383 |
"knowledge": "Quranic Principle: Say, My Lord, increase me in knowledge (20:114).",
|
| 384 |
+
"tawakkul": "Quranic Principle: Whoever relies upon Allah, He is sufficient for him (65:3).",
|
| 385 |
+
"forgiveness": "Quranic Principle: And pardon them and ask forgiveness for them (3:159).",
|
| 386 |
+
"trust": "Quranic Principle: And put your trust in Allah (3:159).",
|
| 387 |
+
"hope": "Quranic Principle: Do not despair of Allah's mercy (39:53)."
|
| 388 |
}
|
| 389 |
|
| 390 |
for key, value in principle_map.items():
|