Skip to main content
Version: v2.x

Markdown Streaming


In this example, we show how the user can write a prompt that results in a stream of markdown content.
The formatted markdown is streamed and displayed to the user as it is being generated by the LLM.

import {useMemo} from 'react';
import {AiChat} from '@nlux/react';
import '@nlux/themes/nova.css';
import {streamAdapter} from './adapter';
import {personaOptions} from './personas';

export default () => {
  const adapter = useMemo(() => streamAdapter, []);
  
  // Markdown parsing is enabled by default
  // No addtional configuration needed
  return (
    <AiChat
      adapter={adapter}
      personaOptions={personaOptions}
      displayOptions={{colorScheme: 'dark'}}
    />
  );
};