Fix linting

This commit is contained in:
yangdx
2025-03-26 23:53:41 +08:00
parent e7f68f7b77
commit dfa63e863c
2 changed files with 12 additions and 4 deletions

View File

@@ -8,7 +8,6 @@ from typing import Optional, List, Tuple
import sys
from ascii_colors import ASCIIColors
import logging
from ascii_colors import ASCIIColors
from lightrag.api import __api_version__
from fastapi import HTTPException, Security, Request, status
from dotenv import load_dotenv
@@ -17,15 +16,18 @@ from starlette.status import HTTP_403_FORBIDDEN
from .auth import auth_handler
from ..prompt import PROMPTS
def check_env_file():
"""
Check if .env file exists and handle user confirmation if needed.
Returns True if should continue, False if should exit.
"""
if not os.path.exists(".env"):
warning_msg = "Warning: .env file not found. Some features may not work properly."
warning_msg = (
"Warning: .env file not found. Some features may not work properly."
)
ASCIIColors.yellow(warning_msg)
# Check if running in interactive terminal
if sys.stdin.isatty():
response = input("Do you want to continue? (yes/no): ")
@@ -34,6 +36,7 @@ def check_env_file():
return False
return True
# Load environment variables
load_dotenv()

View File

@@ -75,7 +75,12 @@ class LightragPathFilter(logging.Filter):
def __init__(self):
super().__init__()
# Define paths to be filtered
self.filtered_paths = ["/documents", "/health", "/webui/", "/documents/pipeline_status"]
self.filtered_paths = [
"/documents",
"/health",
"/webui/",
"/documents/pipeline_status",
]
# self.filtered_paths = ["/health", "/webui/"]
def filter(self, record):