Chat_AI / services /gemini.ts
muhammad1707's picture
Move master code to main
00e44ef
Raw
History Blame Contribute Delete
464 Bytes
// src/services/gemini.ts
export async function summarizeText(text: string): Promise<string> {
const res = await fetch("http://localhost:4000/summarize", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ text }),
});
const data = await res.json();
console.log("Gemini API response data:", data);
if (!res.ok) throw new Error(data.error || "Unexpected error");
return data.summary;
}