CodeCommunity commited on
Commit
4696079
·
verified ·
1 Parent(s): 33c1793

Update app/core/model_loader.py

Browse files
Files changed (1) hide show
  1. app/core/model_loader.py +6 -4
app/core/model_loader.py CHANGED
@@ -38,11 +38,13 @@ class LLMSingleton:
38
  raw_key = os.getenv("GROQ_API_KEY", "")
39
  self.api_key = raw_key.strip().strip('"').strip("'") if raw_key else ""
40
 
41
- if not self.api_key:
42
- logger.warning("⚠️ GROQ_API_KEY not found or empty. AI features will fail.")
43
- self.client = None
44
- else:
45
  self.client = Groq(api_key=self.api_key)
 
 
 
46
 
47
  # 2. Load and sanitize Model Name
48
  raw_model = os.getenv("GROQ_MODEL", DEFAULT_MODEL)
 
38
  raw_key = os.getenv("GROQ_API_KEY", "")
39
  self.api_key = raw_key.strip().strip('"').strip("'") if raw_key else ""
40
 
41
+ # Debug check for API key loading status
42
+ if self.api_key:
43
+ logger.info(f"✅ Loaded GROQ_API_KEY successfully! (Length: {len(self.api_key)}, Starts with: {self.api_key[:4]})")
 
44
  self.client = Groq(api_key=self.api_key)
45
+ else:
46
+ logger.error("❌ GROQ_API_KEY is empty or missing from environment variables!")
47
+ self.client = None
48
 
49
  # 2. Load and sanitize Model Name
50
  raw_model = os.getenv("GROQ_MODEL", DEFAULT_MODEL)