|
34 | 34 | _config_logger.debug(f"📁 .env exists: {_env_exists}") |
35 | 35 |
|
36 | 36 | if not _env_exists: |
37 | | - print("\n" + "="*70) |
38 | | - print("⚠️ WARNING: .env configuration file not found") |
39 | | - print("="*70) |
40 | | - print("\nThe application will run with default settings, but you may need to") |
41 | | - print("configure it for your specific setup.\n") |
42 | | - |
43 | | - if _env_example.exists(): |
44 | | - print("📋 QUICK SETUP:") |
45 | | - print(f" 1. Copy the template: copy .env.example .env") |
46 | | - print(f" 2. Edit .env to match your configuration") |
47 | | - print(f" 3. Restart the application\n") |
| 37 | + # Check if running as PyInstaller executable |
| 38 | + _is_frozen = getattr(sys, 'frozen', False) |
| 39 | + |
| 40 | + if not _is_frozen: |
| 41 | + # Only show the interactive prompt when NOT running as executable |
| 42 | + print("\n" + "="*70) |
| 43 | + print("⚠️ WARNING: .env configuration file not found") |
| 44 | + print("="*70) |
| 45 | + print("\nThe application will run with default settings, but you may need to") |
| 46 | + print("configure it for your specific setup.\n") |
| 47 | + |
| 48 | + if _env_example.exists(): |
| 49 | + print("📋 QUICK SETUP:") |
| 50 | + print(f" 1. Copy the template: copy .env.example .env") |
| 51 | + print(f" 2. Edit .env to match your configuration") |
| 52 | + print(f" 3. Restart the application\n") |
| 53 | + else: |
| 54 | + print("📋 MANUAL SETUP:") |
| 55 | + print(f" 1. Create a .env file in: {Path.cwd()}") |
| 56 | + print(f" 2. Add your configuration (see documentation)") |
| 57 | + print(f" 3. Restart the application\n") |
| 58 | + |
| 59 | + print("🔧 DEFAULT SETTINGS BEING USED:") |
| 60 | + print(f" • API Endpoint: http://localhost:11434/api/generate") |
| 61 | + print(f" • LLM Provider: ollama") |
| 62 | + print(f" • Model: qwen3:14b") |
| 63 | + print(f" • Port: 5000") |
| 64 | + print(f"\n💡 TIP: If using a remote server or different provider, you MUST") |
| 65 | + print(f" create a .env file with the correct settings.\n") |
| 66 | + print("="*70) |
| 67 | + print("Press Ctrl+C to stop and configure, or wait 5 seconds to continue...") |
| 68 | + print("="*70 + "\n") |
| 69 | + |
| 70 | + # Give user time to read and react |
| 71 | + import time |
| 72 | + try: |
| 73 | + time.sleep(5) |
| 74 | + except KeyboardInterrupt: |
| 75 | + print("\n\n⏹️ Startup cancelled by user. Please configure .env and try again.\n") |
| 76 | + sys.exit(0) |
48 | 77 | else: |
49 | | - print("📋 MANUAL SETUP:") |
50 | | - print(f" 1. Create a .env file in: {Path.cwd()}") |
51 | | - print(f" 2. Add your configuration (see documentation)") |
52 | | - print(f" 3. Restart the application\n") |
53 | | - |
54 | | - print("🔧 DEFAULT SETTINGS BEING USED:") |
55 | | - print(f" • API Endpoint: http://localhost:11434/api/generate") |
56 | | - print(f" • LLM Provider: ollama") |
57 | | - print(f" • Model: qwen3:14b") |
58 | | - print(f" • Port: 5000") |
59 | | - print(f"\n💡 TIP: If using a remote server or different provider, you MUST") |
60 | | - print(f" create a .env file with the correct settings.\n") |
61 | | - print("="*70) |
62 | | - print("Press Ctrl+C to stop and configure, or wait 5 seconds to continue...") |
63 | | - print("="*70 + "\n") |
64 | | - |
65 | | - # Give user time to read and react |
66 | | - import time |
67 | | - try: |
68 | | - time.sleep(5) |
69 | | - except KeyboardInterrupt: |
70 | | - print("\n\n⏹️ Startup cancelled by user. Please configure .env and try again.\n") |
71 | | - sys.exit(0) |
| 78 | + # Running as executable - silently use defaults |
| 79 | + if _debug_mode: |
| 80 | + _config_logger.debug("⚠️ .env not found, using defaults (executable mode)") |
72 | 81 |
|
73 | 82 | # Load .env file if it exists |
74 | 83 | _dotenv_result = load_dotenv(_env_file) |
|
0 commit comments