Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions frontend/src/components/workspace/messages/message-list-item.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Message } from "@langchain/langgraph-sdk";
import { FileIcon, Loader2Icon } from "lucide-react";
import { useParams } from "next/navigation";
import { memo, useMemo, type ImgHTMLAttributes } from "react";
import rehypeKatex from "rehype-katex";

Expand Down Expand Up @@ -39,10 +38,12 @@ export function MessageListItem({
className,
message,
isLoading,
threadId,
}: {
className?: string;
message: Message;
isLoading?: boolean;
threadId: string;
}) {
const isHuman = message.type === "human";
return (
Expand All @@ -54,6 +55,7 @@ export function MessageListItem({
className={isHuman ? "w-fit" : "w-full"}
message={message}
isLoading={isLoading}
threadId={threadId}
/>
{!isLoading && (
<MessageToolbar
Expand Down Expand Up @@ -111,21 +113,22 @@ function MessageContent_({
className,
message,
isLoading = false,
threadId,
}: {
className?: string;
message: Message;
isLoading?: boolean;
threadId: string;
}) {
const rehypePlugins = useRehypeSplitWordsIntoSpans(isLoading);
const isHuman = message.type === "human";
const { thread_id } = useParams<{ thread_id: string }>();
const components = useMemo(
() => ({
img: (props: ImgHTMLAttributes<HTMLImageElement>) => (
<MessageImage {...props} threadId={thread_id} maxWidth="90%" />
<MessageImage {...props} threadId={threadId} maxWidth="90%" />
),
}),
[thread_id],
[threadId],
);

const rawContent = extractContentFromMessage(message);
Expand All @@ -151,8 +154,8 @@ function MessageContent_({
}, [rawContent, isHuman]);

const filesList =
files && files.length > 0 && thread_id ? (
<RichFilesList files={files} threadId={thread_id} />
files && files.length > 0 ? (
<RichFilesList files={files} threadId={threadId} />
) : null;

// Uploading state: mock AI message shown while files upload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function MessageList({
key={`${group.id}/${msg.id}`}
message={msg}
isLoading={thread.isLoading}
threadId={threadId}
/>
);
});
Expand Down
Loading