@twintag/twintag-assistant
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

Twintag Assistant

WIP: Docs and example

Usage

import { TwintagAssistantProvider, TwintagAssistantChat } from '@twintag/twintag-assistant';

const messageHandler = async (params: {
  message: string;
  threadId: string | null;
}) => {
  const res = await fetch('...', {
    method: 'POST',
    body: JSON.stringify({
      input: {
        input: params.message,
        thread_id: params.threadId,
      },
    }),
  });

  return (await res.json()) as {
    output: {
      output: string;
      thread_id: string;
    };
  };
};

const TwintagAssistant = () => {
  return (
    <TwintagAssistantProvider handler={messageHandler}>
      <TwintagAssistantChat headerText='Twintag Assistant' />
    </TwintagAssistantProvider>
  );
};

Readme

Keywords

none

Package Sidebar

Install

npm i @twintag/twintag-assistant

Weekly Downloads

0

Version

0.2.2

License

none

Unpacked Size

2.38 kB

Total Files

2

Last publish

Collaborators

  • twintag-ci