WIP: Docs and example
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>
);
};