Skip to content

Commit b81df3f

Browse files
chore: refactor configuration (#185)
* refactor configurations * more refactoring
1 parent e7f6c8d commit b81df3f

File tree

12 files changed

+49
-78
lines changed

12 files changed

+49
-78
lines changed

.github/workflows/evaluate-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Evaluate
1+
name: Evaluate Backend
22

33
on:
44
push:

.github/workflows/relase-backend.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Release Backend
22

33
on:
4-
push:
5-
branches:
6-
- master
74
release:
85
types: [published]
96

.github/workflows/relase-frontend.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Release Frontend
22

33
on:
4-
push:
5-
branches:
6-
- master
74
release:
85
types: [published]
96

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
FROM python:3.12.7-slim
1+
FROM python:3.12-bullseye
22

33
WORKDIR /usr/src/app
44

5-
# Install system dependencies
6-
RUN apt-get update && apt-get install -y \
7-
build-essential \
8-
python3-dev \
9-
&& rm -rf /var/lib/apt/lists/*
5+
RUN pip install --upgrade pip
106

11-
# Copy requirements first to leverage Docker cache
127
COPY requirements.txt .
8+
139
RUN pip install --no-cache-dir -r requirements.txt
1410

15-
# Copy the rest of the application
1611
COPY . .
1712

1813
EXPOSE 80

app/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
]
1212

1313
client = AsyncIOMotorClient(app_config.MONGODB_HOST)
14-
database = client.get_database("iky-ai")
14+
database = client.get_database(app_config.MONGODB_DATABASE)

config.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
class BaseConfig(BaseModel):
99
DEBUG: bool = False
1010
Development: bool = False
11-
MONGODB_HOST: str = "mongodb://127.0.0.1:27017/iky-ai"
1211

13-
# Intent Classifier model details
12+
MONGODB_HOST: str = "mongodb://127.0.0.1:27017"
13+
MONGODB_DATABASE: str = "ai-chatbot-framework"
14+
1415
MODELS_DIR: str = "model_files/"
15-
INTENT_MODEL_NAME: str = "intent.model"
1616
DEFAULT_FALLBACK_INTENT_NAME: str = "fallback"
1717
DEFAULT_WELCOME_INTENT_NAME: str = "init_conversation"
18-
USE_WORD_VECTORS: bool = True
1918
SPACY_LANG_MODEL: str = "en_core_web_md"
2019

2120

@@ -31,8 +30,7 @@ class TestingConfig(BaseConfig):
3130

3231

3332
class ProductionConfig(BaseConfig):
34-
# MongoDB Database Details
35-
MONGODB_HOST: str = "mongodb://mongodb:27017/iky-ai"
33+
SPACY_LANG_MODEL: str = "en_core_web_lg"
3634

3735

3836
config = {

docker-compose.dev.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
version: '2'
2+
name: ai-chatbot-framework-dev
23
services:
34
mongodb:
45
container_name: mongodb
56
image: mongo:4.2.20
67
hostname: mongodb
7-
ports:
8-
- "27017:27017"
98
volumes:
109
- mongodbdata:/data
1110

@@ -17,7 +16,7 @@ services:
1716
command: python manage.py migrate
1817
environment:
1918
APPLICATION_ENV: Development
20-
APP_MONGODB_HOST: "mongodb://mongodb:27017/iky-ai"
19+
MONGODB_HOST: mongodb://mongodb:27017
2120
depends_on:
2221
- mongodb
2322

@@ -29,7 +28,7 @@ services:
2928
command: fastapi run --host=0.0.0.0 --reload --port=8080
3029
environment:
3130
APPLICATION_ENV: Development
32-
APP_MONGODB_HOST: "mongodb://mongodb:27017/iky-ai"
31+
MONGODB_HOST: mongodb://mongodb:27017
3332
ports:
3433
- 8080:8080
3534
volumes:
@@ -43,8 +42,7 @@ services:
4342
hostname: frontend
4443
build:
4544
context: ./frontend
46-
dockerfile: dev.Dockerfile
47-
45+
dockerfile: ./dev.Dockerfile
4846
volumes:
4947
- ./frontend/app:/app/app
5048
- ./frontend/public:/app/public

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
version: '2'
2+
name: ai-chatbot-framework
23
services:
34
migrate:
45
container_name: migrate
56
image: alfredfrancis/ai-chatbot-framework_backend:latest
67
command: python manage.py migrate
78
environment:
9+
MONGODB_HOST: mongodb://mongodb:27017
810
APPLICATION_ENV: Production
911
depends_on:
1012
- mongodb
@@ -25,6 +27,7 @@ services:
2527
hostname: backend
2628
restart: always
2729
environment:
30+
MONGODB_HOST: mongodb://mongodb:27017
2831
APPLICATION_ENV: Production
2932
ports:
3033
- "8080:80"

frontend/dev.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN \
1616

1717
COPY app ./app
1818
COPY public ./public
19-
COPY next.config.js .
19+
COPY next.config.ts .
2020
COPY tsconfig.json .
2121

2222
# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry

0 commit comments

Comments
 (0)