You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/hooks.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,6 +216,7 @@ The `useMessages` hook allows you to track and manage the chatbot's messages.
216
216
| endStreamMessage |`async function`| Refer [here](/api/params#endstreammessage)| A utility function used to indicate the end of an existing message stream, identical to `params.endMessageStream`. |
217
217
| removeMessage |`async function`| Refer [here](/api/params#removemessage)| A utility function used to remove a message from the chat, identical to `params.removeMessage`. |
218
218
| messages |`Array<Message>`| - |Array containing all messages currently shown in the chatbot. |
219
+
| getMessage. |`function`|**sender (required)** - The sender of the message. <br/><br/> **numMessages (optional)** - Number of messages to fetch (default: 1). <br/><br/> **offset (optional)** - How many messages to skip backward (default: 0). | Retrieves the latest message(s) from the specified sender. If numMessages > 1, returns an array of messages. If no message is found, returns null. |
219
220
| replaceMessages |`function`|**newMessagesOrUpdater (required)** - Either: (1) `Message[]` to replace chat with, or (2) a callback `(prevMessages: Message[]) => Message[]` returning the new messages. | Directly replaces the current messages with provided messages, or computes them from the previous state. |
0 commit comments