762b3086 by RSA

fix

1 parent b57d268f
......@@ -209,3 +209,30 @@
.submit:hover {
background:#066d55;
}
.message .error_msg {
background: rgb(18 0 255 / 20%);
padding: 10px;
border-radius: 5px;
display: flex;
}
.message .error_msg span {
background: #0023ff;
width: 25px;
height: 25px;
display: inline-block;
text-align: center;
padding-top: 1px;
border-radius: 50px;
font-family: auto;
font-weight: 600;
vertical-align: top;
}
.message .error_msg .msg {
display: inline-block;
margin: 0 10px;
font-style: italic;
width: 80%;
}
\ No newline at end of file
......
......@@ -3,6 +3,7 @@ const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
require('dotenv').config()
const rateLimit = require('express-rate-limit')
// Open AI Configuration
// console.log(process.env.OPENAI_API_ORG)
......@@ -12,6 +13,12 @@ const configuration = new Configuration({
});
const openai = new OpenAIApi(configuration);
const rateLimiter = rateLimit({
windowMs: 1000 * 60 * 2, // 1 minute (refreshTime)
max: 10, // limit each IP to x requests per windowMs (refreshTime)
message: 'Sorry, too many requests. Please try again in a bit!',
});
// Express Configuration
const app = express()
const port = 3080
......@@ -19,7 +26,7 @@ const port = 3080
app.use(bodyParser.json())
app.use(cors())
app.use(require('morgan')('dev'))
app.use(rateLimiter)
// Routing
......
......@@ -13,6 +13,7 @@
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-rate-limit": "^6.7.0",
"morgan": "^1.10.0",
"openai": "^3.1.0"
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!