-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance AI_ChatBot to modern competitive standards #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; \ | ||
| fi"] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
streamlit runcommand 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 trueshould be added to the run command.