fix
Showing
1 changed file
with
7 additions
and
7 deletions
| ... | @@ -42,7 +42,7 @@ function App() { | ... | @@ -42,7 +42,7 @@ function App() { |
| 42 | 42 | ||
| 43 | async function handleSubmit(e){ | 43 | async function handleSubmit(e){ |
| 44 | e.preventDefault(); | 44 | e.preventDefault(); |
| 45 | console.log(chatInput) | 45 | // console.log(chatInput) |
| 46 | const userInput = ['what', 'why', 'when', 'where' , 'which', 'did', 'do', 'how', 'can', 'are', 'who', 'hey']; | 46 | const userInput = ['what', 'why', 'when', 'where' , 'which', 'did', 'do', 'how', 'can', 'are', 'who', 'hey']; |
| 47 | const userInputRegex = new RegExp(`\\b(${userInput.join('|')})\\b`, 'gi'); | 47 | const userInputRegex = new RegExp(`\\b(${userInput.join('|')})\\b`, 'gi'); |
| 48 | const inputMatches = chatInput.match(userInputRegex); | 48 | const inputMatches = chatInput.match(userInputRegex); |
| ... | @@ -51,16 +51,16 @@ function App() { | ... | @@ -51,16 +51,16 @@ function App() { |
| 51 | const userPunctuationRegex = new RegExp(`[${userPunctuation.join('')}]$`); | 51 | const userPunctuationRegex = new RegExp(`[${userPunctuation.join('')}]$`); |
| 52 | const punctuationMatches = chatInput.match(userPunctuationRegex); | 52 | const punctuationMatches = chatInput.match(userPunctuationRegex); |
| 53 | 53 | ||
| 54 | console.log(punctuationMatches) | 54 | // console.log(punctuationMatches) |
| 55 | var userModifiedInput = chatInput | 55 | var userModifiedInput = chatInput |
| 56 | 56 | ||
| 57 | if (!punctuationMatches) { | 57 | if (!punctuationMatches) { |
| 58 | if (!inputMatches) { | 58 | if (!inputMatches) { |
| 59 | userModifiedInput = chatInput + "."; | 59 | userModifiedInput = chatInput + "."; |
| 60 | console.log("not a question!") | 60 | // console.log("not a question!") |
| 61 | } else { | 61 | } else { |
| 62 | userModifiedInput = chatInput + "?"; | 62 | userModifiedInput = chatInput + "?"; |
| 63 | console.log("its a question!") | 63 | // console.log("its a question!") |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| 66 | 66 | ||
| ... | @@ -88,13 +88,13 @@ function App() { | ... | @@ -88,13 +88,13 @@ function App() { |
| 88 | const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi'); | 88 | const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi'); |
| 89 | // console.log(regex) | 89 | // console.log(regex) |
| 90 | const matches = parsedData.match(regex); | 90 | const matches = parsedData.match(regex); |
| 91 | console.log(matches); | 91 | // console.log(matches); |
| 92 | if (!matches) { | 92 | if (!matches) { |
| 93 | 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!") | 94 | // console.log("not programming!") |
| 95 | } else { | 95 | } else { |
| 96 | replaceTags = (parsedData.replace(':',':<code>').replace('<?','<?').replace('?>','?>').replace(/\n/g, '<br>')) | 96 | replaceTags = (parsedData.replace(':',':<code>').replace('<?','<?').replace('?>','?>').replace(/\n/g, '<br>')) |
| 97 | console.log("programming!") | 97 | // console.log("programming!") |
| 98 | } | 98 | } |
| 99 | setChatLog([...chatLogNew, { user: "gpt", message: `${replaceTags}`} ]) | 99 | setChatLog([...chatLogNew, { user: "gpt", message: `${replaceTags}`} ]) |
| 100 | var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; | 100 | var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; | ... | ... |
-
Please register or sign in to post a comment