cxd hai 9 meses
pai
achega
80d9d529c5
Modificáronse 1 ficheiros con 7 adicións e 27 borrados
  1. 7 27
      backend/Service/KbmService.py

+ 7 - 27
backend/Service/KbmService.py

@@ -1189,11 +1189,12 @@ class KbmService:
                         milvus_id=chunk['milvus_id']
                     )
                     inder +=1
+                    result.append({
+                        'page_number': i,
+                        'chunk_number': page_inder,
+                    })
                 page_inder += inder
-                result.append({
-                    'page_number': i,
-                    'chunk_number': page_inder,
-                })
+                
 
             logger.info("解析结束")
             return result
@@ -1201,7 +1202,7 @@ class KbmService:
         except Exception as e:
             logger.error(f'错误 {str(e)}')
             # raise ValueError(f'{str(e)} 行号:{sys._getframe().f_lineno}')
-            return []
+            return result
 
 
     #解析markdown
@@ -1601,28 +1602,7 @@ class KbmService:
         except Exception as e:
             logger.error(f"删除知识库时发生错误: {str(e)}", exc_info=True)
             return fail(f"删除知识库时发生错误: {str(e)}")
-        # bucket_id = request.POST.get("bucket_id")
-
-        # if not bucket_id:
-        #     return fail("Bucket ID 为空")
-
-        # try:
-        #     # 检查是否存在未删除的文档
-        #     active_docs_count = DocumentKbm.objects.filter(kb_id=bucket_id).exclude(status=4).count()
-
-        #     if active_docs_count > 0:
-        #         return fail(f"无法删除知识库,还有 {active_docs_count} 个未删除的文档")
-
-        #     # 如果没有未删除的文档,则更新知识库状态
-        #     updated_count = Knowledgebase.objects.filter(id=bucket_id).update(status=4,name=bucket_id, location=bucket_id)
-
-        #     if updated_count == 0:
-        #         return fail("指定的知识库不存在")
-
-        #     return success("知识库已成功删除")
-
-        # except Exception as e:
-        #     return fail(f"删除知识库时发生错误: {str(e)}")
+       
 
     @staticmethod
     def getRunStatus(request):