useCreateMessage
Use the useCreateMessage
hook to create a thread message.
import {
useCreateMessage,
} from '@superinterface/react'
export const App = () => {
const { createMessage, isPending } = useCreateMessage()
return (
<button
onClick={()=> (
!isPending && createMessage({ content: 'Hello AI!' })
)}
>
Send a message
</button>
)
}
Arguments
No parameters available.
To set mutation options, use defaultOptions
from <SuperinterfaceProvider>
or <Thread.Root>
.
Returns
Here's a summary of useMessages
return properties:
Good to know:
useCreateMessage
additionally returns all props from Tanstack Query useMutation
.
So you can use props like isPending
, data
and so on.