Skip to content

Commit 32d46a0

Browse files
docs(sdk): clarify regeneration removes old answer only with regenerate()
Document that useChat's regenerate() removes the last assistant message before streaming, while sendMessage with a regenerate action appends without removal, leaving both answers visible. Co-authored-by: Eric Allam <ericallam@users.noreply.github.com>
1 parent f02d837 commit 32d46a0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • packages/trigger-sdk/skills/trigger-chat-agent-advanced

packages/trigger-sdk/skills/trigger-chat-agent-advanced/SKILL.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,11 @@ export const myChat = chat.agent({
227227

228228
Send from the browser through `useChat`, so the answer a turn produces renders like any turn:
229229
`sendMessage(undefined, { body: { action: { type: "regenerate" } } })`, `regenerate({ body: { action } })`,
230-
or `useChatActions({ sendMessage })` from `@trigger.dev/sdk/chat/react`. `transport.sendAction(chatId, action)`
231-
returns a raw stream the caller must read itself. Server-side, use
230+
or `useChatActions({ sendMessage })` from `@trigger.dev/sdk/chat/react`. For regeneration, use
231+
`regenerate()` from `useChat` (Vercel AI SDK) which removes the last assistant message before
232+
streaming the new one; calling `sendMessage` with a regenerate action appends without removal,
233+
leaving both answers visible. `transport.sendAction(chatId, action)` returns a raw stream the
234+
caller must read and apply itself. Server-side, use
232235
`agentChat.sendAction({ type: "rollback", targetMessageId: "msg-3" })`.
233236

234237
### 6. Fast starts: Head Start

0 commit comments

Comments
 (0)