Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 1,242 Bytes
79b2fcc 67b16c6 79b2fcc 0611031 79b2fcc 2a2e170 79b2fcc 67b16c6 79b2fcc 0611031 79b2fcc 2a2e170 79b2fcc 35dc01a 79b2fcc 0611031 79b2fcc 35dc01a 79b2fcc 463e470 79b2fcc 2a2e170 79b2fcc 463e470 79b2fcc 3ce798d 79b2fcc 67b16c6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import UserMessage from './UserMessage';
import AssistantMessage from './AssistantMessage';
import type { UIMessage } from 'ai';
interface MessageBubbleProps {
message: UIMessage;
isLastTurn?: boolean;
onUndoTurn?: () => void;
onEditAndRegenerate?: (messageId: string, newText: string) => void | Promise<void>;
isProcessing?: boolean;
isStreaming?: boolean;
sessionId?: string | null;
approveTools: (approvals: Array<{ tool_call_id: string; approved: boolean; feedback?: string | null }>) => Promise<boolean>;
}
export default function MessageBubble({
message,
isLastTurn = false,
onUndoTurn,
onEditAndRegenerate,
isProcessing = false,
isStreaming = false,
sessionId,
approveTools,
}: MessageBubbleProps) {
if (message.role === 'user') {
return (
<UserMessage
message={message}
isLastTurn={isLastTurn}
onUndoTurn={onUndoTurn}
onEditAndRegenerate={onEditAndRegenerate}
isProcessing={isProcessing}
/>
);
}
if (message.role === 'assistant') {
return (
<AssistantMessage
message={message}
isStreaming={isStreaming}
sessionId={sessionId}
approveTools={approveTools}
/>
);
}
return null;
}
|