53 lines
1.2 KiB
Markdown
53 lines
1.2 KiB
Markdown
# AI Internal Search Backend
|
|
|
|
This is the backend for the AI Internal Search project. It provides an API to interact with Mistral AI for generating responses based on department-specific documents stored in a MongoDB database.
|
|
|
|
## Features
|
|
- Fetches relevant documents from MongoDB based on the department.
|
|
- Uses Mistral AI to generate responses based on the provided context and user query.
|
|
- Provides a REST API for communication with the frontend.
|
|
|
|
## Prerequisites
|
|
- Node.js (v16 or later)
|
|
- MongoDB database
|
|
- Mistral AI API Key
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone <repository-url>
|
|
cd AI-Internal-Search
|
|
```
|
|
|
|
2. Install dependencies:
|
|
```bash
|
|
npm i
|
|
```
|
|
3. Create a .env file in the root directory and configure the following variables:
|
|
```bash
|
|
PORT=3002
|
|
MONGO_URI=<your-mongodb-connection-string>
|
|
MISTRAL_API_KEY=<your-mistral-api-key>
|
|
```
|
|
4. Start the server:
|
|
``` bash
|
|
npm start
|
|
```
|
|
|
|
### Endpoints
|
|
```bash
|
|
http://localhost:3002/api/chat
|
|
```
|
|
|
|
1. URL: /api/chat
|
|
2. Method: POST
|
|
3. Description: Sends a query to the AI assistant and retrieves a response based on department-specific documents.
|
|
|
|
4. Request body:
|
|
```bash
|
|
{
|
|
"department": "string",
|
|
"message": "string"
|
|
}
|
|
``` |