fix
Showing
2 changed files
with
13 additions
and
0 deletions
| ... | @@ -71,6 +71,7 @@ function App() { | ... | @@ -71,6 +71,7 @@ function App() { |
| 71 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post | 71 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post |
| 72 | const messages = chatLogNew.map((message) => message.message).join("\n") | 72 | const messages = chatLogNew.map((message) => message.message).join("\n") |
| 73 | 73 | ||
| 74 | try { | ||
| 74 | const response = await fetch(process.env.REACT_APP_SERVER_URL + "/api", { | 75 | const response = await fetch(process.env.REACT_APP_SERVER_URL + "/api", { |
| 75 | method: "POST", | 76 | method: "POST", |
| 76 | headers: { | 77 | headers: { |
| ... | @@ -103,6 +104,11 @@ function App() { | ... | @@ -103,6 +104,11 @@ function App() { |
| 103 | // setChatLog([...chatLogNew, { user: "gpt", message: `<div>${parsedData}</div>`} ]) | 104 | // setChatLog([...chatLogNew, { user: "gpt", message: `<div>${parsedData}</div>`} ]) |
| 104 | var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; | 105 | var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; |
| 105 | scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight; | 106 | scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight; |
| 107 | } catch (error) { | ||
| 108 | const errorMsg = "We are currently experiencing heavy flow as of the moment, please try again."; | ||
| 109 | setChatLog([...chatLogNew, { user: "gpt", message: `<div class="errormsg">${errorMsg}</div>`} ]) | ||
| 110 | // res.status(500).send(error || 'Something went wrong'); | ||
| 111 | } | ||
| 106 | } | 112 | } |
| 107 | 113 | ||
| 108 | function handleTemp(temp) { | 114 | function handleTemp(temp) { | ... | ... |
| ... | @@ -2,6 +2,13 @@ | ... | @@ -2,6 +2,13 @@ |
| 2 | background-color: #101827 !important; | 2 | background-color: #101827 !important; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | .errormsg { | ||
| 6 | border: 1px solid red; | ||
| 7 | padding: 15px 25px; | ||
| 8 | border-radius: 10px; | ||
| 9 | background: rgb(255 0 0 / 15%); | ||
| 10 | } | ||
| 11 | |||
| 5 | .side-menu-button { | 12 | .side-menu-button { |
| 6 | border:0 solid white; | 13 | border:0 solid white; |
| 7 | /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#cedbe9+0,aac5de+17,6199c7+50,3a84c3+51,419ad6+59,4bb8f0+71,3a8bc2+84,26558b+100;Blue+Gloss */ | 14 | /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#cedbe9+0,aac5de+17,6199c7+50,3a84c3+51,419ad6+59,4bb8f0+71,3a8bc2+84,26558b+100;Blue+Gloss */ | ... | ... |
-
Please register or sign in to post a comment