Merge branch '27034_spacing' into '1DEVT'
27034 spacing See merge request !48
Showing
2 changed files
with
12 additions
and
1 deletions
| ... | @@ -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) |
| ... | @@ -65,8 +66,17 @@ app.post('/api', async (req, res) => { | ... | @@ -65,8 +66,17 @@ app.post('/api', async (req, res) => { |
| 65 | max_tokens: 3000, | 66 | max_tokens: 3000, |
| 66 | temperature, | 67 | temperature, |
| 67 | }); | 68 | }); |
| 69 | let input = response.data.choices[0].text; | ||
| 68 | res.json({ | 70 | res.json({ |
| 69 | message: response.data.choices[0].text, | 71 | input: input, |
| 72 | message: anchorme({ | ||
| 73 | input, | ||
| 74 | options: { | ||
| 75 | attributes: { | ||
| 76 | target: "_blank" | ||
| 77 | }, | ||
| 78 | } | ||
| 79 | }) | ||
| 70 | }) | 80 | }) |
| 71 | } catch (e) { | 81 | } catch (e) { |
| 72 | let error_msg = e.response.data.error.message ? e.response.data.error.message : ''; | 82 | 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", | ... | ... |
-
Please register or sign in to post a comment