# cfc-langgraph LangGraph Python AI 服务(FastAPI + LangGraph + ChromaDB RAG)。 ## AI Agent 配置(Agent 必须遵守) **Git Author/Committer**: 所有 git commit 操作(含 amend/rebase/merge)的 author 与 committer 均为: - name: `zxyj-langgraph` - email: `agent@zxyj-lg.com` **提交规范**: 使用 Conventional Commits 格式(type: description),type 可选值: `feat`、`fix`、`style`、`refactor`、`perf`、`test`、`chore`、`docs`。 **安全限制**: - 禁止执行 `git push`(无论 origin 还是任何 remote) - 若任务需要推送到远端,必须请求用户授权,由用户自行推送 - 禁止覆盖远程分支或推送他人提交的代码 - 本地分支未经验证前,不合并到主分支 - 任何数据修改操作需先备份或确认影响范围 ## 端口 - 本地: 9000(`uvicorn local_report_app:app --port 9000`) - 生产: `ai.etotem.com.cn` ## 启动 ```powershell cd d:\Java_code\CFC\cfc-langgraph .\.venv\Scripts\python.exe -m uvicorn local_report_app:app --host 0.0.0.0 --port 9000 ``` ## 测试 **⚠️ G-376-1(已闭环)**:系统 `python3` = 3.6.8,无 pytest 模块。 必须走 venv 解释器,禁止裸用 `python` / `python3`。 **推荐命令**(G-376-2 也一并覆盖): ```bash cd /sc-data/cfc/cfc-langgraph ./scripts/run_pytest.sh # 全量 tests/,timeout 600s,日志落盘 /tmp/r*.log ./scripts/run_pytest.sh tests/test_intent.py # 单文件 TIMEOUT_SEC=900 ./scripts/run_pytest.sh # 自定义超时 ``` **脚本行为**(R376-lg-venv 闭环实现): - `VENV_PY=.venv/bin/python` — 强制使用 venv 解释器(Python 3.11.x + pytest 9.1.1) - `timeout ${TIMEOUT_SEC}` 默认 600s — 避免 B-325-1 驻留进程在 360s 时强杀于汇总前 - `tee ${LOG_FILE}` — 输出同时打到 stdout 和 `/tmp/r{run_id}_lg.log` - grep 兜底汇总行 — 即使 tee 被截断,仍能从 log_file 提取 passed/failed 计数 **已知红例(环境型,非代码缺陷)**: - `test_auto_tag.py` ×3、`test_intent.py` ×3:AgnesAI API 429 配额超限 → 意图分类 fallback 到 `chat`,端点返回 500 - 解决方式:等待配额刷新后重跑;或将相关用例标记 `pytest.mark.skip(reason="429 rate limit")` ## 技术栈 - Python + FastAPI - LangGraph(AI 图谱) - ChromaDB(RAG 向量库) - 本地仅跑 `local_report_app:app`(最小健康报告解析服务);完整 `app.main:app`(对话/RAG/whisper)走生产