forked from HSE_team/BetterCallPraskovia
backend initialized
This commit is contained in:
commit
39bcd1c16e
13
backend/requirements.txt
Normal file
13
backend/requirements.txt
Normal file
@ -0,0 +1,13 @@
|
||||
fastapi==0.104.1
|
||||
uvicorn[standard]==0.24.0
|
||||
sqlalchemy[asyncio]==2.0.23
|
||||
asyncpg==0.29.0
|
||||
alembic==1.12.1
|
||||
pydantic==2.5.0
|
||||
pydantic-settings==2.1.0
|
||||
python-multipart==0.0.6
|
||||
httpx==0.25.2
|
||||
PyMuPDF==1.23.8
|
||||
Pillow==10.2.0
|
||||
dishka==0.7.0
|
||||
|
||||
4
backend/src/__init__.py
Normal file
4
backend/src/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""
|
||||
ИИ-юрист система
|
||||
"""
|
||||
|
||||
4
backend/src/application/__init__.py
Normal file
4
backend/src/application/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""
|
||||
Application layer
|
||||
"""
|
||||
|
||||
4
backend/src/domain/__init__.py
Normal file
4
backend/src/domain/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""
|
||||
Domain layer
|
||||
"""
|
||||
|
||||
4
backend/src/infrastructure/__init__.py
Normal file
4
backend/src/infrastructure/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""
|
||||
Infrastructure layer
|
||||
"""
|
||||
|
||||
4
backend/src/presentation/__init__.py
Normal file
4
backend/src/presentation/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""
|
||||
Presentation layer
|
||||
"""
|
||||
|
||||
4
backend/src/shared/__init__.py
Normal file
4
backend/src/shared/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""
|
||||
Shared utilities
|
||||
"""
|
||||
|
||||
48
backend/src/shared/config.py
Normal file
48
backend/src/shared/config.py
Normal file
@ -0,0 +1,48 @@
|
||||
"""
|
||||
Конфигурация приложения
|
||||
|
||||
"""
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Настройки (загружаются из .env автоматически)"""
|
||||
|
||||
POSTGRES_HOST: str = "localhost"
|
||||
POSTGRES_PORT: int = 5432
|
||||
POSTGRES_USER: str = "postgres"
|
||||
POSTGRES_PASSWORD: str = "postgres"
|
||||
POSTGRES_DB: str = "lawyer_ai"
|
||||
|
||||
QDRANT_HOST: str = "localhost"
|
||||
QDRANT_PORT: int = 6333
|
||||
|
||||
REDIS_HOST: str = "localhost"
|
||||
REDIS_PORT: int = 6379
|
||||
|
||||
TELEGRAM_BOT_TOKEN: Optional[str] = None
|
||||
YANDEX_OCR_API_KEY: Optional[str] = None
|
||||
DEEPSEEK_API_KEY: Optional[str] = None
|
||||
|
||||
YANDEX_OCR_API_URL: str = "https://vision.api.cloud.yandex.net/vision/v1/batchAnalyze"
|
||||
DEEPSEEK_API_URL: str = "https://api.deepseek.com/v1/chat/completions"
|
||||
|
||||
APP_NAME: str = "ИИ-юрист"
|
||||
DEBUG: bool = False
|
||||
SECRET_KEY: str = "your-secret-key-change-in-production"
|
||||
CORS_ORIGINS: list[str] = ["*"]
|
||||
|
||||
@property
|
||||
def database_url(self) -> str:
|
||||
"""Вычисляемый URL подключения"""
|
||||
return f"postgresql://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
case_sensitive = True
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
|
||||
35
backend/src/shared/exceptions.py
Normal file
35
backend/src/shared/exceptions.py
Normal file
@ -0,0 +1,35 @@
|
||||
"""
|
||||
Кастомные исключения приложения
|
||||
"""
|
||||
|
||||
|
||||
class LawyerAIException(Exception):
|
||||
"""Базовое исключение приложения"""
|
||||
pass
|
||||
|
||||
|
||||
class NotFoundError(LawyerAIException):
|
||||
"""Ресурс не найден"""
|
||||
pass
|
||||
|
||||
|
||||
class UnauthorizedError(LawyerAIException):
|
||||
"""Пользователь не авторизован"""
|
||||
pass
|
||||
|
||||
|
||||
class ForbiddenError(LawyerAIException):
|
||||
"""Доступ запрещен"""
|
||||
pass
|
||||
|
||||
|
||||
class ValidationError(LawyerAIException):
|
||||
"""Ошибка валидации данных"""
|
||||
pass
|
||||
|
||||
|
||||
class DatabaseError(LawyerAIException):
|
||||
"""Ошибка базы данных"""
|
||||
pass
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user