mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-23 08:25:57 +00:00
fix(feedback): use real threadId and refresh after stream
- Pass threadId prop to MessageListItem instead of reading "new" from URL params - Invalidate thread-feedback query on stream finish so buttons appear immediately - Show feedback buttons always visible, copy button on hover only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,11 +36,13 @@ import { MarkdownContent } from "./markdown-content";
|
|||||||
|
|
||||||
export function MessageListItem({
|
export function MessageListItem({
|
||||||
className,
|
className,
|
||||||
|
threadId,
|
||||||
message,
|
message,
|
||||||
isLoading,
|
isLoading,
|
||||||
threadId,
|
threadId,
|
||||||
}: {
|
}: {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
threadId?: string;
|
||||||
message: Message;
|
message: Message;
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
threadId: string;
|
threadId: string;
|
||||||
@@ -61,10 +63,13 @@ export function MessageListItem({
|
|||||||
<MessageToolbar
|
<MessageToolbar
|
||||||
className={cn(
|
className={cn(
|
||||||
isHuman ? "-bottom-9 justify-end" : "-bottom-8",
|
isHuman ? "-bottom-9 justify-end" : "-bottom-8",
|
||||||
"absolute right-0 left-0 z-20 opacity-0 transition-opacity delay-200 duration-300 group-hover/conversation-message:opacity-100",
|
"absolute right-0 left-0 z-20",
|
||||||
|
!isHuman && runId && threadId
|
||||||
|
? "opacity-100"
|
||||||
|
: "opacity-0 transition-opacity delay-200 duration-300 group-hover/conversation-message:opacity-100",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex gap-1">
|
<div className="flex gap-1 opacity-0 transition-opacity delay-200 duration-300 group-hover/conversation-message:opacity-100">
|
||||||
<CopyButton
|
<CopyButton
|
||||||
clipboardData={
|
clipboardData={
|
||||||
extractContentFromMessage(message) ??
|
extractContentFromMessage(message) ??
|
||||||
@@ -73,6 +78,13 @@ export function MessageListItem({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{!isHuman && runId && threadId && (
|
||||||
|
<FeedbackButtons
|
||||||
|
threadId={threadId}
|
||||||
|
runId={runId}
|
||||||
|
initialFeedback={feedback ?? null}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</MessageToolbar>
|
</MessageToolbar>
|
||||||
)}
|
)}
|
||||||
</AIElementMessage>
|
</AIElementMessage>
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ export function MessageList({
|
|||||||
return (
|
return (
|
||||||
<MessageListItem
|
<MessageListItem
|
||||||
key={`${group.id}/${msg.id}`}
|
key={`${group.id}/${msg.id}`}
|
||||||
|
threadId={threadId}
|
||||||
message={msg}
|
message={msg}
|
||||||
isLoading={thread.isLoading}
|
isLoading={thread.isLoading}
|
||||||
runId={runId}
|
runId={runId}
|
||||||
|
|||||||
@@ -294,6 +294,7 @@ export function useThreadStream({
|
|||||||
onFinish(state) {
|
onFinish(state) {
|
||||||
listeners.current.onFinish?.(state.values);
|
listeners.current.onFinish?.(state.values);
|
||||||
void queryClient.invalidateQueries({ queryKey: ["threads", "search"] });
|
void queryClient.invalidateQueries({ queryKey: ["threads", "search"] });
|
||||||
|
void queryClient.invalidateQueries({ queryKey: ["thread-feedback"] });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user