mirror of https://github.com/buster-so/buster.git
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import type { ReasoningMessageProps } from '../ReasoningMessageSelector';
|
|
import type {
|
|
BusterChatMessageReasoning_files,
|
|
BusterChatMessage
|
|
} from '@/api/asset_interfaces/chat';
|
|
import { ReasoningMessage_File } from './ReasoningMessageFile';
|
|
import { useGetChatMessage } from '@/api/buster_rest/chats';
|
|
|
|
const getReasoningMessage = (x: BusterChatMessage | undefined, reasoningMessageId: string) =>
|
|
x?.reasoning_messages[reasoningMessageId] as BusterChatMessageReasoning_files;
|
|
|
|
export const ReasoningMessage_Files: React.FC<ReasoningMessageProps> = React.memo(
|
|
({ isCompletedStream, chatId, reasoningMessageId, messageId }) => {
|
|
const file_ids = useGetChatMessage(
|
|
messageId,
|
|
(x) => getReasoningMessage(x, reasoningMessageId)?.file_ids
|
|
);
|
|
|
|
if (!file_ids || file_ids.length === 0) return null;
|
|
|
|
return (
|
|
<div className="flex flex-col gap-3">
|
|
{file_ids.map((fileId) => (
|
|
<ReasoningMessage_File
|
|
key={fileId}
|
|
fileId={fileId}
|
|
chatId={chatId}
|
|
messageId={messageId}
|
|
reasoningMessageId={reasoningMessageId}
|
|
isCompletedStream={isCompletedStream}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|
|
);
|
|
|
|
ReasoningMessage_Files.displayName = 'ReasoningMessage_Files';
|