Spaces:
Runtime error
Runtime error
fix: Force NANO_GRAPHRAG_AVAILABLE = True for testing
Browse files- Force nano-graphrag availability flag to True
- Add dummy classes if import fails for gradual debugging
- This will help identify if the issue is import or logic related
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -10,14 +10,28 @@ import shutil
|
|
| 10 |
import zipfile
|
| 11 |
import requests
|
| 12 |
|
| 13 |
-
#
|
| 14 |
try:
|
| 15 |
from nano_graphrag import GraphRAG, QueryParam
|
| 16 |
from nano_graphrag._llm import gpt_4o_mini_complete
|
| 17 |
NANO_GRAPHRAG_AVAILABLE = True
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
print("⚠️ nano-graphrag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Configuration pour l'API externe
|
| 23 |
BORGES_API_URL = os.getenv("BORGES_API_URL", "https://borges-library.vercel.app/api/graphrag")
|
|
|
|
| 10 |
import zipfile
|
| 11 |
import requests
|
| 12 |
|
| 13 |
+
# Force nano_graphrag availability for testing
|
| 14 |
try:
|
| 15 |
from nano_graphrag import GraphRAG, QueryParam
|
| 16 |
from nano_graphrag._llm import gpt_4o_mini_complete
|
| 17 |
NANO_GRAPHRAG_AVAILABLE = True
|
| 18 |
+
print("✅ nano-graphrag imported successfully")
|
| 19 |
+
except ImportError as e:
|
| 20 |
+
print(f"⚠️ nano-graphrag import failed: {e}")
|
| 21 |
+
NANO_GRAPHRAG_AVAILABLE = True # Force True for testing
|
| 22 |
+
# Create dummy classes for demo
|
| 23 |
+
class GraphRAG:
|
| 24 |
+
def __init__(self, *args, **kwargs):
|
| 25 |
+
pass
|
| 26 |
+
async def aquery(self, query, param=None):
|
| 27 |
+
return "Demo response"
|
| 28 |
+
|
| 29 |
+
class QueryParam:
|
| 30 |
+
def __init__(self, *args, **kwargs):
|
| 31 |
+
pass
|
| 32 |
+
|
| 33 |
+
def gpt_4o_mini_complete(*args, **kwargs):
|
| 34 |
+
return "Demo completion"
|
| 35 |
|
| 36 |
# Configuration pour l'API externe
|
| 37 |
BORGES_API_URL = os.getenv("BORGES_API_URL", "https://borges-library.vercel.app/api/graphrag")
|