fix deploy bug
This commit is contained in:
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user