WIP
Showing
6 changed files
with
21 additions
and
8 deletions
| ... | @@ -10,12 +10,15 @@ Create an .env file in the root directory of your application. | ... | @@ -10,12 +10,15 @@ Create an .env file in the root directory of your application. |
| 10 | Duplicate the env-template and rename to .env | 10 | Duplicate the env-template and rename to .env |
| 11 | In the .env file, define the environment variables you want to use in your application. ex. | 11 | In the .env file, define the environment variables you want to use in your application. ex. |
| 12 | 12 | ||
| 13 | API_KEY="sk-xxxxxxxx" | 13 | `API_KEY="sk-xxxxxxxx"` |
| 14 | API_ORG="org-xxxxxxx" | 14 | `API_ORG="org-xxxxxxx"` |
| 15 | SERVER_URL="http://localhost:3080/" | ||
| 16 | 15 | ||
| 17 | ## Run server | 16 | ## Run server |
| 18 | 17 | ||
| 19 | Run server on the root directory | 18 | Run server on the root directory |
| 20 | 19 | ||
| 21 | `node index.js` | 20 | `node index.js` |
| 21 | |||
| 22 | ### Additional Configuration | ||
| 23 | |||
| 24 | After running server, proceed to /client README.md for instructions | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -6,6 +6,15 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo | ... | @@ -6,6 +6,15 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo |
| 6 | 6 | ||
| 7 | npm install on the /client directory. | 7 | npm install on the /client directory. |
| 8 | 8 | ||
| 9 | |||
| 10 | ## Create ENV Variables | ||
| 11 | |||
| 12 | Create an .env file in the /client directory of your application. | ||
| 13 | Duplicate the env-template and rename to .env | ||
| 14 | In the .env file, define the environment variables you want to use in your application. ex. | ||
| 15 | |||
| 16 | REACT_APP_SERVER_URL=http://xxxxxx/ | ||
| 17 | |||
| 9 | ## Available Scripts | 18 | ## Available Scripts |
| 10 | 19 | ||
| 11 | In the /client directory, you can run: | 20 | In the /client directory, you can run: | ... | ... |
client/env-template
0 → 100644
| 1 | REACT_APP_SERVER_URL= | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -25,7 +25,7 @@ function App() { | ... | @@ -25,7 +25,7 @@ function App() { |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | function getEngines(){ | 27 | function getEngines(){ |
| 28 | fetch("http://localhost:3080/models") | 28 | fetch(process.env.REACT_APP_SERVER_URL + "/models") |
| 29 | .then(res => res.json()) | 29 | .then(res => res.json()) |
| 30 | .then(data => { | 30 | .then(data => { |
| 31 | // console.log(data.models.data) | 31 | // console.log(data.models.data) |
| ... | @@ -47,7 +47,7 @@ function App() { | ... | @@ -47,7 +47,7 @@ function App() { |
| 47 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post | 47 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post |
| 48 | const messages = chatLogNew.map((message) => message.message).join("\n") | 48 | const messages = chatLogNew.map((message) => message.message).join("\n") |
| 49 | 49 | ||
| 50 | const response = await fetch("http://localhost:3080/api", { | 50 | const response = await fetch(process.env.REACT_APP_SERVER_URL + "/api", { |
| 51 | method: "POST", | 51 | method: "POST", |
| 52 | headers: { | 52 | headers: { |
| 53 | "Content-Type": "application/json" | 53 | "Content-Type": "application/json" | ... | ... |
-
Please register or sign in to post a comment