f9fcdbe6 by Jonille Arreglo

update

1 parent 931a4681
......@@ -4,6 +4,7 @@ const bodyParser = require('body-parser')
const cors = require('cors')
require('dotenv').config()
const rateLimit = require('express-rate-limit')
const anchorme = require("anchorme").default;
// Open AI Configuration
// console.log(process.env.OPENAI_API_ORG)
......@@ -63,8 +64,17 @@ app.post('/api', async (req, res) => {
max_tokens: 3000,
temperature,
});
let input = response.data.choices[0].text;
res.json({
message: response.data.choices[0].text,
input: input,
message: anchorme({
input,
options: {
attributes: {
target: "_blank"
},
}
})
})
} catch (e) {
let error_msg = e.response.data.error.message ? e.response.data.error.message : '';
......
......@@ -9,6 +9,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"anchorme": "^2.1.2",
"body-parser": "^1.20.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!