File size: 464 Bytes
00e44ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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;
}