Add aligned assistant timestamps and Copy/Fork actions
This commit is contained in:
@@ -2,17 +2,19 @@ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/ho
|
||||
import type { ComponentChildren, JSX } from "preact";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ChatAttachmentList } from "@/components/chat/chat-attachment-list";
|
||||
import { AssistantMessageFooter } from "@/components/chat/assistant-message-footer";
|
||||
import { getMessageAttachments, type Message } from "@/lib/api";
|
||||
import { asStreamingAssistantMetadata, isInlineAgentReplyPending } from "@/lib/chat-stream-presentation";
|
||||
import { AgentBubble } from "@/components/agent/agent-conversation";
|
||||
import { MarkdownContent } from "@/components/markdown/markdown-content";
|
||||
import { ChevronDown, ChevronUp, Globe2, Link2, MoreHorizontal, Wrench } from "lucide-preact";
|
||||
import { ChevronDown, ChevronUp, Globe2, Link2, Wrench } from "lucide-preact";
|
||||
|
||||
type Props = {
|
||||
messages: Message[];
|
||||
isLoading: boolean;
|
||||
isSending: boolean;
|
||||
onMessageActions?: (event: MouseEvent, messageId: string) => void;
|
||||
onForkMessage?: (messageId: string) => void;
|
||||
isForking?: boolean;
|
||||
};
|
||||
|
||||
type ToolLogMetadata = {
|
||||
@@ -538,7 +540,7 @@ export function StreamingAssistantPresentation({ message, isSending }: { message
|
||||
);
|
||||
}
|
||||
|
||||
export function ChatMessagesPanel({ messages, isLoading, isSending, onMessageActions }: Props) {
|
||||
export function ChatMessagesPanel({ messages, isLoading, isSending, onForkMessage, isForking }: Props) {
|
||||
const hasPendingAssistant = messages.some((message) => message.id.startsWith("temp-assistant-"));
|
||||
const renderItems = useMemo(() => buildMessageRenderItems(messages), [messages]);
|
||||
const toolCallMessageIDs = useMemo(() => getToolCallMessageIDs(messages), [messages]);
|
||||
@@ -637,12 +639,8 @@ export function ChatMessagesPanel({ messages, isLoading, isSending, onMessageAct
|
||||
className={cn("[&_a]:text-inherit [&_a]:underline", !isUser && "leading-[1.82] text-violet-50")}
|
||||
/>
|
||||
) : null}
|
||||
{message.role === "assistant" && !message.id.startsWith("temp-") && onMessageActions ? (
|
||||
<button type="button" aria-label="Message actions" title="Message actions"
|
||||
className="flex h-9 w-9 items-center justify-center rounded text-muted-foreground hover:bg-violet-400/12 hover:text-violet-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring"
|
||||
onClick={event => onMessageActions(event, message.id)}>
|
||||
<MoreHorizontal className="h-4 w-4" />
|
||||
</button>
|
||||
{message.role === "assistant" && !message.id.startsWith("temp-") ? (
|
||||
<AssistantMessageFooter message={message} onFork={onForkMessage} isForking={isForking} />
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user