Merge branch 'main' of http://jeason.online:3000/zhaojie/iov_data_analysis_agent
This commit is contained in:
@@ -46,6 +46,11 @@ class AppConfig:
|
||||
log_filename: str = field(default="log.txt")
|
||||
enable_code_logging: bool = field(default=False) # 是否记录生成的代码
|
||||
|
||||
# 健壮性配置
|
||||
max_data_context_retries: int = field(default=2) # 数据上下文错误最大重试次数
|
||||
conversation_window_size: int = field(default=10) # 对话历史滑动窗口大小(消息对数)
|
||||
max_parallel_profiles: int = field(default=4) # 并行数据画像最大线程数
|
||||
|
||||
@classmethod
|
||||
def from_env(cls) -> 'AppConfig':
|
||||
"""从环境变量创建配置"""
|
||||
@@ -60,6 +65,13 @@ class AppConfig:
|
||||
|
||||
if cache_enabled := os.getenv("APP_CACHE_ENABLED"):
|
||||
config.data_cache_enabled = cache_enabled.lower() == "true"
|
||||
|
||||
if val := os.getenv("APP_MAX_DATA_CONTEXT_RETRIES"):
|
||||
config.max_data_context_retries = int(val)
|
||||
if val := os.getenv("APP_CONVERSATION_WINDOW_SIZE"):
|
||||
config.conversation_window_size = int(val)
|
||||
if val := os.getenv("APP_MAX_PARALLEL_PROFILES"):
|
||||
config.max_parallel_profiles = int(val)
|
||||
|
||||
return config
|
||||
|
||||
|
||||
Reference in New Issue
Block a user