Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Administrator
/
chatgpt.ai-pro.org
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
3
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
762b3086
authored
2023-02-14 18:46:49 +0800
by
RSA
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix
1 parent
b57d268f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
1 deletions
client/src/App.css
index.js
package.json
client/src/App.css
View file @
762b308
...
...
@@ -208,4 +208,31 @@
}
.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
...
...
index.js
View file @
762b308
...
...
@@ -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
...
...
package.json
View file @
762b308
...
...
@@ -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"
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment