diff --git a/assets/schema/knowledge_management.sql b/assets/schema/knowledge_management.sql index df0b09982..2c50e42b4 100644 --- a/assets/schema/knowledge_management.sql +++ b/assets/schema/knowledge_management.sql @@ -18,8 +18,9 @@ CREATE TABLE `knowledge_document` ( `chunk_size` int NOT NULL COMMENT 'chunk size', `last_sync` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'last sync time', `status` varchar(50) NOT NULL COMMENT 'status TODO,RUNNING,FAILED,FINISHED', - `content` LONGTEXT NOT NULL COMMENT 'knowledge content', - `vector_ids` LONGTEXT NOT NULL COMMENT 'vector_ids', + `content` LONGTEXT NOT NULL COMMENT 'knowledge embedding sync result', + `result` TEXT NULL COMMENT 'knowledge content', + `vector_ids` LONGTEXT NULL COMMENT 'vector_ids', `gmt_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'created time', `gmt_modified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time', PRIMARY KEY (`id`), diff --git a/pilot/openapi/knowledge/knowledge_document_dao.py b/pilot/openapi/knowledge/knowledge_document_dao.py index cad881e71..f99b81a72 100644 --- a/pilot/openapi/knowledge/knowledge_document_dao.py +++ b/pilot/openapi/knowledge/knowledge_document_dao.py @@ -118,11 +118,11 @@ class KnowledgeDocumentDao: count = knowledge_documents.scalar() return count - # def update_knowledge_document(self, document: KnowledgeDocumentEntity): - # session = self.Session() - # updated_space = session.merge(document) - # session.commit() - # return updated_space.id + def update_knowledge_document(self, document: KnowledgeDocumentEntity): + session = self.Session() + updated_space = session.merge(document) + session.commit() + return updated_space.id # # def delete_knowledge_document(self, document_id: int): # cursor = self.conn.cursor() diff --git a/pilot/openapi/knowledge/knowledge_service.py b/pilot/openapi/knowledge/knowledge_service.py index 2f035fcb5..4ad9dcec3 100644 --- a/pilot/openapi/knowledge/knowledge_service.py +++ b/pilot/openapi/knowledge/knowledge_service.py @@ -76,6 +76,7 @@ class KnowledgeService: status=SyncStatus.TODO.name, last_sync=datetime.now(), content=request.content, + result="", ) knowledge_document_dao.create_knowledge_document(document) return True