chore: update to ai sdk v5 beta (#1074)

This commit is contained in:
Jeremy 2025-07-03 02:26:34 -07:00 committed by GitHub
parent 7d8e71383f
commit 4c281fe09d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 1372 additions and 1060 deletions

View file

@ -17,10 +17,10 @@ export const sheetArtifact = new Artifact<'sheet', Metadata>({
description: 'Useful for working with spreadsheets',
initialize: async () => {},
onStreamPart: ({ setArtifact, streamPart }) => {
if (streamPart.type === 'sheet-delta') {
if (streamPart.type === 'data-sheetDelta') {
setArtifact((draftArtifact) => ({
...draftArtifact,
content: streamPart.content as string,
content: streamPart.data,
isVisible: true,
status: 'streaming',
}));
@ -93,21 +93,27 @@ export const sheetArtifact = new Artifact<'sheet', Metadata>({
{
description: 'Format and clean data',
icon: <SparklesIcon />,
onClick: ({ appendMessage }) => {
appendMessage({
onClick: ({ sendMessage }) => {
sendMessage({
role: 'user',
content: 'Can you please format and clean the data?',
parts: [
{ type: 'text', text: 'Can you please format and clean the data?' },
],
});
},
},
{
description: 'Analyze and visualize data',
icon: <LineChartIcon />,
onClick: ({ appendMessage }) => {
appendMessage({
onClick: ({ sendMessage }) => {
sendMessage({
role: 'user',
content:
'Can you please analyze and visualize the data by creating a new code artifact in python?',
parts: [
{
type: 'text',
text: 'Can you please analyze and visualize the data by creating a new code artifact in python?',
},
],
});
},
},

View file

@ -26,9 +26,10 @@ export const sheetDocumentHandler = createDocumentHandler<'sheet'>({
const { csv } = object;
if (csv) {
dataStream.writeData({
type: 'sheet-delta',
content: csv,
dataStream.write({
type: 'data-sheetDelta',
data: csv,
transient: true,
});
draftContent = csv;
@ -36,9 +37,10 @@ export const sheetDocumentHandler = createDocumentHandler<'sheet'>({
}
}
dataStream.writeData({
type: 'sheet-delta',
content: draftContent,
dataStream.write({
type: 'data-sheetDelta',
data: draftContent,
transient: true,
});
return draftContent;
@ -63,9 +65,10 @@ export const sheetDocumentHandler = createDocumentHandler<'sheet'>({
const { csv } = object;
if (csv) {
dataStream.writeData({
type: 'sheet-delta',
content: csv,
dataStream.write({
type: 'data-sheetDelta',
data: csv,
transient: true,
});
draftContent = csv;