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
a6efb66c
authored
2023-02-03 12:59:05 +0800
by
RSA
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
wip
1 parent
b22f9a7b
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
107 additions
and
7 deletions
.env
client/package-lock.json
client/package.json
client/src/App.js
index.js
package-lock.json
package.json
.env
0 → 100644
View file @
a6efb66
OPENAI_API_ORG="org-YgE1xiPAzhVmwwrtZnXIRyiF"
OPENAI_API_KEY="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"
SERVER_URL="http://localhost:3080"
\ No newline at end of file
client/package-lock.json
View file @
a6efb66
...
...
@@ -4863,9 +4863,9 @@
}
},
"dotenv"
:
{
"version"
:
"1
0.0.0
"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-1
0.0.0
.tgz"
,
"integrity"
:
"sha512-
rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03
Q=="
"version"
:
"1
6.0.3
"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-1
6.0.3
.tgz"
,
"integrity"
:
"sha512-
7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItz
Q=="
},
"dotenv-expand"
:
{
"version"
:
"5.1.0"
,
...
...
@@ -5937,6 +5937,11 @@
"resolved"
:
"https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz"
,
"integrity"
:
"sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="
},
"fs"
:
{
"version"
:
"0.0.1-security"
,
"resolved"
:
"https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz"
,
"integrity"
:
"sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
},
"fs-extra"
:
{
"version"
:
"10.1.0"
,
"resolved"
:
"https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz"
,
...
...
@@ -9424,6 +9429,15 @@
}
}
},
"path"
:
{
"version"
:
"0.12.7"
,
"resolved"
:
"https://registry.npmjs.org/path/-/path-0.12.7.tgz"
,
"integrity"
:
"sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q=="
,
"requires"
:
{
"process"
:
"^0.11.1"
,
"util"
:
"^0.10.3"
}
},
"path-exists"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz"
,
...
...
@@ -10289,6 +10303,11 @@
}
}
},
"process"
:
{
"version"
:
"0.11.10"
,
"resolved"
:
"https://registry.npmjs.org/process/-/process-0.11.10.tgz"
,
"integrity"
:
"sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="
},
"process-nextick-args"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz"
,
...
...
@@ -10571,6 +10590,13 @@
"webpack-dev-server"
:
"^4.6.0"
,
"webpack-manifest-plugin"
:
"^4.0.2"
,
"workbox-webpack-plugin"
:
"^6.4.1"
},
"dependencies"
:
{
"dotenv"
:
{
"version"
:
"10.0.0"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz"
,
"integrity"
:
"sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
}
}
},
"read-cache"
:
{
...
...
@@ -11899,6 +11925,21 @@
"requires-port"
:
"^1.0.0"
}
},
"util"
:
{
"version"
:
"0.10.4"
,
"resolved"
:
"https://registry.npmjs.org/util/-/util-0.10.4.tgz"
,
"integrity"
:
"sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A=="
,
"requires"
:
{
"inherits"
:
"2.0.3"
},
"dependencies"
:
{
"inherits"
:
{
"version"
:
"2.0.3"
,
"resolved"
:
"https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
,
"integrity"
:
"sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
}
}
},
"util-deprecate"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
,
...
...
client/package.json
View file @
a6efb66
...
...
@@ -6,6 +6,9 @@
"@testing-library/jest-dom"
:
"^5.16.5"
,
"@testing-library/react"
:
"^13.4.0"
,
"@testing-library/user-event"
:
"^13.5.0"
,
"dotenv"
:
"^16.0.3"
,
"fs"
:
"0.0.1-security"
,
"path"
:
"^0.12.7"
,
"react"
:
"^18.2.0"
,
"react-dom"
:
"^18.2.0"
,
"react-scripts"
:
"5.0.1"
,
...
...
client/src/App.js
View file @
a6efb66
...
...
@@ -10,7 +10,8 @@ function App() {
useEffect
(()
=>
{
getEngines
();
},
[])
const
[
env
,
setEnv
]
=
useState
({});
console
.
log
(
env
.
SERVER_URL
)
const
[
chatInput
,
setChatInput
]
=
useState
(
""
);
const
[
models
,
setModels
]
=
useState
([]);
const
[
temperature
,
setTemperature
]
=
useState
(
0.7
);
...
...
@@ -26,7 +27,9 @@ function App() {
}
function
getEngines
(){
fetch
(
process
.
env
.
SERVER_URL
+
"/models"
)
fetch
(
env
.
SERVER_URL
+
"models"
)
.
then
(
res
=>
res
.
json
())
.
then
(
data
=>
{
console
.
log
(
data
.
models
.
data
)
...
...
index.js
View file @
a6efb66
...
...
@@ -2,8 +2,10 @@ const { Configuration, OpenAIApi } = require("openai");
const
express
=
require
(
'express'
)
const
bodyParser
=
require
(
'body-parser'
)
const
cors
=
require
(
'cors'
)
require
(
'dotenv'
).
config
()
// Open AI Configuration
const
configuration
=
new
Configuration
({
organization
:
process
.
env
.
OPENAI_API_ORG
,
apiKey
:
process
.
env
.
OPENAI_API_KEY
,
...
...
@@ -19,10 +21,16 @@ app.use(cors())
app
.
use
(
require
(
'morgan'
)(
'dev'
))
app
.
get
(
'/env'
,
(
req
,
res
)
=>
{
res
.
send
({
SERVER_URL
:
process
.
env
.
SERVER_URL
,
});
});
// Routing
// Primary Open AI Route
app
.
post
(
'/
api
'
,
async
(
req
,
res
)
=>
{
app
.
post
(
'/'
,
async
(
req
,
res
)
=>
{
const
{
message
,
currentModel
,
temperature
}
=
req
.
body
;
const
response
=
await
openai
.
createCompletion
({
model
:
`
${
currentModel
}
`
,
// "text-davinci-003",
...
...
package-lock.json
View file @
a6efb66
...
...
@@ -142,6 +142,11 @@
"resolved"
:
"https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz"
,
"integrity"
:
"sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
},
"dotenv"
:
{
"version"
:
"16.0.3"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz"
,
"integrity"
:
"sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ=="
},
"ee-first"
:
{
"version"
:
"1.1.1"
,
"resolved"
:
"https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
,
...
...
@@ -239,6 +244,11 @@
"resolved"
:
"https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz"
,
"integrity"
:
"sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="
},
"fs"
:
{
"version"
:
"0.0.1-security"
,
"resolved"
:
"https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz"
,
"integrity"
:
"sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
},
"function-bind"
:
{
"version"
:
"1.1.1"
,
"resolved"
:
"https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
,
...
...
@@ -399,11 +409,25 @@
"resolved"
:
"https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz"
,
"integrity"
:
"sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path"
:
{
"version"
:
"0.12.7"
,
"resolved"
:
"https://registry.npmjs.org/path/-/path-0.12.7.tgz"
,
"integrity"
:
"sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q=="
,
"requires"
:
{
"process"
:
"^0.11.1"
,
"util"
:
"^0.10.3"
}
},
"path-to-regexp"
:
{
"version"
:
"0.1.7"
,
"resolved"
:
"https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz"
,
"integrity"
:
"sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
},
"process"
:
{
"version"
:
"0.11.10"
,
"resolved"
:
"https://registry.npmjs.org/process/-/process-0.11.10.tgz"
,
"integrity"
:
"sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="
},
"proxy-addr"
:
{
"version"
:
"2.0.7"
,
"resolved"
:
"https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz"
,
...
...
@@ -524,6 +548,21 @@
"resolved"
:
"https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz"
,
"integrity"
:
"sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="
},
"util"
:
{
"version"
:
"0.10.4"
,
"resolved"
:
"https://registry.npmjs.org/util/-/util-0.10.4.tgz"
,
"integrity"
:
"sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A=="
,
"requires"
:
{
"inherits"
:
"2.0.3"
},
"dependencies"
:
{
"inherits"
:
{
"version"
:
"2.0.3"
,
"resolved"
:
"https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
,
"integrity"
:
"sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
}
}
},
"utils-merge"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz"
,
...
...
package.json
View file @
a6efb66
...
...
@@ -11,8 +11,11 @@
"dependencies"
:
{
"body-parser"
:
"^1.20.1"
,
"cors"
:
"^2.8.5"
,
"dotenv"
:
"^16.0.3"
,
"express"
:
"^4.18.2"
,
"fs"
:
"0.0.1-security"
,
"morgan"
:
"^1.10.0"
,
"openai"
:
"^3.1.0"
"openai"
:
"^3.1.0"
,
"path"
:
"^0.12.7"
}
}
...
...
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