|
|
|
@ -7,13 +7,13 @@ from logging.handlers import RotatingFileHandler
|
|
|
|
|
import fastapi
|
|
|
|
|
import uvicorn
|
|
|
|
|
from fastapi import FastAPI
|
|
|
|
|
from lightrag import LightRAG
|
|
|
|
|
from lightrag.kg.shared_storage import initialize_pipeline_status
|
|
|
|
|
from raganything import RAGAnything
|
|
|
|
|
from sse_starlette import EventSourceResponse
|
|
|
|
|
from starlette.staticfiles import StaticFiles
|
|
|
|
|
|
|
|
|
|
from Util.RagUtil import initialize_rag, create_llm_model_func, create_vision_model_func, create_embedding_func
|
|
|
|
|
from lightrag import QueryParam, LightRAG
|
|
|
|
|
|
|
|
|
|
# 初始化日志
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
@ -39,10 +39,6 @@ logger.addHandler(console_handler)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def lifespan(app: FastAPI):
|
|
|
|
|
# 抑制HTTPS相关警告
|
|
|
|
|
warnings.filterwarnings('ignore', message='Connecting to .* using TLS with verify_certs=False is insecure')
|
|
|
|
|
warnings.filterwarnings('ignore', message='Unverified HTTPS request is being made to host')
|
|
|
|
|
|
|
|
|
|
# 初始化RAG
|
|
|
|
|
app.state.rag = await initialize_rag(working_dir="./Topic/Math")
|
|
|
|
|
yield
|
|
|
|
|