pasted all my ai file

This commit is contained in:
Rainyy21
2025-11-08 20:39:17 -05:00
parent 4578f446fc
commit efaba0d319
12 changed files with 1171 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import { NextResponse } from "next/server";
import { chatToGemini } from "@/app/utils/geminiHelper";
import { ChatHistory, ChatSetting } from "@/app/exportType/types";
export async function POST(request: Request) {
try {
const { userMessage, history , settings } = await request.json() as {
userMessage :string;
history : ChatHistory;
settings : ChatSetting;
};
const aiResponse = await chatToGemini(userMessage , history, settings);
return NextResponse.json({response : aiResponse});
}
catch(error){
console.error(error);
return NextResponse.json(
{error: "Error with the model response "},
{status : 500}
);
}
}