mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-12-16 21:20:39 +03:00
refactoring (#26)
This commit is contained in:
@@ -8,7 +8,7 @@ router = APIRouter()
|
||||
|
||||
|
||||
@router.post(
|
||||
f"/{settings.TELEGRAM_API_TOKEN}",
|
||||
f"/{settings.token_part}",
|
||||
name="bot:process_bot_updates",
|
||||
response_class=Response,
|
||||
status_code=status.HTTP_202_ACCEPTED,
|
||||
|
||||
13
bot_microservice/api/bot/deps.py
Normal file
13
bot_microservice/api/bot/deps.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from fastapi import Depends
|
||||
from starlette.requests import Request
|
||||
|
||||
from core.bot.services import ChatGptService
|
||||
from settings.config import AppSettings
|
||||
|
||||
|
||||
def get_settings(request: Request) -> AppSettings:
|
||||
return request.app.state.settings
|
||||
|
||||
|
||||
def get_chat_gpt_service(settings: AppSettings = Depends(get_settings)) -> ChatGptService:
|
||||
return ChatGptService(settings.GPT_MODEL)
|
||||
Reference in New Issue
Block a user