dc3576bd by Ryan

Merge branch '26797_chatgpt_format3' into '1DEVT'

26797_chatgpt_format3

See merge request !19
2 parents 292766e9 e89e38f9
...@@ -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)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!