Isolate cloud model access before enabling product RAG workflows
Some checks failed
verify / verify (push) Has been cancelled
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
This commit is contained in:
@@ -14,7 +14,7 @@ make backend-sync
|
||||
bash scripts/init-local-secrets.sh
|
||||
```
|
||||
|
||||
脚本只生成三组彼此不同的随机 PostgreSQL 密码,文件权限为 `0600`。不带 `--with-bailian` 时不会创建模型 Key。
|
||||
脚本生成三组彼此不同的 PostgreSQL 密码,以及互不相同的 `model_gateway_api_token`、`model_gateway_worker_token`,文件权限为 `0600`。不带 `--with-bailian` 时不会创建或修改百炼 Key;若本地已存在 Key,脚本会明确提示保留原文件。
|
||||
|
||||
## 2. 离线数据库与向量 PoC
|
||||
|
||||
@@ -46,7 +46,7 @@ Seed 的实际流程是:
|
||||
|
||||
### 2.1 查看后端运行效果
|
||||
|
||||
内部 API 只连接 `internal` data 网络,只挂载 app 数据库 Secret,不连接外网,也不挂载百炼 Key。无 Secret、无数据库凭证的 gateway 连接 internal ingress/data;React/Nginx Web 连接 edge/ingress,并且是唯一发布到本机回环地址 `127.0.0.1:8000` 的容器。三个运行容器均使用非 root 用户、只读根文件系统并移除 Linux capabilities。
|
||||
内部 API 只连接 internal `data + model`,挂载 app 数据库 Secret 和 API 内部 token,不连接公网,也不挂载百炼 Key。独立 `model-gateway` 只连接 internal `model + egress`,是唯一挂载百炼 Key 的服务;它不连接数据库、不挂载上传卷、不发布端口。真实 `provider-smoke` 和 `seed-demo` 也只通过内部 token 调用该服务,不直持 Key。无数据库/模型 Secret 的入口 gateway 连接 internal ingress/data;React/Nginx Web 连接 edge/ingress,并且是唯一发布到本机回环地址 `127.0.0.1:8000` 的容器。
|
||||
|
||||
```bash
|
||||
curl http://127.0.0.1:8000/health/live
|
||||
@@ -82,7 +82,7 @@ bash scripts/init-local-secrets.sh --with-bailian
|
||||
docker compose --profile tools run --rm provider-smoke
|
||||
```
|
||||
|
||||
`provider-smoke` 依次验证:
|
||||
`provider-smoke` 以 API 内部身份调用 `model-gateway`,再由后者依次验证:
|
||||
|
||||
- `text-embedding-v4` 返回 1 个 1024 维有限非零向量;
|
||||
- `qwen3-rerank` 返回可映射到本地候选的下标和分数;
|
||||
@@ -97,7 +97,9 @@ docker compose --profile tools run --rm seed-demo
|
||||
docker compose --profile tools run --rm seed-demo
|
||||
```
|
||||
|
||||
真实模式仍只允许本仓库的虚构样例;任何真实地质报告必须等 Stage 3 的许可、涉密和 outbound manifest 审核链完成。
|
||||
真实模式使用 Worker 内部身份,仍只允许本仓库的虚构样例;任何真实地质报告必须等 Stage 3 的许可、涉密和 outbound manifest 审核链完成。
|
||||
|
||||
截至 2026-07-13,已通过独立 `model-gateway` 重跑三项真实调用:三项都到达供应商,但均返回安全脱敏的 `authentication` 类别(内部非流式调用由 Gateway 以 502 封装,Chat SSE 以终态错误事件返回;根因仍是供应商鉴权失败)。此时应核对 Key 所属工作空间、北京地域、专属端点、计费方案和模型权限,不要反复自动重试。在三项成功前不得声明百炼接入验收通过。
|
||||
|
||||
## 4. 质量门禁与排障
|
||||
|
||||
@@ -113,6 +115,7 @@ docker compose logs --no-log-prefix migrate
|
||||
|---|---|
|
||||
| `invalid_local_configuration` | 检查是否仍是占位 URL、两个 URL 是否同一北京工作空间、新 Key 文件是否存在 |
|
||||
| migrate 等不到 DB | 检查三个数据库 Secret 是否存在且互不相同;查看 bootstrap 日志 |
|
||||
| `migrate` 显示 `Exited (0)` | 正常:它是一次性 Alembic 服务,成功升级到 head 后就应退出;只有非 0 或反复重启才是故障 |
|
||||
| 401/403 | 不重试风暴;检查新 Key、工作空间和模型授权 |
|
||||
| 429/5xx/timeout | 适配器执行有界指数退避;持续失败时保留脱敏 request ID 后停止 |
|
||||
| seed 计数不是 20 | 不进入下一阶段;检查迁移、manifest 约束和事务日志 |
|
||||
@@ -127,4 +130,4 @@ docker compose down
|
||||
|
||||
## 5. 当前完成边界
|
||||
|
||||
可在没有百炼 Key 时验收:配置/Secret 安全、MockTransport 契约、离线向量/重排、Compose 渲染、空卷迁移、20 条写入和幂等。只有轮换后的新 Key 完成三模型真实 smoke 与真实 seed 后,Stage 1 才能从 `IN_PROGRESS` 改为 `DONE`。
|
||||
可在没有可用百炼权限时验收:配置/Secret 安全、内部 token 身份、MockTransport 契约、离线向量/重排、Compose 渲染、迁移、20 条写入和幂等。当前代码还包含 FastAPI 应用工厂、稳定 Problem/trace 契约,以及 `0002_model_profiles` 的 profile/cache/assignment/invocation/citation 迁移;这些不代表上传、正式检索、grounded chat、Worker 和评测已完成。只有有效 Key 完成三模型真实 smoke 与真实 seed 后,Stage 1 才能从 `IN_PROGRESS` 改为 `DONE`。
|
||||
|
||||
Reference in New Issue
Block a user