Kevin Hu
commited on
Commit
·
83ee116
1
Parent(s):
cfaee9c
Refactor. (#4487)
Browse files### What problem does this PR solve?
### Type of change
- [x] Refactoring
- api/apps/kb_app.py +3 -1
- api/db/db_models.py +0 -5
- api/ragflow_server.py +1 -1
- deepdoc/parser/resume/entities/corporations.py +1 -1
- rag/utils/doc_store_conn.py +1 -2
api/apps/kb_app.py
CHANGED
@@ -116,8 +116,10 @@ def update():
|
|
116 |
if not e:
|
117 |
return get_data_error_result(
|
118 |
message="Database error (Knowledgebase rename)!")
|
|
|
|
|
119 |
|
120 |
-
return get_json_result(data=kb
|
121 |
except Exception as e:
|
122 |
return server_error_response(e)
|
123 |
|
|
|
116 |
if not e:
|
117 |
return get_data_error_result(
|
118 |
message="Database error (Knowledgebase rename)!")
|
119 |
+
kb = kb.to_dict()
|
120 |
+
kb.update(req)
|
121 |
|
122 |
+
return get_json_result(data=kb)
|
123 |
except Exception as e:
|
124 |
return server_error_response(e)
|
125 |
|
api/db/db_models.py
CHANGED
@@ -1051,11 +1051,6 @@ def migrate_db():
|
|
1051 |
)
|
1052 |
except Exception:
|
1053 |
pass
|
1054 |
-
try:
|
1055 |
-
DB.execute_sql('ALTER TABLE llm DROP PRIMARY KEY;')
|
1056 |
-
DB.execute_sql('ALTER TABLE llm ADD PRIMARY KEY (llm_name,fid);')
|
1057 |
-
except Exception:
|
1058 |
-
pass
|
1059 |
try:
|
1060 |
migrate(
|
1061 |
migrator.add_column('task', 'retry_count', IntegerField(default=0))
|
|
|
1051 |
)
|
1052 |
except Exception:
|
1053 |
pass
|
|
|
|
|
|
|
|
|
|
|
1054 |
try:
|
1055 |
migrate(
|
1056 |
migrator.add_column('task', 'retry_count', IntegerField(default=0))
|
api/ragflow_server.py
CHANGED
@@ -45,7 +45,7 @@ from rag.settings import print_rag_settings
|
|
45 |
|
46 |
def update_progress():
|
47 |
while True:
|
48 |
-
time.sleep(
|
49 |
try:
|
50 |
DocumentService.update_progress()
|
51 |
except Exception:
|
|
|
45 |
|
46 |
def update_progress():
|
47 |
while True:
|
48 |
+
time.sleep(6)
|
49 |
try:
|
50 |
DocumentService.update_progress()
|
51 |
except Exception:
|
deepdoc/parser/resume/entities/corporations.py
CHANGED
@@ -44,7 +44,7 @@ def baike(cid, default_v=0):
|
|
44 |
|
45 |
def corpNorm(nm, add_region=True):
|
46 |
global CORP_TKS
|
47 |
-
if not nm or isinstance(nm, str):
|
48 |
return ""
|
49 |
nm = rag_tokenizer.tradi2simp(rag_tokenizer.strQ2B(nm)).lower()
|
50 |
nm = re.sub(r"&", "&", nm)
|
|
|
44 |
|
45 |
def corpNorm(nm, add_region=True):
|
46 |
global CORP_TKS
|
47 |
+
if not nm or not isinstance(nm, str):
|
48 |
return ""
|
49 |
nm = rag_tokenizer.tradi2simp(rag_tokenizer.strQ2B(nm)).lower()
|
50 |
nm = re.sub(r"&", "&", nm)
|
rag/utils/doc_store_conn.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
from abc import ABC, abstractmethod
|
2 |
from dataclasses import dataclass
|
3 |
import numpy as np
|
4 |
-
import polars as pl
|
5 |
|
6 |
DEFAULT_MATCH_VECTOR_TOPN = 10
|
7 |
DEFAULT_MATCH_SPARSE_TOPN = 10
|
@@ -187,7 +186,7 @@ class DocStoreConnection(ABC):
|
|
187 |
knowledgebaseIds: list[str],
|
188 |
aggFields: list[str] = [],
|
189 |
rank_feature: dict | None = None
|
190 |
-
)
|
191 |
"""
|
192 |
Search with given conjunctive equivalent filtering condition and return all fields of matched documents
|
193 |
"""
|
|
|
1 |
from abc import ABC, abstractmethod
|
2 |
from dataclasses import dataclass
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
DEFAULT_MATCH_VECTOR_TOPN = 10
|
6 |
DEFAULT_MATCH_SPARSE_TOPN = 10
|
|
|
186 |
knowledgebaseIds: list[str],
|
187 |
aggFields: list[str] = [],
|
188 |
rank_feature: dict | None = None
|
189 |
+
):
|
190 |
"""
|
191 |
Search with given conjunctive equivalent filtering condition and return all fields of matched documents
|
192 |
"""
|