Skip to content

Commit

Permalink
fix: stemDict에서 현재 브랜치의 node에서 커밋을 가져오도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
choisohyun committed Aug 31, 2024
1 parent 500f674 commit d73a815
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/analysis-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions packages/analysis-engine/src/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d73a815

Please sign in to comment.