File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ export const promptAiSdkStream = async function* (
8282 maxRetries ?: number
8383 onCostCalculated ?: ( credits : number ) => Promise < void >
8484 includeCacheControl ?: boolean
85- resolveMessageId ? : ( messageId : string ) => unknown
85+ resolveMessageId : ( messageId : string | undefined ) => unknown
8686 } & Omit < Parameters < typeof streamText > [ 0 ] , 'model' | 'messages' > ,
8787) : AsyncGenerator < StreamChunk > {
8888 if (
@@ -150,6 +150,10 @@ export const promptAiSdkStream = async function* (
150150 type : 'error' ,
151151 message : errorMessage ,
152152 }
153+
154+ // Important: we need to resolve the message id before returning.
155+ options . resolveMessageId ( undefined )
156+
153157 return
154158 }
155159 if ( chunk . type === 'reasoning-delta' ) {
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export const getAgentStreamFromTemplate = (params: {
3636 const { model } = template
3737
3838 const { promise : messageIdPromise , resolve : resolveMessageId } =
39- Promise . withResolvers < string > ( )
39+ Promise . withResolvers < string | undefined > ( )
4040
4141 const getStream = ( messages : Message [ ] ) => {
4242 const options : Parameters < typeof promptAiSdkStream > [ 0 ] = {
You can’t perform that action at this time.
0 commit comments