Skip to content

Commit

Permalink
feat(ai-sdk/useChat): assistant message append support (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Aug 2, 2024
1 parent 833d89b commit 3ddfde5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-rice-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@assistant-ui/react-ai-sdk": patch
---

feat: assistant message append support
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ export class VercelUseChatThreadRuntime implements ReactThreadRuntime {

public async append(message: AppendMessage): Promise<void> {
// add user message
if (message.role !== "user")
throw new Error(
"Only appending user messages are supported in VercelUseChatRuntime. This is likely an internal bug in assistant-ui.",
);

if (message.content.length !== 1 || message.content[0]?.type !== "text")
throw new Error(
"Only text content is supported by VercelUseChatRuntime. Use the Edge runtime for image support.",
Expand All @@ -80,7 +75,7 @@ export class VercelUseChatThreadRuntime implements ReactThreadRuntime {
this.vercel.setMessages(newMessages);

await this.vercel.append({
role: "user",
role: message.role,
content: message.content[0].text,
});
}
Expand Down

0 comments on commit 3ddfde5

Please sign in to comment.