044faa07 by Ryan

Merge branch '26797_chatgpt_format3' into 'master'

26797 chatgpt format3

See merge request !9
2 parents 0a4a261d 520d1069
......@@ -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)
......@@ -83,7 +83,6 @@ 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');
......@@ -96,11 +95,8 @@ function App() {
} 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}`} ])
// setChatLog([...chatLogNew, { user: "gpt", message: `<div>${parsedData}</div>`} ])
var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0];
scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight;
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!