RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Go: fix dataset time unit (#14837)
buua43614332dd75c32
diff --git a/internal/dao/kb.go b/internal/dao/kb.goindex d87051d983..0da2558e67 100644--- a/internal/dao/kb.go+++ b/internal/dao/kb.go@@ -314,30 +314,30 @@ func splitNameCounter(name string) (string, int) {// AtomicIncreaseDocNumByID atomically increments the document count// This matches the Python atomic_increase_doc_num_by_id methodfunc (dao *KnowledgebaseDAO) AtomicIncreaseDocNumByID(kbID string) error {- now := time.Now().Unix()- nowDate := time.Now().Truncate(time.Second)+ now := time.Now().Truncate(time.Second)+ updateTime := now.UnixMilli()return DB.Model(&entity.Knowledgebase{}).Where("id = ?", kbID).Updates(map[string]interface{}{"doc_num": DB.Raw("doc_num + 1"),- "update_time": now,- "update_date": nowDate,+ "update_time": updateTime,+ "update_date": now,}).Error}// DecreaseDocumentNum decreases document, chunk, and token counts// This matches the Python decrease_document_num_in_delete methodfunc (dao *KnowledgebaseDAO) DecreaseDocumentNum(kbID string, docNum, chunkNum, tokenNum int64) error {- now := time.Now().Unix()- nowDate := time.Now().Truncate(time.Second)+ now := time.Now().Truncate(time.Second)+ updateTime := now.UnixMilli()return DB.Model(&entity.Knowledgebase{}).Where("id = ?", kbID).Updates(map[string]interface{}{"doc_num": DB.Raw("doc_num - ?", docNum),"chunk_num": DB.Raw("chunk_num - ?", chunkNum),"token_num": DB.Raw("token_num - ?", tokenNum),- "update_time": now,- "update_date": nowDate,+ "update_time": updateTime,+ "update_date": now,}).Error}diff --git a/internal/service/datasets.go b/internal/service/datasets.goindex 4c9d64aff0..db1320e6eb 100644--- a/internal/service/datasets.go+++ b/internal/service/datasets.go@@ -396,8 +396,8 @@ func (s *DatasetsService) CreateDataset(req *CreateDatasetRequest, tenantID strireturn nil, common.CodeServerError, errors.New("Internal server error")}- now := time.Now().Unix()- nowDate := time.Now().Truncate(time.Second)+ now := time.Now().Truncate(time.Second)+ createTime := now.UnixMilli()status := string(entity.StatusValid)// Deduplicate name within tenantduplicateName, err := common.DuplicateName(func(n, tid string) bool {@@ -420,10 +420,10 @@ func (s *DatasetsService) CreateDataset(req *CreateDatasetRequest, tenantID striEmbdID: embdID,Status: &status,}- kb.CreateTime = &now- kb.UpdateTime = &now- kb.CreateDate = &nowDate- kb.UpdateDate = &nowDate+ kb.CreateTime = &createTime+ kb.UpdateTime = &createTime+ kb.CreateDate = &now+ kb.UpdateDate = &nowif description != nil {kb.Description = descriptiondiff --git a/internal/service/kb.go b/internal/service/kb.goindex 77d2577926..75916413b6 100644--- a/internal/service/kb.go+++ b/internal/service/kb.go@@ -213,10 +213,10 @@ func (s *KnowledgebaseService) UpdateKB(req *UpdateKBRequest, userID string) (maupdates["parser_config"] = req.ParserConfig}- now := time.Now().Unix()- nowDate := time.Now().Truncate(time.Second)- updates["update_time"] = now- updates["update_date"] = nowDate+ now := time.Now().Truncate(time.Second)+ updateTime := now.UnixMilli()+ updates["update_time"] = updateTime+ updates["update_date"] = now// Update in databaseif err := s.kbDAO.UpdateByID(req.KBID, updates); err != nil {