feat: add smooth stream (#722)
This commit is contained in:
parent
3f9d379a6a
commit
5e8cddc886
5 changed files with 52 additions and 20 deletions
|
|
@ -2,6 +2,7 @@ import { generateUUID } from '@/lib/utils';
|
|||
import {
|
||||
DataStreamWriter,
|
||||
experimental_generateImage,
|
||||
smoothStream,
|
||||
streamObject,
|
||||
streamText,
|
||||
tool,
|
||||
|
|
@ -60,6 +61,7 @@ export const createDocument = ({
|
|||
model: customModel(model.apiIdentifier),
|
||||
system:
|
||||
'Write about the given topic. Markdown is supported. Use headings wherever appropriate.',
|
||||
experimental_transform: smoothStream({ chunking: 'word' }),
|
||||
prompt: title,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
DataStreamWriter,
|
||||
experimental_generateImage,
|
||||
smoothStream,
|
||||
streamObject,
|
||||
streamText,
|
||||
tool,
|
||||
|
|
@ -52,6 +53,7 @@ export const updateDocument = ({
|
|||
const { fullStream } = streamText({
|
||||
model: customModel(model.apiIdentifier),
|
||||
system: updateDocumentPrompt(currentContent, 'text'),
|
||||
experimental_transform: smoothStream({ chunking: 'word' }),
|
||||
prompt: description,
|
||||
experimental_providerMetadata: {
|
||||
openai: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue