Files
ai-gateway-go/docs/adr/0001-baseline-storage.md
superidou b536672000 feat(m8): P2 pgvector + Ollama 向量化与语义检索
- PostgreSQL 切换 pgvector/pgvector:pg17 镜像;迁移 000024 建 vector 扩展、
  knowledge_chunks.embedding vector(1024) + HNSW 余弦索引,retrieval_mode 放宽三态
- OllamaEmbedder 本地 bge-m3 批量嵌入,404 惰性 pull 重试,维度/超时校验,可整体关闭
- SemanticRetriever/HybridRetriever + NewRetriever 按 retrieval_mode 分发,缺 embedder 回退 FTS
- 文档入库同步批量向量化;Ollama 故障降级入库 + embedding_failed 事件
- 修复 pgx CopyFrom 对 vector 列二进制编码误读:COPY 基础列后同事务 unnest 批量回填
- 修复降级路径 embeddings=nil 索引越界 panic(Add 与 Reprocess)
- 知识库列表 vectorized_chunk_count + 前端三态检索模式选择与向量化覆盖率
- 单测 embedder/retrievers + 集成 TestKnowledgeVectorLifecycle 全绿

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-12 15:16:32 +08:00

19 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR-0001:基线存储只使用 PostgreSQL 与 Redis
状态:已被 [ADR-0002](./0002-vector-storage-and-object-store.md) 取代
日期:2026-08-102026-08-12 修订:对象存储与向量化基础设施入基线,见 ADR-0002)
## 决策
第一版部署不包含 MinIO/S3 与 ClickHouse。
- PostgreSQL 保存权威业务数据、outbox、有限长度的审计请求/响应预览和聚合统计。
- critical Redis 保存限流、配额、幂等、配置协调与短期可靠流,使用 AOF 和 `noeviction`
- cache Redis 保存可丢弃缓存,使用 `allkeys-lfu`,故障时网关降级运行。
- 不把完整且无上限的请求正文、响应正文和知识库原始文件写入本地磁盘。
- 知识库只保存经过提取、大小不超过 2 MiB 的纯文本及其分块;`Retriever` 隔离检索实现,基线使用 PostgreSQL FTS 和中文词片评分。
## 影响
基线更容易部署和运维,但不承诺无限期保存完整审计正文,也不针对超大规模多年期分析查询优化。未来只有在容量和合规需求明确时,才通过 `AuditBodyStore``AnalyticsSink` 接口接入对象存储或分析库。