diff --git a/src/app/(main)/_components/PreviewPage.tsx b/src/app/(main)/_components/PreviewPage.tsx index 01cf314..ab4c071 100644 --- a/src/app/(main)/_components/PreviewPage.tsx +++ b/src/app/(main)/_components/PreviewPage.tsx @@ -54,7 +54,7 @@ const PreviewPage = ({ logId }: { logId: string }) => { const onSummarizeClicked = async () => { try { setSummaryLoading(true); - const summary = await logService.getSummary(apiKey!, previewLog?.data!) + const summary = await logService.getSummary(apiKey!, previewLog!) previewLog!.summary = summary!; logService.updateLog(logId, previewLog!); } catch (error) { diff --git a/src/app/(main)/_services/logService.ts b/src/app/(main)/_services/logService.ts index 82f151d..127387f 100644 --- a/src/app/(main)/_services/logService.ts +++ b/src/app/(main)/_services/logService.ts @@ -192,13 +192,13 @@ class LogService { } } - getSummary = async (apiKey: string, text: string) => { + getSummary = async (apiKey: string, log: Log) => { try { const genAI = new GoogleGenerativeAI(apiKey!); const model = genAI.getGenerativeModel({ model: "gemini-pro" }); - const prompt = "Summarize the following text: " + text; + const prompt = `Summarize the following text by taking the title: ${log.title} and its description:` + log.data; const result = await model.generateContent(prompt); const response = await result.response;