d1b31729 by Leff Tubat

Added formatted variable

1 parent f8970941
......@@ -198,8 +198,6 @@ function App() {
.replace('<?','&#60;?')
.replace('?>','?&#62;')
.replace(/\n/g, '<br>')
.replace(/\*\*(.*?)\*\*/g, '<b>$1</b>')
.replace(/###\s(.+)/g, '<h3>$1</h3>')
)
}
......
......@@ -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!