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
Remove unused code (#3448)
Jin Hai70cd5c1599ad
diff --git a/api/apps/__init__.py b/api/apps/__init__.pyindex 5bc8d327f8..e2916f1c87 100644--- a/api/apps/__init__.py+++ b/api/apps/__init__.py@@ -22,6 +22,7 @@ from flask import Blueprint, Flaskfrom werkzeug.wrappers.request import Requestfrom flask_cors import CORSfrom flasgger import Swagger+from itsdangerous.url_safe import URLSafeTimedSerializer as Serializerfrom api.db import StatusEnumfrom api.db.db_models import close_connection@@ -32,7 +33,7 @@ from flask_session import Sessionfrom flask_login import LoginManagerfrom api import settingsfrom api.utils.api_utils import server_error_response-from itsdangerous.url_safe import URLSafeTimedSerializer as Serializer+from api.constants import API_VERSION__all__ = ["app"]@@ -119,7 +120,7 @@ def register_page(page_path):spec.loader.exec_module(page)page_name = getattr(page, "page_name", page_name)url_prefix = (- f"/api/{settings.API_VERSION}" if "/sdk/" in path else f"/{settings.API_VERSION}/{page_name}"+ f"/api/{API_VERSION}" if "/sdk/" in path else f"/{API_VERSION}/{page_name}")app.register_blueprint(page.manager, url_prefix=url_prefix)diff --git a/api/constants.py b/api/constants.pyindex f571d21578..8d72c7e85a 100644--- a/api/constants.py+++ b/api/constants.py@@ -17,4 +17,9 @@ NAME_LENGTH_LIMIT = 2 ** 10IMG_BASE64_PREFIX = 'data:image/png;base64,'-SERVICE_CONF = "service_conf.yaml"\ No newline at end of file+SERVICE_CONF = "service_conf.yaml"++API_VERSION = "v1"+RAG_FLOW_SERVICE_NAME = "ragflow"+REQUEST_WAIT_SEC = 2+REQUEST_MAX_WAIT_SEC = 300diff --git a/api/settings.py b/api/settings.pyindex 0abf548e8c..b6afba0e84 100644--- a/api/settings.py+++ b/api/settings.py@@ -23,13 +23,10 @@ import rag.utilsfrom rag.nlp import searchfrom graphrag import search as kg_searchfrom api.utils import get_base_config, decrypt_database_config+from api.constants import RAG_FLOW_SERVICE_NAME-API_VERSION = "v1"-RAG_FLOW_SERVICE_NAME = "ragflow"LIGHTEN = int(os.environ.get('LIGHTEN', "0"))-REQUEST_WAIT_SEC = 2-REQUEST_MAX_WAIT_SEC = 300LLM = NoneLLM_FACTORY = NoneLLM_BASE_URL = None@@ -173,15 +170,6 @@ def init_settings():retrievaler = search.Dealer(docStoreConn)kg_retrievaler = kg_search.KGSearch(docStoreConn)-def get_host_ip():- global HOST_IP- return HOST_IP---def get_host_port():- global HOST_PORT- return HOST_PORT-class CustomEnum(Enum):@classmethod@@ -201,16 +189,6 @@ class CustomEnum(Enum):return [member.name for member in cls.__members__.values()]-class PythonDependenceName(CustomEnum):- Rag_Source_Code = "python"- Python_Env = "miniconda"---class ModelStorage(CustomEnum):- REDIS = "redis"- MYSQL = "mysql"--class RetCode(IntEnum, CustomEnum):SUCCESS = 0NOT_EFFECTIVE = 10diff --git a/api/utils/api_utils.py b/api/utils/api_utils.pyindex 7d1fc7725c..895df97dda 100644--- a/api/utils/api_utils.py+++ b/api/utils/api_utils.py@@ -39,6 +39,7 @@ from api import settingsfrom api import settingsfrom api.utils import CustomJSONEncoder, get_uuidfrom api.utils import json_dumps+from api.constants import REQUEST_WAIT_SEC, REQUEST_MAX_WAIT_SECrequests.models.complexjson.dumps = functools.partial(json.dumps, cls=CustomJSONEncoder)@@ -87,7 +88,7 @@ def request(**kwargs):def get_exponential_backoff_interval(retries, full_jitter=False):"""Calculate the exponential backoff wait time."""# Will be zero if factor equals 0- countdown = min(settings.REQUEST_MAX_WAIT_SEC, settings.REQUEST_WAIT_SEC * (2 ** retries))+ countdown = min(REQUEST_MAX_WAIT_SEC, REQUEST_WAIT_SEC * (2 ** retries))# Full jitter according to# https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/if full_jitter: