Fix linting

This commit is contained in:
yangdx
2025-04-04 21:34:13 +08:00
parent 27d478385d
commit caac0479d3
3 changed files with 23 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ from dotenv import load_dotenv
# the OS environment variables take precedence over the .env file
load_dotenv(dotenv_path=".env", override=False)
class OllamaServerInfos:
# Constants for emulated Ollama model information
LIGHTRAG_NAME = "lightrag"
@@ -302,7 +303,7 @@ def parse_args() -> argparse.Namespace:
# Select Document loading tool (DOCLING, DEFAULT)
args.document_loading_engine = get_env_value("DOCUMENT_LOADING_ENGINE", "DEFAULT")
# Add environment variables that were previously read directly
args.cors_origins = get_env_value("CORS_ORIGINS", "*")
args.summary_language = get_env_value("SUMMARY_LANGUAGE", "en")

View File

@@ -321,9 +321,7 @@ def create_app(args):
# namespace_prefix=args.namespace_prefix,
auto_manage_storages_states=False,
max_parallel_insert=args.max_parallel_insert,
addon_params={
"language": args.summary_language
},
addon_params={"language": args.summary_language},
)
else: # azure_openai
rag = LightRAG(
@@ -354,9 +352,7 @@ def create_app(args):
# namespace_prefix=args.namespace_prefix,
auto_manage_storages_states=False,
max_parallel_insert=args.max_parallel_insert,
addon_params={
"language": args.summary_language
},
addon_params={"language": args.summary_language},
)
# Add routes

View File

@@ -120,12 +120,22 @@ def main():
# Set configuration variables in gunicorn_config, prioritizing command line arguments
gunicorn_config.workers = (
global_args.workers if global_args.workers else int(os.getenv("WORKERS", 1))
global_args.workers
if global_args.workers
else int(os.getenv("WORKERS", 1))
)
# Bind configuration prioritizes command line arguments
host = global_args.host if global_args.host != "0.0.0.0" else os.getenv("HOST", "0.0.0.0")
port = global_args.port if global_args.port != 9621 else int(os.getenv("PORT", 9621))
host = (
global_args.host
if global_args.host != "0.0.0.0"
else os.getenv("HOST", "0.0.0.0")
)
port = (
global_args.port
if global_args.port != 9621
else int(os.getenv("PORT", 9621))
)
gunicorn_config.bind = f"{host}:{port}"
# Log level configuration prioritizes command line arguments
@@ -137,7 +147,9 @@ def main():
# Timeout configuration prioritizes command line arguments
gunicorn_config.timeout = (
global_args.timeout if global_args.timeout * 2 else int(os.getenv("TIMEOUT", 150 * 2))
global_args.timeout
if global_args.timeout * 2
else int(os.getenv("TIMEOUT", 150 * 2))
)
# Keepalive configuration
@@ -157,7 +169,9 @@ def main():
else os.getenv("SSL_CERTFILE")
)
gunicorn_config.keyfile = (
global_args.ssl_keyfile if global_args.ssl_keyfile else os.getenv("SSL_KEYFILE")
global_args.ssl_keyfile
if global_args.ssl_keyfile
else os.getenv("SSL_KEYFILE")
)
# Set configuration options from the module