fix deploy bug

This commit is contained in:
EduBrain Dev
2026-04-14 18:00:18 +08:00
parent c5f96056fa
commit 2a6e506416
2 changed files with 18 additions and 21 deletions

View File

@@ -181,22 +181,15 @@ class PageService:
if embedding:
embedding_str = "[" + ",".join(str(x) for x in embedding) + "]"
await self.db.execute(text("""
INSERT INTO knowledge_chunks (page_id, chunk_index, content, embedding)
VALUES (:page_id, :chunk_index, :content, :embedding::vector)
"""), {
await self.db.execute(text(
"INSERT INTO knowledge_chunks (page_id, chunk_index, content, embedding) "
"VALUES (:page_id, :chunk_index, :content, :embedding)"
), {
"page_id": page_id,
"chunk_index": idx,
"content": chunk_text,
"embedding": embedding_str,
})
# 更新全文搜索向量
await self.db.execute(text("""
UPDATE knowledge_chunks
SET search_vector = to_tsvector('chinese_zh', content)
WHERE page_id = :page_id
"""), {"page_id": page_id})
await self.db.flush()
return {"page_id": page_id, "chunks": len(chunks)}