8c361942 by Administrator

Merge branch '32993_CHATBOT_PLUS_GPT4o_MINI' into 'master'

32993_CHATBOT_PLUS_GPT4o_MINI

See merge request !130
2 parents 604ed219 d1b31729
Pipeline #30502 for 8c361942 passed in 18 seconds
......@@ -193,7 +193,12 @@ function App() {
if (!matches) {
var replaceTags = (parsedData.replace(/(?:\r\n|\r|\n)/g, '<br>'))
} 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>')
)
}
for (let i = 0; i < replaceTags.length; i++) {
......
......@@ -54,6 +54,7 @@ const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput, startedInterac
}
const ChatMessage = ({ message }) => {
const formattedMessage = message.message.replace(/\*\*(.*?)\*\*/g, '<b>$1</b>').replace(/###\s(.+)/g, '<b>$1</b>');
return (
<div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}>
<div className="chat-message-center" style={ message.user === "gpt" ? { background: "#ddf1f9"} : {}}>
......@@ -63,7 +64,7 @@ const ChatMessage = ({ message }) => {
{/* <div className="message">
{message.message}
</div> */}
<div className="message" dangerouslySetInnerHTML={{ __html: message.message }} />
<div className="message" dangerouslySetInnerHTML={{ __html: formattedMessage }} />
</div>
</div>
)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!