Spaces:
Sleeping
Sleeping
| # File 9: app_config.py (Configuration helper) | |
| import os | |
| import streamlit as st | |
| class AppConfig: | |
| """Configuration settings for the Ham Research AI app""" | |
| # Docker environment detection | |
| IS_DOCKER = os.path.exists('/.dockerenv') | |
| # Chrome options for Docker | |
| CHROME_OPTIONS = [ | |
| '--headless', | |
| '--no-sandbox', | |
| '--disable-dev-shm-usage', | |
| '--disable-gpu', | |
| '--disable-features=VizDisplayCompositor', | |
| '--window-size=1920x1080' | |
| ] if IS_DOCKER else ['--headless'] | |
| # Default API settings | |
| DEFAULT_API_KEY = "demo_mode" | |
| MAX_ARTICLES = 50 | |
| REQUEST_TIMEOUT = 30 | |
| # UI Settings | |
| PAGE_TITLE = "Ham Research AI" | |
| PAGE_ICON = "๐" | |
| LAYOUT = "wide" | |
| def get_chrome_options(): | |
| """Get Chrome options for current environment""" | |
| from selenium.webdriver.chrome.options import Options | |
| options = Options() | |
| for option in AppConfig.CHROME_OPTIONS: | |
| options.add_argument(option) | |
| if AppConfig.IS_DOCKER: | |
| options.binary_location = '/usr/bin/chromium' | |
| return options |