nlkitai / nlux

The 𝗣𝗼𝘄𝗲𝗿𝗳𝘂𝗹 Conversational AI JavaScript Library 💬 — UI for any LLM, supporting LangChain / HuggingFace / Vercel AI, and more 🧡 React, Next.js, and plain JavaScript ⭐️

Home Page:https://docs.nlkit.com/nlux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

daweto opened this issue · 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;
};