const viewport = document.querySelector('aparte-chat-viewport');
viewport.appendMessage({
id: 'preview',
role: 'assistant',
timestamp: Date.now(),
segments: [
// With no renderer registered for `subType`, core draws `fallback` — which is why the
// field exists: an unknown view degrades to a sentence instead of to nothing.
{
id: 's1',
type: 'custom',
subType: 'weather-widget',
data: { city: 'Lille', celsius: 11 },
fallback: 'Lille — 11°C, overcast.',
},
],
});