f9fcdbe6 by Jonille Arreglo

update

1 parent 931a4681
...@@ -4,6 +4,7 @@ const bodyParser = require('body-parser') ...@@ -4,6 +4,7 @@ const bodyParser = require('body-parser')
4 const cors = require('cors') 4 const cors = require('cors')
5 require('dotenv').config() 5 require('dotenv').config()
6 const rateLimit = require('express-rate-limit') 6 const rateLimit = require('express-rate-limit')
7 const anchorme = require("anchorme").default;
7 8
8 // Open AI Configuration 9 // Open AI Configuration
9 // console.log(process.env.OPENAI_API_ORG) 10 // console.log(process.env.OPENAI_API_ORG)
...@@ -63,8 +64,17 @@ app.post('/api', async (req, res) => { ...@@ -63,8 +64,17 @@ app.post('/api', async (req, res) => {
63 max_tokens: 3000, 64 max_tokens: 3000,
64 temperature, 65 temperature,
65 }); 66 });
67 let input = response.data.choices[0].text;
66 res.json({ 68 res.json({
67 message: response.data.choices[0].text, 69 input: input,
70 message: anchorme({
71 input,
72 options: {
73 attributes: {
74 target: "_blank"
75 },
76 }
77 })
68 }) 78 })
69 } catch (e) { 79 } catch (e) {
70 let error_msg = e.response.data.error.message ? e.response.data.error.message : ''; 80 let error_msg = e.response.data.error.message ? e.response.data.error.message : '';
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
9 "author": "", 9 "author": "",
10 "license": "ISC", 10 "license": "ISC",
11 "dependencies": { 11 "dependencies": {
12 "anchorme": "^2.1.2",
12 "body-parser": "^1.20.1", 13 "body-parser": "^1.20.1",
13 "cors": "^2.8.5", 14 "cors": "^2.8.5",
14 "dotenv": "^16.0.3", 15 "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!