fd0c65d6 by RSA

fix conflict

2 parents 3e569df6 044faa07
......@@ -10,8 +10,8 @@ Create an .env file in the root directory of your application.
Duplicate the env-template and rename to .env
In the .env file, define the environment variables you want to use in your application. ex.
`API_KEY="sk-xxxxxxxx"`
`API_ORG="org-xxxxxxx"`
`OPENAI_API_KEY="sk-xxxxxxxx"`
`OPENAI_API_ORG="org-xxxxxxx"`
## Run server
......
......@@ -114,7 +114,7 @@
display:flex;
align-items:center;
justify-content:center;
padding:5px;
padding:15px;
font-size:14px;
color:#444654;
}
......
......@@ -47,8 +47,8 @@ function App() {
const userInputRegex = new RegExp(`\\b(${userInput.join('|')})\\b`, 'gi');
const inputMatches = chatInput.match(userInputRegex);
const userPunctuation = ['.', '?', '!', ':', ';', ','];
const userPunctuationRegex = new RegExp(`${userPunctuation.join('')}$`, 'gi');
const userPunctuation = ['\.', '?', '!', ':', ';', ','];
const userPunctuationRegex = new RegExp(`[${userPunctuation.join('')}]$`);
const punctuationMatches = chatInput.match(userPunctuationRegex);
// console.log(punctuationMatches)
......@@ -84,20 +84,14 @@ function App() {
});
const data = await response.json();
const parsedData = data.message.trim();
// console.log(parsedData)
const programmingKeywords = ['code', 'application', 'controller', 'rails' , 'PHP', 'java', 'javascript', 'script', 'console', 'python', 'programming', 'table'];
const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi');
// console.log(regex)
const matches = parsedData.match(regex);
// console.log(matches);
if (!matches) {
var replaceTags = (parsedData.replace(/(?:\r\n|\r|\n)/g, '<br>').replace(/\./g, '. '))
// console.log("not programming!")
} else {
replaceTags = (parsedData.replace(':',':<code>').replace('<?','&#60;?').replace('?>','?&#62;').replace(/\n/g, '<br>'))
// console.log("programming!")
//.replace('<?','&#60;' + '?').replace('?>','?'+'&#62;')
}
setChatLog([...chatLogNew, { user: "gpt", message: `${replaceTags}`} ])
......@@ -106,7 +100,6 @@ function App() {
} catch (error) {
const errorMsg = "We apologize for any inconvenience caused due to the delay in the response time. Please try again.";
setChatLog([...chatLogNew, { user: "gpt", message: `<div class="errormsg"><span>i</span><div class="msg">${errorMsg}</div></div>`} ])
// res.status(500).send(error || 'Something went wrong');
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!