nlkitai/nlux

Custom Renderers for Vanilla JS/Vue/Vite don't work

daweto opened this issue · 0 comments

Hi!
The docs show that Custom Renderers can also work for for Vanilla JS, but if I define a simple function to test it, it does not work (nothing happens).

  • Im using NLUX with a Custom Adapter on a Vue 3 App with Vite.
  • Is it a bug, badly documented, or am i doing something wrong??

This is how i defined the my custom renderer to debug.

type ResponseRendererProps<T> = {
    uid: string;
    dataTransferMode: 'stream' | 'batch';
    status: 'streaming' | 'complete';
    content: [T];
    serverResponse: unknown[];
};
type ResponseRenderer<T> = (props: ResponseRendererProps<T>) => HTMLElement | null;

const customResponseRenderer: ResponseRenderer<MarkdownString> = (params) => {
  console.log('customResponseRenderer', params);
  const elmnt = document.createElement('div');
  elmnt.innerHTML = 'hello';
  return elmnt;
};