This repository contains the source code for the AgileGPt project, which serves as the backend side for the application.
The API provides the following features:
- Get data: Get history of user messages and AI responses.
- Real-time data transferring: Allow to send and get data in real-time.
To get started with the API, follow these steps:
- Clone the repository:
https://github.com/<your-username>/ai_coach_backend.git
- Install dependencies:
npm install
- Set up PostgreSQL Database:
- Open the
src/config/database.config.ts
file and add your PostgreSQL database configuration.
export const db = {
DB_HOST: 'host',
DB_NAME: 'name',
DB_USERNAME: 'username',
DB_PASSWORD: 'password',
};
- Run migration:
npm run migrate
- Set openAI secret key:
- Open the
src/config/api-key.config.ts
file and add your secret key. - Add environment variable
API_KEY
with your key.
- Start the server:
npm run start
The base URL for the API is: https://aicoachbackend-production.up.railway.app
HTTP | |||
---|---|---|---|
Method | Endpoint | Description | Body |
GET | /messages | Get all messages. | NULL |
Web Socket | ||
---|---|---|
Message | Description | Body |
messageToOpenAI | Send user input to open AI model |
{ role: string; content: string; } |
responseFromOpenAI | Get response from open AI model | null |