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 { AiChat, useAsStreamAdapter } from '@nlux/react';
import '@nlux/themes/nova.css';

import { send } from './send';
import { personas } from './personas';

export default () => {
    const adapter = useAsStreamAdapter(send, []);
  
  // Markdown parsing is enabled by default
  // No addtional configuration needed
  // Just type a prompt that would result in a markdown response

  return (
    <AiChat
      adapter={ adapter }
      personaOptions={ personas }
      displayOptions={{ colorScheme: 'dark' }}
    />
  );
};