feat: improve docker containerization and add LLM timeout
This commit is contained in:
@@ -10,7 +10,11 @@ services:
|
||||
volumes:
|
||||
- data:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-messages}"]
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
"pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-messages}",
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
@@ -33,7 +37,7 @@ services:
|
||||
- .env
|
||||
environment:
|
||||
- LLM_MODEL=${LLM_MODEL:-deepseek}
|
||||
- POSTGRES_HOST=messages_db
|
||||
- POSTGRES_HOST=${POSTGRES_HOST:-db}
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-messages}
|
||||
|
||||
@@ -47,6 +47,7 @@ class LLMFactory:
|
||||
model=model_name,
|
||||
temperature=1,
|
||||
max_retries=3,
|
||||
timeout=30
|
||||
)
|
||||
|
||||
return model
|
||||
|
||||
@@ -6,7 +6,7 @@ class Settings:
|
||||
DB_NAME = os.getenv("POSTGRES_DB", "messages")
|
||||
DB_USER = os.getenv("POSTGRES_USER", "postgres")
|
||||
DB_PASSWORD = os.getenv("POSTGRES_PASSWORD", "postgres")
|
||||
DB_HOST = os.getenv("POSTGRES_HOST", "localhost")
|
||||
DB_HOST = os.getenv("POSTGRES_HOST", "db")
|
||||
|
||||
def __init__(self):
|
||||
load_dotenv()
|
||||
|
||||
@@ -44,6 +44,7 @@ app = FastAPI(
|
||||
"API for NaliiaBot, a chatbot that provides "
|
||||
"customer service and related topics."),
|
||||
version="1.0.0",
|
||||
root_path="/agent/api",
|
||||
lifespan=lifespan
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user