aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/MessageComponent.tsx
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-07-10 17:54:59 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-07-10 17:54:59 -0400
commitd2c968cb3705b314396c0503b089f8a233a26502 (patch)
treeb81f12fcb6af70df42f9789a2f73bbe95f94282c /src/client/views/nodes/ChatBox/MessageComponent.tsx
parentaa8b1248408846d6a158f8df1c76fa3015ce3aac (diff)
Working now somewhat
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>