klg-asutk-app/backend/app/core/config.py
Yuriy 44b14cc4fd feat: все AI-функции переведены на Anthropic Claude API
- ai_service.py: единый AI-сервис (chat, chat_with_history, analyze_document)
- routes/ai.py: POST /api/v1/ai/chat (chat, summarize, extract_risks, classify, translate)
- config.py: ANTHROPIC_API_KEY, ANTHROPIC_MODEL
- requirements.txt: anthropic>=0.42.0
- api-client.ts: aiApi (chat, summarize, extractRisks)
- CSP: connect-src добавлен https://api.anthropic.com
- app/api/ai-chat: прокси на бэкенд /api/v1/ai/chat (Anthropic)
- legal_agents/llm_client.py: переведён на ai_service (Claude)
- AIAccessSettings: только Claude (Sonnet 4, 3 Sonnet, 3 Opus)
- k8s, .env.example: OPENAI → ANTHROPIC
- package.json: удалена зависимость openai
- Документация: OpenAI/GPT заменены на Claude/Anthropic

Провайдер: исключительно Anthropic Claude
Модель по умолчанию: claude-sonnet-4-20250514

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-15 15:51:59 +03:00

85 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
Конфигурация приложения КЛГ АСУ ТК.
12-factor: все настройки через ENV.
Разработчик: АО «REFLY»
"""
from pydantic_settings import BaseSettings
from typing import List
class Settings(BaseSettings):
"""Настройки приложения"""
# API
API_V1_PREFIX: str = "/api/v1"
CORS_ORIGINS: List[str] = ["http://localhost:3000", "http://localhost:8000", "http://localhost:8080"]
# Database
DATABASE_URL: str = "postgresql://klg:klg@localhost:5432/klg"
# Redis
REDIS_URL: str = "redis://localhost:6379"
# MinIO (S3-compatible storage)
MINIO_ENDPOINT: str = "localhost:9000"
MINIO_ACCESS_KEY: str = "minioadmin"
MINIO_SECRET_KEY: str = "minioadmin"
MINIO_BUCKET: str = "klg-attachments"
MINIO_SECURE: bool = False
# Auth
OIDC_ISSUER: str = "http://localhost:8180/realms/klg"
OIDC_JWKS_URL: str = "" # auto-derived from issuer if empty
OIDC_AUDIENCE: str = "account"
ENABLE_DEV_AUTH: bool = False # ONLY for development
DEV_TOKEN: str = "dev"
# JWT (dev mode — HS256 токены)
JWT_SECRET: str = ""
JWT_ALG: str = "HS256"
allow_hs256_dev_tokens: bool = False
# Secret key (подпись, сессии)
SECRET_KEY: str = "change-me-in-production"
# Rate limiting
RATE_LIMIT_PER_MINUTE: int = 60
# Redpanda / RisingWave — optional
ENABLE_RISINGWAVE: bool = False
ENABLE_REDPANDA: bool = False
REDPANDA_BROKERS: str = "localhost:19092"
REDPANDA_CLIENT_ID: str = "klg-backend"
RISINGWAVE_URL: str = "postgresql://root:risingwave@localhost:4566/dev"
# Inbox (COD-004)
INBOX_DATA_DIR: str = "./data"
INBOX_UPLOAD_MAX_MB: int = 50
# Хранилище файлов (attachments, storage.py)
storage_dir: str = "./data/storage"
# П-ИВ интеграция
piv_base_url: str = "http://localhost:9090/piv"
piv_timeout_s: float = 10.0
# Multi-tenancy
ENABLE_RLS: bool = True
# AI (Anthropic Claude)
ANTHROPIC_API_KEY: str = ""
ANTHROPIC_MODEL: str = "claude-sonnet-4-20250514"
@property
def database_url(self) -> str:
url = self.DATABASE_URL
if "asyncpg" in url:
url = url.replace("postgresql+asyncpg://", "postgresql://")
return url
class Config:
env_file = ".env"
case_sensitive = True
extra = "ignore"
settings = Settings()