Kevin Hu
commited on
Commit
·
660ec98
1
Parent(s):
5dc49d0
refactor (#2858)
Browse files### What problem does this PR solve?
### Type of change
- [x] Refactoring
- api/apps/document_app.py +4 -16
api/apps/document_app.py
CHANGED
@@ -13,16 +13,8 @@
|
|
13 |
# See the License for the specific language governing permissions and
|
14 |
# limitations under the License
|
15 |
#
|
16 |
-
import datetime
|
17 |
-
import hashlib
|
18 |
-
import json
|
19 |
-
import os
|
20 |
import pathlib
|
21 |
import re
|
22 |
-
import traceback
|
23 |
-
from concurrent.futures import ThreadPoolExecutor
|
24 |
-
from copy import deepcopy
|
25 |
-
from io import BytesIO
|
26 |
|
27 |
import flask
|
28 |
from elasticsearch_dsl import Q
|
@@ -30,26 +22,22 @@ from flask import request
|
|
30 |
from flask_login import login_required, current_user
|
31 |
|
32 |
from api.db.db_models import Task, File
|
33 |
-
from api.db.services.dialog_service import DialogService, ConversationService
|
34 |
from api.db.services.file2document_service import File2DocumentService
|
35 |
from api.db.services.file_service import FileService
|
36 |
-
from api.db.services.llm_service import LLMBundle
|
37 |
from api.db.services.task_service import TaskService, queue_tasks
|
38 |
-
from api.db.services.user_service import
|
39 |
-
from graphrag.mind_map_extractor import MindMapExtractor
|
40 |
-
from rag.app import naive
|
41 |
from rag.nlp import search
|
42 |
from rag.utils.es_conn import ELASTICSEARCH
|
43 |
from api.db.services import duplicate_name
|
44 |
from api.db.services.knowledgebase_service import KnowledgebaseService
|
45 |
from api.utils.api_utils import server_error_response, get_data_error_result, validate_request
|
46 |
from api.utils import get_uuid
|
47 |
-
from api.db import FileType, TaskStatus, ParserType, FileSource
|
48 |
from api.db.services.document_service import DocumentService, doc_upload_and_parse
|
49 |
-
from api.settings import RetCode
|
50 |
from api.utils.api_utils import get_json_result
|
51 |
from rag.utils.storage_factory import STORAGE_IMPL
|
52 |
-
from api.utils.file_utils import filename_type, thumbnail
|
53 |
from api.utils.web_utils import html2pdf, is_valid_url
|
54 |
from api.contants import IMG_BASE64_PREFIX
|
55 |
|
|
|
13 |
# See the License for the specific language governing permissions and
|
14 |
# limitations under the License
|
15 |
#
|
|
|
|
|
|
|
|
|
16 |
import pathlib
|
17 |
import re
|
|
|
|
|
|
|
|
|
18 |
|
19 |
import flask
|
20 |
from elasticsearch_dsl import Q
|
|
|
22 |
from flask_login import login_required, current_user
|
23 |
|
24 |
from api.db.db_models import Task, File
|
|
|
25 |
from api.db.services.file2document_service import File2DocumentService
|
26 |
from api.db.services.file_service import FileService
|
|
|
27 |
from api.db.services.task_service import TaskService, queue_tasks
|
28 |
+
from api.db.services.user_service import UserTenantService
|
|
|
|
|
29 |
from rag.nlp import search
|
30 |
from rag.utils.es_conn import ELASTICSEARCH
|
31 |
from api.db.services import duplicate_name
|
32 |
from api.db.services.knowledgebase_service import KnowledgebaseService
|
33 |
from api.utils.api_utils import server_error_response, get_data_error_result, validate_request
|
34 |
from api.utils import get_uuid
|
35 |
+
from api.db import FileType, TaskStatus, ParserType, FileSource
|
36 |
from api.db.services.document_service import DocumentService, doc_upload_and_parse
|
37 |
+
from api.settings import RetCode
|
38 |
from api.utils.api_utils import get_json_result
|
39 |
from rag.utils.storage_factory import STORAGE_IMPL
|
40 |
+
from api.utils.file_utils import filename_type, thumbnail
|
41 |
from api.utils.web_utils import html2pdf, is_valid_url
|
42 |
from api.contants import IMG_BASE64_PREFIX
|
43 |
|