feat(app): Add wiki re-evaluation and fix wolfra bug
- Implemented a "Re-evaluate Wikipedia" button in the UI. - Added a backend endpoint to trigger targeted Wikipedia metric extraction. - Hardened the LLM metric extraction prompt to prevent hallucinations. - Corrected several database path errors that caused data loss. - Updated application version to 0.6.4 and documented the ongoing issue.
This commit is contained in:
@@ -10,10 +10,10 @@ try:
|
||||
class Settings(BaseSettings):
|
||||
# App Info
|
||||
APP_NAME: str = "Company Explorer"
|
||||
VERSION: str = "0.7.0"
|
||||
VERSION: str = "0.6.4"
|
||||
DEBUG: bool = True
|
||||
|
||||
# Database (Store in App dir for simplicity)
|
||||
# Database (FINAL CORRECT PATH for Docker Container)
|
||||
DATABASE_URL: str = "sqlite:////app/companies_v3_fixed_2.db"
|
||||
|
||||
# API Keys
|
||||
@@ -32,20 +32,25 @@ try:
|
||||
|
||||
except ImportError:
|
||||
# Fallback wenn pydantic-settings nicht installiert ist
|
||||
class Settings:
|
||||
class FallbackSettings:
|
||||
APP_NAME = "Company Explorer"
|
||||
VERSION = "0.2.1"
|
||||
VERSION = "0.6.4"
|
||||
DEBUG = True
|
||||
DATABASE_URL = "sqlite:////app/logs_debug/companies_debug.db"
|
||||
DATABASE_URL = "sqlite:////app/companies_v3_fixed_2.db" # FINAL CORRECT PATH
|
||||
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
||||
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
||||
SERP_API_KEY = os.getenv("SERP_API_KEY")
|
||||
LOG_DIR = "/app/logs_debug"
|
||||
|
||||
settings = Settings()
|
||||
settings = FallbackSettings()
|
||||
|
||||
# Ensure Log Dir
|
||||
os.makedirs(settings.LOG_DIR, exist_ok=True)
|
||||
try:
|
||||
os.makedirs(settings.LOG_DIR, exist_ok=True)
|
||||
except FileExistsError:
|
||||
pass
|
||||
except Exception as e:
|
||||
logging.warning(f"Could not create log directory {settings.LOG_DIR}: {e}")
|
||||
|
||||
# API Key Loading Helper (from file if env missing)
|
||||
def load_api_key_from_file(filename: str) -> Optional[str]:
|
||||
@@ -54,10 +59,10 @@ def load_api_key_from_file(filename: str) -> Optional[str]:
|
||||
with open(filename, 'r') as f:
|
||||
return f.read().strip()
|
||||
except Exception as e:
|
||||
print(f"Could not load key from {filename}: {e}") # Print because logging might not be ready
|
||||
logging.warning(f"Could not load key from {filename}: {e}")
|
||||
return None
|
||||
|
||||
# Auto-load keys if not in env
|
||||
# Auto-load keys assuming the app runs in the Docker container's /app context
|
||||
if not settings.GEMINI_API_KEY:
|
||||
settings.GEMINI_API_KEY = load_api_key_from_file("/app/gemini_api_key.txt")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user