Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Refactor. (#4487)

Kevin Hue478586a8e06
diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py
index 35cc48351d..1b4af1939e 100644
--- a/api/apps/kb_app.py
+++ b/api/apps/kb_app.py
@@ -116,8 +116,10 @@ def update():
if not e:
return get_data_error_result(
message="Database error (Knowledgebase rename)!")
+ kb = kb.to_dict()
+ kb.update(req)
- return get_json_result(data=kb.to_json())
+ return get_json_result(data=kb)
except Exception as e:
return server_error_response(e)
diff --git a/api/db/db_models.py b/api/db/db_models.py
index ffb44259a6..2728b1d6e0 100644
--- a/api/db/db_models.py
+++ b/api/db/db_models.py
@@ -1051,11 +1051,6 @@ def migrate_db():
)
except Exception:
pass
- try:
- DB.execute_sql('ALTER TABLE llm DROP PRIMARY KEY;')
- DB.execute_sql('ALTER TABLE llm ADD PRIMARY KEY (llm_name,fid);')
- except Exception:
- pass
try:
migrate(
migrator.add_column('task', 'retry_count', IntegerField(default=0))
diff --git a/api/ragflow_server.py b/api/ragflow_server.py
index cd3bd8ccf4..d789903600 100644
--- a/api/ragflow_server.py
+++ b/api/ragflow_server.py
@@ -45,7 +45,7 @@ from rag.settings import print_rag_settings
def update_progress():
while True:
- time.sleep(3)
+ time.sleep(6)
try:
DocumentService.update_progress()
except Exception:
diff --git a/deepdoc/parser/resume/entities/corporations.py b/deepdoc/parser/resume/entities/corporations.py
index 6d0b293de4..faeae4061f 100644
--- a/deepdoc/parser/resume/entities/corporations.py
+++ b/deepdoc/parser/resume/entities/corporations.py
@@ -44,7 +44,7 @@ def baike(cid, default_v=0):
def corpNorm(nm, add_region=True):
global CORP_TKS
- if not nm or isinstance(nm, str):
+ if not nm or not isinstance(nm, str):
return ""
nm = rag_tokenizer.tradi2simp(rag_tokenizer.strQ2B(nm)).lower()
nm = re.sub(r"&", "&", nm)
diff --git a/rag/utils/doc_store_conn.py b/rag/utils/doc_store_conn.py
index 1e6e69c62f..b8a2088410 100644
--- a/rag/utils/doc_store_conn.py
+++ b/rag/utils/doc_store_conn.py
@@ -1,7 +1,6 @@
from abc import ABC, abstractmethod
from dataclasses import dataclass
import numpy as np
-import polars as pl
DEFAULT_MATCH_VECTOR_TOPN = 10
DEFAULT_MATCH_SPARSE_TOPN = 10
@@ -187,7 +186,7 @@ class DocStoreConnection(ABC):
knowledgebaseIds: list[str],
aggFields: list[str] = [],
rank_feature: dict | None = None
- ) -> list[dict] | pl.DataFrame:
+ ):
"""
Search with given conjunctive equivalent filtering condition and return all fields of matched documents
"""