ArthurSrz Claude commited on
Commit
17b0cdf
·
1 Parent(s): af1022d

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>

Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -10,14 +10,28 @@ import shutil
10
  import zipfile
11
  import requests
12
 
13
- # Try to import nano_graphrag, with fallback for demo
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
- except ImportError:
19
- NANO_GRAPHRAG_AVAILABLE = False
20
- print("⚠️ nano-graphrag not available, running in demo mode")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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")