Merge branch '26797_chatgpt_format3' into '1DEVT'
26797_chatgpt_format3 See merge request !19
Showing
1 changed file
with
3 additions
and
3 deletions
| ... | @@ -42,13 +42,13 @@ function App() { | ... | @@ -42,13 +42,13 @@ 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); |
| 49 | 49 | ||
| 50 | const userPunctuation = ['.', '?', '!', ':', ';', ',']; | 50 | const userPunctuation = ['\.', '?', '!', ':', ';', ',']; |
| 51 | const userPunctuationRegex = new RegExp(`${userPunctuation.join('')}$`, 'gi'); | 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) | ... | ... |
-
Please register or sign in to post a comment