File tree 2 files changed +14
-3
lines changed
examples/next-openai/app/api/use-chat-streamdata-multistep
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,10 @@ export async function POST(req: Request) {
54
54
system:
55
55
' You are a helpful assistant with a different system prompt. Repeat the extract user goal in your answer.' ,
56
56
// continue the workflow stream with the messages from the previous step:
57
- messages: [... messages , ... (await result1 .response ).messages ],
57
+ messages: [
58
+ ... convertToCoreMessages (messages ),
59
+ ... (await result1 .response ).messages ,
60
+ ],
58
61
});
59
62
60
63
// forward the 2nd result to the client (incl. the finish event):
Original file line number Diff line number Diff line change 1
1
import { openai } from '@ai-sdk/openai' ;
2
- import { createDataStreamResponse , streamText , tool } from 'ai' ;
2
+ import {
3
+ convertToCoreMessages ,
4
+ createDataStreamResponse ,
5
+ streamText ,
6
+ tool ,
7
+ } from 'ai' ;
3
8
import { z } from 'zod' ;
4
9
5
10
export async function POST ( req : Request ) {
@@ -36,7 +41,10 @@ export async function POST(req: Request) {
36
41
system :
37
42
'You are a helpful assistant with a different system prompt. Repeat the extract user goal in your answer.' ,
38
43
// continue the workflow stream with the messages from the previous step:
39
- messages : [ ...messages , ...( await result1 . response ) . messages ] ,
44
+ messages : [
45
+ ...convertToCoreMessages ( messages ) ,
46
+ ...( await result1 . response ) . messages ,
47
+ ] ,
40
48
} ) ;
41
49
42
50
// forward the 2nd result to the client (incl. the finish event):
You can’t perform that action at this time.
0 commit comments