MCPcopy Create free account
hub / github.com/agegr/pi-web / BlockView

Function BlockView

components/MessageView.tsx:581–595  ·  view source on GitHub ↗
({ block, toolResults, isStreaming, streamingDuration, toolCallDurations, cwd, onOpenFile, sessionId, entryId, blockIndex }: { block: AssistantContentBlock; toolResults?: Map<string, ToolResultMessage>; isStreaming?: boolean; streamingDuration?: number; toolCallDurations?: Map<string, number>; cwd?: string; onOpenFile?: (filePath: string) => void; sessionId?: string; entryId?: string; blockIndex: number })

Source from the content-addressed store, hash-verified

579}
580
581function BlockView({ block, toolResults, isStreaming, streamingDuration, toolCallDurations, cwd, onOpenFile, sessionId, entryId, blockIndex }: { block: AssistantContentBlock; toolResults?: Map<string, ToolResultMessage>; isStreaming?: boolean; streamingDuration?: number; toolCallDurations?: Map<string, number>; cwd?: string; onOpenFile?: (filePath: string) => void; sessionId?: string; entryId?: string; blockIndex: number }) {
582 if (block.type === "text") {
583 return <TextBlock block={block as TextContent} isStreaming={isStreaming} cwd={cwd} onOpenFile={onOpenFile} />;
584 }
585 if (block.type === "thinking") {
586 return <ThinkingBlock block={block as ThinkingContent} duration={streamingDuration} sessionId={sessionId} entryId={entryId} blockIndex={blockIndex} />;
587 }
588 if (block.type === "toolCall") {
589 const tc = block as ToolCallContent;
590 const result = toolResults?.get(tc.toolCallId);
591 const duration = toolCallDurations?.get(tc.toolCallId);
592 return <ToolCallBlock block={tc} result={result} duration={duration} />;
593 }
594 return null;
595}
596
597function TextBlock({ block, isStreaming, cwd, onOpenFile }: { block: TextContent; isStreaming?: boolean; cwd?: string; onOpenFile?: (filePath: string) => void }) {
598 return <MarkdownBody isStreaming={isStreaming} cwd={cwd} onOpenFile={onOpenFile}>{block.text}</MarkdownBody>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected