Fix AI stream by returning stream.value directly from Server Actions.
createStreamableValue must be created and returned in the action itself; wrapping in { data } or a helper return caused production RSC serialization errors.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import { streamAIResponse } from "@/lib/ai/stream";
|
||||
import { createStreamableValue } from "ai/rsc";
|
||||
import { pumpAIStream } from "@/lib/ai/stream";
|
||||
import {
|
||||
formatLiuyaoTimingForPrompt,
|
||||
getTimingInfoWithLongitude,
|
||||
@@ -51,7 +52,9 @@ export async function getLiuyaoAnswer(input: LiuyaoInput) {
|
||||
guaDetailText = "";
|
||||
}
|
||||
|
||||
return streamAIResponse(
|
||||
const stream = createStreamableValue<string>();
|
||||
pumpAIStream(
|
||||
stream,
|
||||
LIUYAO_SYSTEM_PROMPT,
|
||||
`${timingText}
|
||||
|
||||
@@ -63,4 +66,5 @@ ${input.question}
|
||||
|
||||
${guaDetailText}`,
|
||||
);
|
||||
return stream.value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user