Reset thread

This example shows how to build a chat thread with reset button using Superinterface.
Reset thread assistant
AI provider
Superinterface Cloud logo
Superinterface Cloud
gpt-4.1-mini
Instructions
To reset thread: click "Reset thread" button in top right. Superinterface is AI infrastructure platform.
Functions
No functions used.
'use client' import { useCallback } from 'react' import { SuperinterfaceProvider, Thread, AssistantProvider, useSuperinterfaceContext, } from '@superinterface/react' import { Theme, Flex, Button } from '@radix-ui/themes' import '@radix-ui/themes/styles.css' import { QueryClient, QueryClientProvider, useQueryClient, } from '@tanstack/react-query' const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: 10000, }, }, }) const ResetThreadButton = () => { const { threadIdStorageOptions, variables } = useSuperinterfaceContext() const resetQueryClient = useQueryClient() const onClick = useCallback(() => { threadIdStorageOptions?.remove({ assistantId: variables.assistantId }) resetQueryClient.invalidateQueries() }, [threadIdStorageOptions, variables, resetQueryClient]) return ( <Flex position="absolute" top="5" right="5" > <Button onClick={onClick}>Reset thread</Button> </Flex> ) } export default function Page() { return ( <QueryClientProvider client={queryClient}> <Theme accentColor="amber" grayColor="gray" appearance="light" radius="medium" scaling="100%" > <SuperinterfaceProvider variables={{ publicApiKey: '18d58cdd-96bc-4d01-ab21-1a891a4fd49e', assistantId: '97ee9574-5942-4bdb-95d3-072390cf7a54', }} > <AssistantProvider> <Flex flexGrow="1" height="100dvh" p="5" > <Thread /> <ResetThreadButton /> </Flex> </AssistantProvider> </SuperinterfaceProvider> </Theme> </QueryClientProvider> ) }
Superinterface reset thread example.
Superinterface reset thread example.
This example is hosted here: https://examples-reset-thread.superinterface.ai (see code here)

Getting Started

First, run the development server:
npm run dev # or yarn dev # or pnpm dev # or bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.