aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/MessageComponent.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/ChatBox/MessageComponent.tsx')
-rw-r--r--src/client/views/nodes/ChatBox/MessageComponent.tsx8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/client/views/nodes/ChatBox/MessageComponent.tsx b/src/client/views/nodes/ChatBox/MessageComponent.tsx
index 1baf6d7d5..91671a24a 100644
--- a/src/client/views/nodes/ChatBox/MessageComponent.tsx
+++ b/src/client/views/nodes/ChatBox/MessageComponent.tsx
@@ -12,8 +12,7 @@ interface MessageComponentProps {
}
const MessageComponent: React.FC<MessageComponentProps> = function ({ message, index, onFollowUpClick, onCitationClick, updateMessageCitations }) {
- const LinkRenderer = ({ children }: { children: React.ReactNode }) => {
- const text = children as string;
+ const renderContent = (text: string) => {
const citationRegex = /<citation chunk_id="([^"]*)" type="([^"]*)">([^<]*)<\/citation>/g;
const parts = [];
let lastIndex = 0;
@@ -47,7 +46,6 @@ const MessageComponent: React.FC<MessageComponentProps> = function ({ message, i
parts.push(text.slice(lastIndex));
- // Update the message's citations in the ChatBox's history
updateMessageCitations(index, citations);
return <>{parts}</>;
@@ -55,9 +53,7 @@ const MessageComponent: React.FC<MessageComponentProps> = function ({ message, i
return (
<div className={`message ${message.role}`}>
- <div>
- <LinkRenderer>{message.text}</LinkRenderer>
- </div>
+ <div>{renderContent(message.text)}</div>
{message.follow_up_questions && message.follow_up_questions.length > 0 && (
<div className="follow-up-questions">
<h4>Follow-up Questions:</h4>