/** * @license * Copyright 2025 Qwen Team * SPDX-License-Identifier: Apache-2.0 * * Generic tool call component - handles all tool call types as fallback */ import type React from 'react'; import type { BaseToolCallProps } from './shared/types.js'; import { ToolCallCard, ToolCallRow, StatusIndicator, CodeBlock, LocationsList, DiffDisplay, } from './shared/LayoutComponents.js'; import { formatValue, safeTitle, getKindIcon, groupContent, } from './shared/utils.js'; /** * Generic tool call component that can display any tool call type * Used as fallback for unknown tool call kinds */ export const GenericToolCall: React.FC = ({ toolCall }) => { const { kind, title, status, rawInput, content, locations } = toolCall; const kindIcon = getKindIcon(kind); const titleText = safeTitle(title); // Group content by type const { textOutputs, errors, diffs, otherData } = groupContent(content); return ( {/* Title row */} {/* Input row */} {rawInput && ( {formatValue(rawInput)} )} {/* Locations row */} {locations && locations.length > 0 && ( )} {/* Output row - combined text outputs */} {textOutputs.length > 0 && ( {textOutputs.join('\n')} )} {/* Error row - combined errors */} {errors.length > 0 && (
{errors.join('\n')}
)} {/* Diff rows */} {diffs.map( (item: import('./shared/types.js').ToolCallContent, idx: number) => ( ), )} {/* Other data rows */} {otherData.length > 0 && ( {otherData.map((data: unknown) => formatValue(data)).join('\n\n')} )}
); };