mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-16 04:37:21 +08:00
Refactor: reformat all code for lefthook using ruff and gofmt (#16585)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
print("Start RAGFlow server...")
|
||||
|
||||
import time
|
||||
|
||||
start_ts = time.time()
|
||||
|
||||
import os
|
||||
@@ -48,7 +49,8 @@ from rag.utils.redis_conn import RedisDistributedLock
|
||||
|
||||
stop_event = threading.Event()
|
||||
|
||||
RAGFLOW_DEBUGPY_LISTEN = int(os.environ.get('RAGFLOW_DEBUGPY_LISTEN', "0"))
|
||||
RAGFLOW_DEBUGPY_LISTEN = int(os.environ.get("RAGFLOW_DEBUGPY_LISTEN", "0"))
|
||||
|
||||
|
||||
def update_progress():
|
||||
lock_value = str(uuid.uuid4())
|
||||
@@ -68,6 +70,7 @@ def update_progress():
|
||||
logging.exception("update_progress exception")
|
||||
stop_event.wait(6)
|
||||
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
logging.info("Received interrupt signal, shutting down...")
|
||||
shutdown_all_mcp_sessions()
|
||||
@@ -75,7 +78,8 @@ def signal_handler(sig, frame):
|
||||
stop_event.wait(1)
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if __name__ == "__main__":
|
||||
faulthandler.enable()
|
||||
init_root_logger("ragflow_server")
|
||||
logging.info(r"""
|
||||
@@ -86,12 +90,8 @@ if __name__ == '__main__':
|
||||
/_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/
|
||||
|
||||
""")
|
||||
logging.info(
|
||||
f'RAGFlow version: {get_ragflow_version()}'
|
||||
)
|
||||
logging.info(
|
||||
f'project base: {get_project_base_directory()}'
|
||||
)
|
||||
logging.info(f"RAGFlow version: {get_ragflow_version()}")
|
||||
logging.info(f"project base: {get_project_base_directory()}")
|
||||
show_configs()
|
||||
settings.init_settings()
|
||||
settings.print_rag_settings()
|
||||
@@ -99,6 +99,7 @@ if __name__ == '__main__':
|
||||
if RAGFLOW_DEBUGPY_LISTEN > 0:
|
||||
logging.info(f"debugpy listen on {RAGFLOW_DEBUGPY_LISTEN}")
|
||||
import debugpy
|
||||
|
||||
debugpy.listen(("0.0.0.0", RAGFLOW_DEBUGPY_LISTEN))
|
||||
|
||||
# init db
|
||||
@@ -108,15 +109,9 @@ if __name__ == '__main__':
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--version", default=False, help="RAGFlow version", action="store_true"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--debug", default=False, help="debug mode", action="store_true"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--init-superuser", default=False, help="init superuser", action="store_true"
|
||||
)
|
||||
parser.add_argument("--version", default=False, help="RAGFlow version", action="store_true")
|
||||
parser.add_argument("--debug", default=False, help="debug mode", action="store_true")
|
||||
parser.add_argument("--init-superuser", default=False, help="init superuser", action="store_true")
|
||||
args = parser.parse_args()
|
||||
if args.version:
|
||||
print(get_ragflow_version())
|
||||
@@ -144,6 +139,7 @@ if __name__ == '__main__':
|
||||
def start_chat_channels():
|
||||
try:
|
||||
from api.channels.bootstrap import start_channel_server
|
||||
|
||||
logging.info("Starting chat channel server thread")
|
||||
t = threading.Thread(
|
||||
target=start_channel_server,
|
||||
|
||||
Reference in New Issue
Block a user