Spaces:
Sleeping
Sleeping
| # config_loader.py | |
| import yaml | |
| from pathlib import Path | |
| def load_config(): | |
| config_path = Path(__file__).parent / "todogen_LLM_config.yaml" | |
| with open(config_path, 'r', encoding='utf-8') as f: | |
| return yaml.safe_load(f) | |
| CONFIG = load_config() | |
| def get_mysql_config(): | |
| return { | |
| **CONFIG['mysql'], | |
| 'ssl_ca': str(Path(__file__).parent / CONFIG['mysql']['ssl_ca']) | |
| } | |
| def get_openai_config(): | |
| return CONFIG['openai'] | |
| def get_paths(): | |
| config = load_config() | |
| base = Path(__file__).resolve().parent # 定位到todogen_LLM目录 | |
| return { | |
| 'base_dir': base, | |
| 'data_dir': base / config['paths']['data_dir'], | |
| 'logging_dir': base / config['paths']['logging_dir'] | |
| } | |
| def get_processing_config(): | |
| return CONFIG['processing'] | |
| def get_defaults_config(): | |
| return CONFIG['defaults'] |