fix(frontend): avoid using route new as thread id (#1967)

Co-authored-by: luoxiao6645 <luoxiao6645@gmail.com>
This commit is contained in:
2026-04-08 10:08:55 +08:00 committed by GitHub
parent 24805200f0
commit 85b7ed3cec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View File

@ -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";
@ -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 (
@ -54,6 +55,7 @@ export function MessageListItem({
className={isHuman ? "w-fit" : "w-full"}
message={message}
isLoading={isLoading}
threadId={threadId}
/>
{!isLoading && (
<MessageToolbar
@ -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);
@ -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

View File

@ -63,6 +63,7 @@ export function MessageList({
key={`${group.id}/${msg.id}`}
message={msg}
isLoading={thread.isLoading}
threadId={threadId}
/>
);
});