3a15657d by Administrator

Merge branch '32993_CHATBOT_PLUS_GPT4o_MINI' into 'master'

32993_CHATBOT_PLUS_GPT4o_MINI

See merge request !133
2 parents 3f4eaff9 aa2b58d4
Pipeline #30627 for 3a15657d passed in 18 seconds
...@@ -109,7 +109,7 @@ function App() { ...@@ -109,7 +109,7 @@ function App() {
109 userModifiedInput = chatInput + "?"; 109 userModifiedInput = chatInput + "?";
110 } 110 }
111 } 111 }
112 let trained_prompt = chatInput + '. Respond without using markdown, HTML tags, or any special symbols for formatting.'; 112 let trained_prompt = chatInput + '. Avoiding any tags, markdown syntax, hashtags, or asterisks for formatting.';
113 let chatLogNew = [...chatLog, { user: "user", message: `${userModifiedInput}`} ] 113 let chatLogNew = [...chatLog, { user: "user", message: `${userModifiedInput}`} ]
114 setChatInput(""); 114 setChatInput("");
115 setChatLog(chatLogNew) 115 setChatLog(chatLogNew)
...@@ -191,9 +191,24 @@ function App() { ...@@ -191,9 +191,24 @@ function App() {
191 const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi'); 191 const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi');
192 const matches = parsedData.match(regex); 192 const matches = parsedData.match(regex);
193 if (!matches) { 193 if (!matches) {
194 var replaceTags = (parsedData.replace(/(?:\r\n|\r|\n)/g, '<br>')) 194 var replaceTags = (
195 parsedData
196 .replace(/(?:\r\n|\r|\n)/g, '<br>')
197 .replace(/\*\*(.*?)\*\*/g, '$1')
198 .replace(/#\s(.+)/g, "$1")
199 .replace(/#[A-Za-z0-9_]+:?/g, "")
200 )
195 } else { 201 } else {
196 replaceTags = (parsedData.replace(':',':<code>').replace('<?','&#60;?').replace('?>','?&#62;').replace(/\n/g, '<br>')) 202 replaceTags = (
203 parsedData
204 .replace(':',':<code>')
205 .replace('<?','&#60;?')
206 .replace('?>','?&#62;')
207 .replace(/\n/g, '<br>')
208 .replace(/\*\*(.*?)\*\*/g, '$1')
209 .replace(/#\s(.+)/g, "$1")
210 .replace(/#[A-Za-z0-9_]+:?/g, "")
211 )
197 } 212 }
198 213
199 for (let i = 0; i < replaceTags.length; i++) { 214 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!