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
6f703e28
authored
2023-02-03 16:22:11 +0800
by
RSA
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
WIP
2 parents
39ddb93b
8b0ccf90
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
8 deletions
.gitignore
README.md
client/README.md
client/env-template
client/src/App.js
env-template
.gitignore
View file @
6f703e2
node_modules
\ No newline at end of file
node_modules
.env
\ No newline at end of file
...
...
README.md
View file @
6f703e2
...
...
@@ -10,12 +10,15 @@ Create an .env file in the root directory of your application.
Duplicate the env-template and rename to .env
In the .env file, define the environment variables you want to use in your application. ex.
API_KEY="sk-xxxxxxxx"
API_ORG="org-xxxxxxx"
SERVER_URL="http://localhost:3080/"
`API_KEY="sk-xxxxxxxx"`
`API_ORG="org-xxxxxxx"`
## Run server
Run server on the root directory
`node index.js`
### Additional Configuration
After running server, proceed to /client README.md for instructions
\ No newline at end of file
...
...
client/README.md
View file @
6f703e2
...
...
@@ -6,6 +6,15 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
npm install on the /client directory.
## Create ENV Variables
Create an .env file in the /client directory of your application.
Duplicate the env-template and rename to .env
In the .env file, define the environment variables you want to use in your application. ex.
REACT_APP_SERVER_URL=http://xxxxxx/
## Available Scripts
In the /client directory, you can run:
...
...
client/env-template
0 → 100644
View file @
6f703e2
REACT_APP_SERVER_URL=
\ No newline at end of file
client/src/App.js
View file @
6f703e2
...
...
@@ -25,7 +25,7 @@ function App() {
}
function
getEngines
(){
fetch
(
"http://localhost:3080
/models"
)
fetch
(
process
.
env
.
REACT_APP_SERVER_URL
+
"
/models"
)
.
then
(
res
=>
res
.
json
())
.
then
(
data
=>
{
// console.log(data.models.data)
...
...
@@ -47,7 +47,7 @@ function App() {
// fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post
const
messages
=
chatLogNew
.
map
((
message
)
=>
message
.
message
).
join
(
"\n"
)
const
response
=
await
fetch
(
"http://localhost:3080
/api"
,
{
const
response
=
await
fetch
(
process
.
env
.
REACT_APP_SERVER_URL
+
"
/api"
,
{
method
:
"POST"
,
headers
:
{
"Content-Type"
:
"application/json"
...
...
env-template
View file @
6f703e2
OPENAI_API_ORG=
OPENAI_API_KEY=
SERVER_URL=
\ No newline at end of file
OPENAI_API_KEY=
\ No newline at end of file
...
...
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