70a63595 by Ryan

Revert "Merge branch '26905_erro_guide' into 'master'"

This reverts merge request !15
1 parent 7cb2238d
...@@ -71,7 +71,6 @@ function App() { ...@@ -71,7 +71,6 @@ 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 {
75 const response = await fetch(process.env.REACT_APP_SERVER_URL + "/api", { 74 const response = await fetch(process.env.REACT_APP_SERVER_URL + "/api", {
76 method: "POST", 75 method: "POST",
77 headers: { 76 headers: {
...@@ -87,20 +86,19 @@ function App() { ...@@ -87,20 +86,19 @@ function App() {
87 const programmingKeywords = ['code', 'application', 'controller', 'rails' , 'PHP', 'java', 'javascript', 'script', 'console', 'python', 'programming', 'table']; 86 const programmingKeywords = ['code', 'application', 'controller', 'rails' , 'PHP', 'java', 'javascript', 'script', 'console', 'python', 'programming', 'table'];
88 87
89 const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi'); 88 const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi');
89 // console.log(regex)
90 const matches = parsedData.match(regex); 90 const matches = parsedData.match(regex);
91 // console.log(matches);
91 if (!matches) { 92 if (!matches) {
92 var replaceTags = (parsedData.replace(/(?:\r\n|\r|\n)/g, '<br>').replace(/\./g, '. ')) 93 var replaceTags = (parsedData.replace(/(?:\r\n|\r|\n)/g, '<br>').replace(/\./g, '. '))
94 // console.log("not programming!")
93 } else { 95 } else {
94 replaceTags = (parsedData.replace(':',':<code>').replace('<?','&#60;?').replace('?>','?&#62;').replace(/\n/g, '<br>')) 96 replaceTags = (parsedData.replace(':',':<code>').replace('<?','&#60;?').replace('?>','?&#62;').replace(/\n/g, '<br>'))
97 // console.log("programming!")
95 } 98 }
96 setChatLog([...chatLogNew, { user: "gpt", message: `${replaceTags}`} ]) 99 setChatLog([...chatLogNew, { user: "gpt", message: `${replaceTags}`} ])
97
98 var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; 100 var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0];
99 scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight; 101 scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight;
100 } catch (error) {
101 const errorMsg = "We apologize for any inconvenience caused due to the delay in the response time. Please try again.";
102 setChatLog([...chatLogNew, { user: "gpt", message: `<div class="errormsg"><span>i</span><div class="msg">${errorMsg}</div></div>`} ])
103 }
104 } 102 }
105 103
106 function handleTemp(temp) { 104 function handleTemp(temp) {
......
...@@ -2,32 +2,6 @@ ...@@ -2,32 +2,6 @@
2 background-color: #101827 !important; 2 background-color: #101827 !important;
3 } 3 }
4 4
5 .errormsg {
6 border: 1px solid #7ac5ff;
7 padding: 15px 25px;
8 border-radius: 10px;
9 background: rgb(0 139 245 / 6%);
10 }
11
12 .errormsg .msg {
13 display: inline-block;
14 width: 90%;
15 }
16 .errormsg span {
17 background: #008BF5;
18 padding: 1px 11px;
19 border-radius: 50px;
20 width: 25px;
21 height: 25px;
22 margin-right: 10px;
23 color: #fff;
24 font-weight: 900;
25 display: inline-block;
26 vertical-align: top;
27 font-family: auto;
28 font-size: 15px;
29 }
30
31 .side-menu-button { 5 .side-menu-button {
32 border:0 solid white; 6 border:0 solid white;
33 /* 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 */ 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 */
...@@ -198,16 +172,9 @@ code br:nth-child(-n+2) { ...@@ -198,16 +172,9 @@ code br:nth-child(-n+2) {
198 } 172 }
199 173
200 @media (max-width: 414px) { 174 @media (max-width: 414px) {
201 .errormsg .msg {
202 width: 80%;
203 }
204 .message { 175 .message {
205 font-size: 14px; 176 font-size: 14px;
206 } 177 }
207 .errormsg {
208 padding: 10px;
209 width: 100%;
210 }
211 .chat-message-center { 178 .chat-message-center {
212 padding: 20px 5vw !important; 179 padding: 20px 5vw !important;
213 } 180 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!