aa2b58d4 by Leff Tubat

Added string replace and modified trained prompt

1 parent c198a8a3
......@@ -109,7 +109,7 @@ function App() {
userModifiedInput = chatInput + "?";
}
}
let trained_prompt = chatInput + '. Respond without using markdown, HTML tags, asterisks, hashtags, or any special symbols for formatting.';
let trained_prompt = chatInput + '. Avoiding any tags, markdown syntax, hashtags, or asterisks for formatting.';
let chatLogNew = [...chatLog, { user: "user", message: `${userModifiedInput}`} ]
setChatInput("");
setChatLog(chatLogNew)
......@@ -191,9 +191,24 @@ function App() {
const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi');
const matches = parsedData.match(regex);
if (!matches) {
var replaceTags = (parsedData.replace(/(?:\r\n|\r|\n)/g, '<br>'))
var replaceTags = (
parsedData
.replace(/(?:\r\n|\r|\n)/g, '<br>')
.replace(/\*\*(.*?)\*\*/g, '$1')
.replace(/#\s(.+)/g, "$1")
.replace(/#[A-Za-z0-9_]+:?/g, "")
)
} else {
replaceTags = (parsedData.replace(':',':<code>').replace('<?','&#60;?').replace('?>','?&#62;').replace(/\n/g, '<br>'))
replaceTags = (
parsedData
.replace(':',':<code>')
.replace('<?','&#60;?')
.replace('?>','?&#62;')
.replace(/\n/g, '<br>')
.replace(/\*\*(.*?)\*\*/g, '$1')
.replace(/#\s(.+)/g, "$1")
.replace(/#[A-Za-z0-9_]+:?/g, "")
)
}
for (let i = 0; i < replaceTags.length; i++) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!