Replace RSC streaming with /api/ai Route Handler for Docker reliability.
Server Actions + createStreamableValue kept failing in production; fetch-based text stream avoids RSC serialization issues and shows readable error messages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import type { BaziInput } from "@/lib/calc/bazi";
|
||||
|
||||
export interface LiuyaoAiInput {
|
||||
question: string;
|
||||
calcDate: string;
|
||||
calcTime: string;
|
||||
locationName: string;
|
||||
longitude: number;
|
||||
guaMark: string;
|
||||
guaTitle: string;
|
||||
guaResult: string;
|
||||
guaChange: string;
|
||||
}
|
||||
|
||||
export interface BaziAiInput {
|
||||
input: BaziInput;
|
||||
question: string;
|
||||
birthPlaceName: string;
|
||||
}
|
||||
|
||||
export interface CombinedAiInput {
|
||||
birth: BaziInput;
|
||||
birthPlaceName: string;
|
||||
currentPlaceName: string;
|
||||
currentLongitude: number;
|
||||
calcDate: string;
|
||||
calcTime: string;
|
||||
question: string;
|
||||
hexagram?: {
|
||||
guaMark: string;
|
||||
guaTitle: string;
|
||||
guaResult: string;
|
||||
guaChange: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type AiRequestBody =
|
||||
| { mode: "liuyao"; payload: LiuyaoAiInput }
|
||||
| { mode: "bazi"; payload: BaziAiInput }
|
||||
| { mode: "combined"; payload: CombinedAiInput };
|
||||
Reference in New Issue
Block a user