import React from 'react'; import { useLocalize } from '~/hooks'; import { Tools } from 'librechat-data-provider'; import { UIResourceRenderer } from '@mcp-ui/client'; import UIResourceCarousel from './UIResourceCarousel'; import type { TAttachment, UIResource } from 'librechat-data-provider'; function OptimizedCodeBlock({ text, maxHeight = 320 }: { text: string; maxHeight?: number }) { return (
        {text}
      
); } export default function ToolCallInfo({ input, output, domain, function_name, pendingAuth, attachments, }: { input: string; function_name: string; output?: string | null; domain?: string; pendingAuth?: boolean; attachments?: TAttachment[]; }) { const localize = useLocalize(); const formatText = (text: string) => { try { return JSON.stringify(JSON.parse(text), null, 2); } catch { return text; } }; let title = domain != null && domain ? localize('com_assistants_domain_info', { 0: domain }) : localize('com_assistants_function_use', { 0: function_name }); if (pendingAuth === true) { title = domain != null && domain ? localize('com_assistants_action_attempt', { 0: domain }) : localize('com_assistants_attempt_info'); } const uiResources: UIResource[] = attachments ?.filter((attachment) => attachment.type === Tools.ui_resources) .flatMap((attachment) => { return attachment[Tools.ui_resources] as UIResource[]; }) ?? []; return (
{title}
{output && ( <>
{localize('com_ui_result')}
{uiResources.length > 0 && (
{localize('com_ui_ui_resources')}
)}
{uiResources.length > 1 && } {uiResources.length === 1 && ( { console.log('Action:', result); }} htmlProps={{ autoResizeIframe: { width: true, height: true }, }} /> )}
)}
); }