This commit is contained in:
ChinhLee 2026-05-28 17:37:12 -04:00 committed by GitHub
commit 757a1cde2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,4 @@
""" """\n配置管理\n统一从项目根目录的 .env 文件加载配置\n"""
配置管理
统一从项目根目录的 .env 文件加载配置
"""
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@ -22,9 +19,9 @@ class Config:
# Flask配置 # Flask配置
SECRET_KEY = os.environ.get('SECRET_KEY', 'mirofish-secret-key') SECRET_KEY = os.environ.get('SECRET_KEY', 'mirofish-secret-key')
DEBUG = os.environ.get('FLASK_DEBUG', 'True').lower() == 'true' DEBUG = os.environ.get('FLASK_DEBUG', 'False').lower() == 'true'
# JSON配置 - 禁用ASCII转义让中文直接显示(而不是 \uXXXX 格式) # JSON配置 - 禁用ASCII转义让中文直接显示
JSON_AS_ASCII = False JSON_AS_ASCII = False
# LLM配置统一使用OpenAI格式 # LLM配置统一使用OpenAI格式
@ -71,5 +68,7 @@ class Config:
errors.append("LLM_API_KEY 未配置") errors.append("LLM_API_KEY 未配置")
if not cls.ZEP_API_KEY: if not cls.ZEP_API_KEY:
errors.append("ZEP_API_KEY 未配置") errors.append("ZEP_API_KEY 未配置")
if cls.DEBUG:
import warnings
warnings.warn("Flask DEBUG mode is enabled. Do not use in production.", RuntimeWarning)
return errors return errors