Set whether Ethernet should be preferred over WiFi for scanning.
()
| 11384 | def get_ai_service_diagnostic(): |
| 11385 | """Detailed AI service diagnostic information""" |
| 11386 | try: |
| 11387 | import traceback |
| 11388 | diagnostic = { |
| 11389 | 'timestamp': datetime.now().isoformat(), |
| 11390 | 'ai_service_exists': hasattr(shared_data, 'ai_service'), |
| 11391 | 'ai_service_is_none': getattr(shared_data, 'ai_service', 'MISSING') is None, |
| 11392 | 'config_ai_enabled': shared_data.config.get('ai_enabled', False), |
| 11393 | 'env_file_exists': os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), '.env')), |
| 11394 | } |
| 11395 | |
| 11396 | # Try to get token from env |
| 11397 | try: |
| 11398 | from env_manager import EnvManager |
| 11399 | env_mgr = EnvManager() |
| 11400 | token = env_mgr.get_token() |
| 11401 | diagnostic['env_token_found'] = bool(token) |
| 11402 | diagnostic['env_token_preview'] = f"{token[:8]}...{token[-4:]}" if token and len(token) > 12 else None |
| 11403 | except Exception as e: |
| 11404 | diagnostic['env_manager_error'] = str(e) |
| 11405 | diagnostic['env_manager_traceback'] = traceback.format_exc() |
| 11406 | |
| 11407 | # Check AI service object |
| 11408 | ai_service = getattr(shared_data, 'ai_service', None) |
| 11409 | if ai_service: |
nothing calls this directly
no test coverage detected