75592af33a47e281b64006836383c20947c162b6
Some checks failed
verify / verify (push) Has been cancelled
The API and ingestion tools now use a fixed internal model gateway while governed profiles, embedding cache assignments, traceable citations, and stable API errors establish the boundaries required by later workflows. Constraint: The current Alibaba Cloud workspace rejects all three live model calls with authentication failures Rejected: Give the API or seed tools the Bailian key and direct egress | combines database access, cloud credentials, and public network access Rejected: Mix offline and Bailian vectors in one demo namespace | makes profile activation and retrieval ambiguous Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep Bailian credentials and egress exclusive to model-gateway and create a new immutable profile hash for any embedding identity change Tested: make verify; 121 backend tests; 14 frontend tests; fresh and populated Alembic upgrade-downgrade-upgrade; two idempotent offline seeds; Docker health and HTTP retrieval; isolated provider smoke Not-tested: Successful live Bailian responses because the supplied workspace credential currently fails authentication
基于 RAG 的地质找矿知识问答系统
本仓库用于“基于 RAG 的地质找矿知识问答系统构建与应用”毕业设计。系统计划采用 Python/FastAPI 后端、React/TypeScript 前端、PostgreSQL + pgvector 向量存储,以及阿里云百炼的 text-embedding-v4、qwen3-rerank、deepseek-v4-flash。
当前处于 Stage 1“模型与数据库 PoC”:设计基线、离线 pgvector/适配器/seed、FastAPI 和 React/Nginx 可视化检索演示均可运行;真实百炼 smoke 仍待轮换后的新 Key,正式知识库、文档入库和生成问答尚未实现。完整方案、状态和评测方法见 docs/README.md,仓库不会把离线演示伪装成已经完成的产品。
目录
.
├── backend/ Python 后端代码与测试
├── frontend/ React 前端代码与测试
├── docs/ 全部需求、架构、数据、评测、部署和决策文档
├── data/ 只提交清单、格式说明和允许公开的小样例
├── ops/ Docker/PostgreSQL 初始化等运维资产(不含凭证)
├── scripts/ 安全检查、导入、验证、评测和运维脚本
├── .githooks/ 本地 Git 钩子
└── .gitea/workflows/ Gitea Actions 工作流
安全红线
- 百炼 API Key 只通过 Docker Secret、环境变量或云密钥管理服务注入。
- 真实
.env、secrets/、原始受限资料和私有评测数据一律禁止提交。 - 前端不得接触模型密钥;所有模型请求只能由后端发起。
- 每次提交前运行
make verify。它统一执行文档、链接、diff、密钥、后端与前端格式、类型、测试、构建和 Compose 配置检查。首次克隆后运行make setup-hooks启用提交前密钥检查。 - 若密钥曾出现在聊天、日志、终端历史或提交中,立即在百炼控制台重置;仅从 Git 历史删除文件并不能让密钥恢复安全。
阶段交付规则
每个阶段必须按以下顺序结束:
- 完成该阶段可验证的最小闭环。
- 运行格式、静态检查、测试和密钥扫描。
- 更新
docs/中的状态与设计决策。 - 使用符合 Lore 协议的提交信息提交。
- 推送到远端,确保过程产物可追踪。
文档入口
当前可运行入口
make setup-hooks
bash scripts/init-local-secrets.sh
docker compose up -d --build web
docker compose --profile tools run --rm seed-demo-offline
curl http://127.0.0.1:8000/health/ready
curl http://127.0.0.1:8000/api/v1/demo/status
make verify
这组命令不需要百炼 Key,只使用 20 条虚构数据验证 pgvector 写入、检索、重排、引用编号和同源 Web 交互。web 会依次启动数据库、迁移、内部 API 和 gateway;启动后访问 http://127.0.0.1:8000/ 使用 React 演示,或访问 http://127.0.0.1:8000/docs 查看 FastAPI Swagger。真实模型运行必须先轮换聊天中已暴露的旧 Key,再按 Stage 1 运行手册 操作。
Description
Languages
Python
73%
TypeScript
20.1%
CSS
5.4%
Shell
0.7%
JavaScript
0.4%
Other
0.3%