Update lightrag_server.py
This commit is contained in:
@@ -408,6 +408,13 @@ def parse_args() -> argparse.Namespace:
|
|||||||
default=get_env_value("SSL_KEYFILE", None),
|
default=get_env_value("SSL_KEYFILE", None),
|
||||||
help="Path to SSL private key file (required if --ssl is enabled)",
|
help="Path to SSL private key file (required if --ssl is enabled)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--auto-scan-at-startup',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Enable automatic scanning when the program starts'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
display_splash_screen(args)
|
display_splash_screen(args)
|
||||||
@@ -800,6 +807,9 @@ def create_app(args):
|
|||||||
async def lifespan(app: FastAPI):
|
async def lifespan(app: FastAPI):
|
||||||
"""Lifespan context manager for startup and shutdown events"""
|
"""Lifespan context manager for startup and shutdown events"""
|
||||||
# Startup logic
|
# Startup logic
|
||||||
|
# Now only if this option is active, we can scan. This is better for big databases where there are hundreds of
|
||||||
|
# files. Makes the startup faster
|
||||||
|
if args.auto_scan_at_startup:
|
||||||
try:
|
try:
|
||||||
new_files = doc_manager.scan_directory()
|
new_files = doc_manager.scan_directory()
|
||||||
for file_path in new_files:
|
for file_path in new_files:
|
||||||
|
Reference in New Issue
Block a user