聊天和回忆录证据检索都走 pgvector,去掉 Postgres FTS/content_tsv,新迁移删掉 content_tsv 列(部署要先 alembic upgrade)。

Embedding 端口增加 is_available(),聊天和回忆录日志用统一方式表示向量是否真能调用。

记忆整理(compaction)支持 Beat 定期扫用户;

事实抽取提示与 subject 归一化,减少同一人多种称呼;
This commit is contained in:
Kevin
2026-04-03 11:43:16 +08:00
parent b853b986dd
commit 41518bda11
26 changed files with 543 additions and 222 deletions

View File

@@ -5,6 +5,10 @@ from typing import Protocol, runtime_checkable
@runtime_checkable
class EmbeddingProvider(Protocol):
def is_available(self) -> bool:
"""进程内 embedding 已配置且可发起调用(无 key / 未初始化 client 时为 False"""
...
async def embed_text(self, text: str) -> list[float]:
"""Embed a single text into a vector."""
...
@@ -12,3 +16,11 @@ class EmbeddingProvider(Protocol):
async def embed_texts(self, texts: list[str]) -> list[list[float]]:
"""Embed multiple texts into vectors."""
...
def embed_text_sync(self, text: str) -> list[float]:
"""同步嵌入单条文本Celery / sync DB 会话)。"""
...
def embed_texts_sync(self, texts: list[str]) -> list[list[float]]:
"""同步嵌入多条文本Celery / sync DB 会话)。"""
...