From 500f6741f85af0237606191e19d58e7411c638a6 Mon Sep 17 00:00:00 2001 From: choisohyun Date: Sat, 31 Aug 2024 17:08:35 +0900 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20gitignore=EC=97=90=20.env=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/analysis-engine/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/analysis-engine/.gitignore b/packages/analysis-engine/.gitignore index 0e75fe55..6667779e 100644 --- a/packages/analysis-engine/.gitignore +++ b/packages/analysis-engine/.gitignore @@ -1,3 +1,4 @@ node_modules dist coverage +.env From d73a815efa2a0647424d44286991364973ebbf7a Mon Sep 17 00:00:00 2001 From: choisohyun Date: Sat, 31 Aug 2024 17:09:28 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20stemDict=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=ED=98=84=EC=9E=AC=20=EB=B8=8C=EB=9E=9C=EC=B9=98=EC=9D=98=20nod?= =?UTF-8?q?e=EC=97=90=EC=84=9C=20=EC=BB=A4=EB=B0=8B=EC=9D=84=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/analysis-engine/src/index.ts | 3 ++- packages/analysis-engine/src/summary.ts | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/analysis-engine/src/index.ts b/packages/analysis-engine/src/index.ts index 582769a2..f6de204b 100644 --- a/packages/analysis-engine/src/index.ts +++ b/packages/analysis-engine/src/index.ts @@ -75,7 +75,8 @@ export class AnalysisEngine { if (this.isDebugMode) console.log("stemDict: ", stemDict); const csmDict = buildCSMDict(commitDict, stemDict, this.baseBranchName, pullRequests); if (this.isDebugMode) console.log("csmDict: ", csmDict); - const geminiCommitSummary = await getSummary(commitRaws?.slice(-10) ?? []); + const nodes = stemDict.get(this.baseBranchName)?.nodes?.map(({commit}) => commit); + const geminiCommitSummary = await getSummary(nodes ? nodes?.slice(-10) : []); if (this.isDebugMode) console.log("GeminiCommitSummary: ", geminiCommitSummary); return { diff --git a/packages/analysis-engine/src/summary.ts b/packages/analysis-engine/src/summary.ts index 628eeb98..2b91fe4f 100644 --- a/packages/analysis-engine/src/summary.ts +++ b/packages/analysis-engine/src/summary.ts @@ -4,9 +4,8 @@ const apiKey = process.env.GEMENI_API_KEY || ''; const apiUrl = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key="; export async function getSummary(csmNodes: CommitRaw[]) { - const commitMessages = csmNodes.map((csmNode) => csmNode.message).join(', '); + const commitMessages = csmNodes.map((csmNode) => csmNode.message.split('\n')[0]).join(', '); - console.log(commitMessages, 'apiKey'); try { const response = await fetch(apiUrl + apiKey, { method: "POST",