fix: 清除硬编码API Key与机器特定路径,改用环境变量+混合式路径解析

This commit is contained in:
hangshuo652
2026-08-25 21:53:18 +08:00
parent b3895a905e
commit 8e81f960af
32 changed files with 200 additions and 76 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
__pycache__/
*.pyc
output/
output/
config.json
+1 -1
View File
@@ -52,7 +52,7 @@ python main.py --design "D:\cobol-tna-system\詳細設計書\詳細設計書_XXX
- **同一COPYBOOKの複数REPLACING**: `ZAN01REC``R01`/`R02` 両方で使われる場合、`_extract_copy_replacing()` はリスト `[(copy_name, prefix), ...]` を返し、`_parse_copybooks()` が識別子でマッチする。
- **PGMタイプ = サブ はスキップ**: `generate()` 関数で `meta.pgm_type == 'サブ'` の場合 `ValueError`
- **入力タイプ判定**: `使用ファイル一覧``I/O` 列に `'I'` を含む行の `媒体` 列を見る。`PS`=ファイル、`DB`=DB、両方=混合。
- **APIキー**: コードにハードコード (`sk-6156cccdc9c14d949cf5bfc5afc67a03`)。モデルは `deepseek-v4-flash`
- **APIキー**: コードにハードコードしない。`config.json` または環境変数 `DEEPSEEK_API_KEY` から読み込む(`agent/config.py` 参照)。モデルは `DEEPSEEK_MODEL`(既定: `deepseek-v4-flash`
## 多keyテスト
-10
View File
@@ -1,10 +0,0 @@
{
"api": {
"api_key": "sk-6156cccdc9c14d949cf5bfc5afc67a03",
"model": "deepseek-v4-flash",
"base_url": "https://api.deepseek.com/chat/completions",
"timeout": 120,
"max_retries": 3,
"max_tokens": 32768
}
}
@@ -1,4 +1,4 @@
# 测试数据生成 Agent 实现计划
# 测试数据生成 Agent 实现计划
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
@@ -2042,7 +2042,7 @@ from agent.models import ProgramMeta, FileInfo, CopyField, KeyInfo, TableColumn,
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_key: str = "<API_KEY>",
api_model: str = "deepseek-v4-flash",
rules_dir: str = "rules") -> dict:
"""生成测试数据的主入口函数。
@@ -2151,7 +2151,7 @@ def main():
help='DB 定義書 .md のパス')
parser.add_argument('--output', default='output',
help='出力ディレクトリ (デフォルト: output)')
parser.add_argument('--api-key', default='sk-6156cccdc9c14d949cf5bfc5afc67a03',
parser.add_argument('--api-key', default='<API_KEY>',
help='DeepSeek API Key')
parser.add_argument('--model', default='deepseek-v4-flash',
help='API モデル名')
@@ -1,4 +1,4 @@
# COBOL 测试数据生成 Agent 设计文档
# COBOL 测试数据生成 Agent 设计文档
## 背景
@@ -203,7 +203,7 @@ PGMパターン 值到规则文件名的映射:
**API 配置**
- 地址:https://api.deepseek.com/chat/completions
- 模型:`deepseek-v4-flash`
- API Key`sk-6156cccdc9c14d949cf5bfc5afc67a03`
- API Key`<API_KEY>`
- timeout120 秒
**请求结构**