@@ -60,11 +60,15 @@ def run_silent_checks() -> Tuple[bool, List[str]]:
6060 except :
6161 failed .append ("Ollama" )
6262
63- # 4. Check Qdrant
63+ # 4. Check Qdrant (with API key if set)
6464 qdrant_url = os .getenv ('QDRANT_URL' , 'http://localhost:6333' )
65+ qdrant_api_key = os .getenv ('QDRANT_API_KEY' )
66+ headers = {'api-key' : qdrant_api_key } if qdrant_api_key else {}
6567 try :
66- response = requests .get (f"{ qdrant_url } /" , timeout = 2 )
67- if response .status_code != 200 :
68+ response = requests .get (f"{ qdrant_url } /collections" , headers = headers , timeout = 2 )
69+ if response .status_code == 401 :
70+ failed .append ("Qdrant (API key invalid or missing)" )
71+ elif response .status_code != 200 :
6872 failed .append ("Qdrant" )
6973 except :
7074 failed .append ("Qdrant" )
@@ -180,23 +184,27 @@ def run_doctor_checks(fix: bool = False) -> None:
180184 checks .append (('Ollama running' , False ))
181185 print ()
182186
183- # 5. Check Qdrant
187+ # 5. Check Qdrant (with API key if set)
184188 print ("🗄️ Checking Qdrant..." )
185189 qdrant_url = os .getenv ('QDRANT_URL' , 'http://localhost:6333' )
190+ qdrant_api_key = os .getenv ('QDRANT_API_KEY' )
191+ qdrant_headers = {'api-key' : qdrant_api_key } if qdrant_api_key else {}
186192 try :
187- response = requests .get (f"{ qdrant_url } /" , timeout = 5 )
193+ response = requests .get (f"{ qdrant_url } /collections" , headers = qdrant_headers , timeout = 5 )
188194 if response .status_code == 200 :
189195 print (f" ✅ Qdrant running at { qdrant_url } " )
196+ if qdrant_api_key :
197+ print (f" ✅ API key authentication successful" )
190198 checks .append (('Qdrant running' , True ))
191199
192200 # Get collections count
193- try :
194- collections_response = requests . get ( f" { qdrant_url } / collections" , timeout = 5 )
195- if collections_response .status_code == 200 :
196- collections = collections_response . json (). get ( 'result' , {}). get ( 'collections' , [] )
197- print (f" ℹ️ Collections: { len ( collections ) } " )
198- except :
199- pass
201+ collections = response . json (). get ( 'result' , {}). get ( 'collections' , [])
202+ print ( f" ℹ️ Collections: { len ( collections ) } " )
203+ elif response .status_code == 401 :
204+ print ( f" ❌ Qdrant authentication failed (401 Unauthorized)" )
205+ print (f" ℹ️ Set QDRANT_API_KEY environment variable " )
206+ checks . append (( 'Qdrant running' , False ))
207+ issues . append ( "Set QDRANT_API_KEY=your-api-key or check if key is correct" )
200208 else :
201209 print (f" ❌ Qdrant responded with status { response .status_code } " )
202210 checks .append (('Qdrant running' , False ))
0 commit comments