File size: 1,538 Bytes
50553ea
 
 
 
9150f8e
50553ea
 
 
 
 
 
 
 
 
 
3ec35ef
50553ea
9150f8e
2f1af0f
50553ea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import pathlib
from functools import lru_cache

import faiss
import motor.motor_asyncio
from dotenv import load_dotenv
from openai import AsyncClient

load_dotenv()

class BaseConfig:
    BASE_DIR: pathlib.Path = pathlib.Path(__file__).parent.parent.parent
    STATIC_DIR = "static"
    SECRET_KEY = os.getenv('SECRET')
    DB_CLIENT = motor.motor_asyncio.AsyncIOMotorClient(os.getenv("MONGO_DB_URL")).AtlasCluster
    OPENAI_CLIENT = AsyncClient(api_key=os.getenv('OPENAI_API_KEY'))
    SEMANTIC_INDEX = faiss.read_index(str(pathlib.Path(__file__).parent.parent.parent / 'indexes' / 'entities.index'))
    INTRO_MESSAGE = """Hoi! Wat fijn dat je hier bent. Ik ben je assistent en help je graag met het vinden van de juiste zorg of behandeling. Of het nu gaat om EMDR, de slapende honden-methode, of zorg voor een specifieke situatie, ik heb alle kennis in huis om je verder te helpen. Je kunt me alles vragen over behandelingen, doelgroepen en locaties. Hoe kan ik je vandaag helpen?"""

class DevelopmentConfig(BaseConfig):
    Issuer = "http://localhost:8000"
    Audience = "http://localhost:3000"


class ProductionConfig(BaseConfig):
    Issuer = ""
    Audience = ""


@lru_cache()
def get_settings() -> DevelopmentConfig | ProductionConfig:
    config_cls_dict = {
        'development': DevelopmentConfig,
        'production': ProductionConfig,
    }
    config_name = os.getenv('FASTAPI_CONFIG', default='development')
    config_cls = config_cls_dict[config_name]
    return config_cls()


settings = get_settings()