-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (27 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require('dotenv').config();
const express = require('express');
const makersAPI = require('./makers-api');
const vectorDbApi = require('./vector-db-api');
const graphqlAssistantAgent = require('./graphql-assistant-agent');
const app = express();
app.use(express.json());
const port = process.env.PORT;
app.post('/generate_description', async (req, res) => {
const result = await graphqlAssistantAgent.generateDescription();
res.status(200).json(result);
});
app.post('/fill_index_with_vectors', async (req, res) => {
const result = await graphqlAssistantAgent.fillIndexWithVectors()
res.status(200).json(result);
});
app.get('/search', async (req, res) => {
const result = await graphqlAssistantAgent.getGraphQLQuery(req.body.text , true)
res.status(200).json(result);
});
app.get('/search_no_data', async (req, res) => {
const result = await graphqlAssistantAgent.getGraphQLQuery(req.body.text , false)
res.status(200).json(result);
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
});