feat: wire MCPAppRenderer into ChatPanel for MCP App tool results

This commit is contained in:
Ken
2026-05-26 19:39:34 +00:00
parent 12d1df417f
commit 9d118d60ce
2 changed files with 87 additions and 3 deletions
+14 -3
View File
@@ -3,6 +3,7 @@ import type { KeyboardEvent } from 'react'
import ReactMarkdown from 'react-markdown'
import { IconSend } from '@tabler/icons-react'
import { ToolCallCard } from './ToolCallCard'
import { MCPAppRenderer } from './MCPAppRenderer'
import type { ChatMessage } from '../hooks/useChat'
interface ChatPanelProps {
@@ -61,9 +62,19 @@ export function ChatPanel({ messages, isStreaming, onSend, sessionId }: ChatPane
{message.role === 'assistant' ? (
<div>
<ReactMarkdown>{message.content}</ReactMarkdown>
{message.toolCalls?.map(tc => (
<ToolCallCard key={tc.id} toolCall={tc} />
))}
{message.toolCalls?.map(tc =>
tc._meta?.ui?.resourceUri ? (
<MCPAppRenderer
key={tc.id}
resourceUri={tc._meta.ui.resourceUri}
data={tc.structuredContent ?? {}}
csp={tc._meta.ui.csp}
onSendMessage={(content) => onSend(content)}
/>
) : (
<ToolCallCard key={tc.id} toolCall={tc} />
)
)}
</div>
) : (
<div>{message.content}</div>