'use client'; import { useChat } from '@ai-sdk/react'; import { DefaultChatTransport } from 'ai'; import ChatInput from '@/component/chat-input'; export default function TestMistral() { const { error, status, sendMessage, messages, regenerate, stop } = useChat({ transport: new DefaultChatTransport({ api: '/api/chat-mistral' }), }); return (

Mistral Block-Based Streaming Test

{messages.map(m => (
{m.role === 'user' ? 'User: ' : 'AI: '} {m.parts.map(part => { if (part.type === 'text') { return part.text; } })}
))} {(status === 'submitted' || status === 'streaming') && (
{status === 'submitted' &&
Loading...
}
)} {error && (
An error occurred.
)} sendMessage({ text })} />
); }