|
1 | | -# chatbot |
| 1 | +# Chatbot |
| 2 | + |
| 3 | +Chatbot is a Next.js application that provides a simple API to retrieve provider information (model name, picture path, and provider description) loaded directly from environment variables. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **API Endpoint** |
| 8 | + The API is accessible via `/api` and returns a JSON with the following information: |
| 9 | + - `provider_name`: The model name. |
| 10 | + - `picture_path`: The path to the image. |
| 11 | + - `provider_description`: The description of the provider. |
| 12 | + |
| 13 | +- **Docker Deployment with GitHub Actions** |
| 14 | + The repository includes a GitHub Actions workflow (`.github/workflows/deploy.yaml`) for automatically deploying the application on a self-hosted server. The deployment script updates the code, rebuilds the Docker image, and restarts the container. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +- Node.js |
| 19 | +- pnpm |
| 20 | +- Next.js |
| 21 | +- Docker and Docker Compose (for deployment) |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +1. Clone the repository: |
| 26 | + |
| 27 | + ```bash |
| 28 | + git clone https://your-repository-url.git |
| 29 | + cd qubic-madrid/openaichat |
| 30 | + ``` |
| 31 | + |
| 32 | +2. Install dependencies using pnpm: |
| 33 | + |
| 34 | + ```bash |
| 35 | + pnpm install |
| 36 | + ``` |
| 37 | + |
| 38 | +3. Create a `.env` file in the root directory and configure the environment variables: |
| 39 | + |
| 40 | + ```env |
| 41 | + PROVIDER_NAME=YourModelName |
| 42 | + PICTURE_PATH=/path/to/your/image.png |
| 43 | + PROVIDER_DESCRIPTION=Your provider description |
| 44 | + ``` |
| 45 | + |
| 46 | +## Running in Development |
| 47 | + |
| 48 | +To start the development server, run: |
| 49 | + |
| 50 | +```bash |
| 51 | +pnpm dev |
| 52 | +``` |
| 53 | + |
| 54 | +The API will be accessible at [http://localhost:3000/api](http://localhost:3000/api). |
| 55 | + |
| 56 | +## Deployment |
| 57 | + |
| 58 | +The deployment is managed via GitHub Actions. The workflow in `.github/workflows/deploy.yaml`: |
| 59 | + |
| 60 | +- Triggers on every push to the `main` branch. |
| 61 | +- Connects to a self-hosted server. |
| 62 | +- Executes a script to update the code, rebuild the Docker image, and restart the container. |
| 63 | + |
| 64 | +Ensure the server has the necessary permissions to execute `docker-compose` commands. |
| 65 | + |
| 66 | +## Project Structure |
| 67 | + |
| 68 | +- `app/`: Contains the Next.js application code. |
| 69 | + - `api/route.ts`: GET API endpoint that returns information from environment variables. |
| 70 | +- `.github/workflows/deploy.yaml`: GitHub Actions workflow for deployment. |
| 71 | +- `README.md`: This file. |
| 72 | + |
| 73 | + |
0 commit comments