Merge branch 'main' of http://182.92.86.220:8300/wx44wx/ZNJJ-api-server
# Conflicts: # docs/视频快处智能信息采集机器人交互接口文档V1.0.10.docx # src/api/endpoints.py # src/core/fastgpt_client.py
This commit is contained in:
@@ -6,7 +6,7 @@ from ..backends.chat import ChatBackend
|
||||
from ..backends.fastgpt import FastGPTBackend
|
||||
from .config import Config
|
||||
|
||||
# Global client instance
|
||||
|
||||
_fastgpt_client: AsyncChatClient | None = None
|
||||
_chat_backend: ChatBackend | None = None
|
||||
|
||||
@@ -16,8 +16,7 @@ async def lifespan(app: FastAPI):
|
||||
"""Manage FastGPT client lifecycle."""
|
||||
global _chat_backend, _fastgpt_client
|
||||
Config.validate()
|
||||
|
||||
# Initialize client
|
||||
|
||||
_fastgpt_client = AsyncChatClient(
|
||||
api_key=Config.FASTGPT_API_KEY,
|
||||
base_url=Config.FASTGPT_BASE_URL,
|
||||
@@ -39,7 +38,7 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
|
||||
def get_fastgpt_client() -> AsyncChatClient:
|
||||
"""Get the FastGPT client instance."""
|
||||
"""Get the initialized FastGPT client."""
|
||||
if _fastgpt_client is None:
|
||||
raise RuntimeError("FastGPT client not initialized")
|
||||
return _fastgpt_client
|
||||
|
||||
Reference in New Issue
Block a user