硬编码改为配置文件

This commit is contained in:
2026-08-25 20:35:52 +08:00
parent bd5926aeed
commit b3895a905e
7 changed files with 113 additions and 18 deletions
+11 -3
View File
@@ -6,17 +6,25 @@ from agent.prompt_builder import PromptBuilder
from agent.api_client import APIClient
from agent.output_writer import OutputWriter
from agent.models import ProgramMeta, FileInfo, CopyField, KeyInfo, TableColumn, TableInfo
from agent.config import load_config
def generate(design_md: str, source_cbl: str, file_db_md: str,
cpy_dir: str, db_md: str, output_dir: str = "output",
api_key: str = "sk-6156cccdc9c14d949cf5bfc5afc67a03",
api_model: str = "deepseek-v4-flash",
api_key: str = None, api_model: str = None,
rules_dir: str = "rules",
max_tokens: int = 32768) -> dict:
max_tokens: int = None) -> dict:
"""生成测试数据的主入口函数。"""
import os
cfg = load_config()['api']
if api_key is None:
api_key = cfg['api_key']
if api_model is None:
api_model = cfg['model']
if max_tokens is None:
max_tokens = cfg['max_tokens']
print(f"== 解析入力: {design_md}")
parser = InputParser(design_md, source_cbl, file_db_md, cpy_dir, db_md)