// SPDX-License-Identifier: MIT // Copyright contributors to the openassistant project import { Icon } from '@iconify/react'; import { Button, Tooltip } from '@heroui/react'; import { StreamMessage, TextUIPart } from '@openassistant/core'; export const MessageActions = ({ isMessageDraggable, index, message, handleCopy, handleFeedback, copied, feedback, }: { isMessageDraggable: boolean; index: number; message?: StreamMessage; handleCopy: () => void; handleFeedback: (index: number, liked: boolean) => void; copied: boolean; feedback?: 'like' | 'dislike'; }) => { const onMessageDragStart = ( e: React.DragEvent, index: number, message?: StreamMessage ) => { if (message?.parts && message.parts.length > 0) { // find text parts const textParts = message.parts.filter((part) => part.type === 'text'); // compose text from all text parts const text = textParts .map((part) => (part as TextUIPart).text) .join('\n'); e.dataTransfer.setData( 'text/plain', JSON.stringify({ id: `message-${index}`, type: 'text', data: text, }) ); } }; return (
); };