Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches: ["main", "master", "copilot/**"]
pull_request:
branches: ["main", "master"]

# Restrict default GITHUB_TOKEN permissions to read-only
permissions:
contents: read

jobs:
lint-and-test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Lint with flake8
run: |
pip install flake8
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Treat all other issues as warnings (non-blocking)
flake8 . --count --exit-zero --max-line-length=100 --statistics

- name: Run tests
run: pytest test_chatbot.py -v

docker-build:
runs-on: ubuntu-latest
needs: lint-and-test
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Build Docker image (web mode)
run: docker build --build-arg MODE=web -t ai-chatbot:web .

- name: Build Docker image (api mode)
run: docker build --build-arg MODE=api -t ai-chatbot:api .
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Python cache
__pycache__/
*.py[cod]

# Virtual environment
venv/
.venv/

# Jupyter/IPython
.ipynb_checkpoints/

# System files
.DS_Store
Thumbs.db

# IDE settings
.vscode/
.idea/

# Environment / secrets
.env

# Pytest cache
.pytest_cache/

# Temporary / generated files
converted_dialog.csv
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM python:3.12-slim

# Build arguments to select the runtime mode:
# web → run the Streamlit web demo (default)
# api → run the FastAPI REST backend
ARG MODE=web

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy source
COPY . .

# Expose ports
# 8501 → Streamlit
# 8000 → FastAPI / uvicorn
EXPOSE 8501 8000

ENV MODE=${MODE}

CMD ["sh", "-c", "\
if [ \"$MODE\" = 'api' ]; then \
uvicorn api:app --host 0.0.0.0 --port 8000; \
else \
streamlit run web_demo.py --server.port 8501 --server.address 0.0.0.0; \
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The streamlit run command in the Dockerfile does not pass --server.headless true. Without this flag, Streamlit may try to open a browser window or attempt to connect to external services (e.g., for telemetry/usage reporting) on startup inside the container, which can cause unnecessary delays or errors in headless environments. The flag --server.headless true should be added to the run command.

Suggested change
streamlit run web_demo.py --server.port 8501 --server.address 0.0.0.0; \
streamlit run web_demo.py --server.headless true --server.port 8501 --server.address 0.0.0.0; \

Copilot uses AI. Check for mistakes.
fi"]
Loading
Loading