chore: rename blocks to artifacts (#793)
This commit is contained in:
parent
01f589b603
commit
81f909ac3a
41 changed files with 473 additions and 473 deletions
|
|
@ -1,43 +0,0 @@
|
|||
import { myProvider } from '@/lib/ai/models';
|
||||
import { createDocumentHandler } from '@/lib/blocks/server';
|
||||
import { experimental_generateImage } from 'ai';
|
||||
|
||||
export const imageDocumentHandler = createDocumentHandler<'image'>({
|
||||
kind: 'image',
|
||||
onCreateDocument: async ({ title, dataStream }) => {
|
||||
let draftContent = '';
|
||||
|
||||
const { image } = await experimental_generateImage({
|
||||
model: myProvider.imageModel('small-model'),
|
||||
prompt: title,
|
||||
n: 1,
|
||||
});
|
||||
|
||||
draftContent = image.base64;
|
||||
|
||||
dataStream.writeData({
|
||||
type: 'image-delta',
|
||||
content: image.base64,
|
||||
});
|
||||
|
||||
return draftContent;
|
||||
},
|
||||
onUpdateDocument: async ({ description, dataStream }) => {
|
||||
let draftContent = '';
|
||||
|
||||
const { image } = await experimental_generateImage({
|
||||
model: myProvider.imageModel('small-model'),
|
||||
prompt: description,
|
||||
n: 1,
|
||||
});
|
||||
|
||||
draftContent = image.base64;
|
||||
|
||||
dataStream.writeData({
|
||||
type: 'image-delta',
|
||||
content: image.base64,
|
||||
});
|
||||
|
||||
return draftContent;
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue