From c8088204a1b19704a017cf353c5b42379d2c0275 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Fri, 11 Oct 2024 14:55:13 +0900 Subject: [PATCH] chore(WIP): missing tags --- src/parser/content-evaluator-module.ts | 51 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/src/parser/content-evaluator-module.ts b/src/parser/content-evaluator-module.ts index 3d186005..4aecffa7 100644 --- a/src/parser/content-evaluator-module.ts +++ b/src/parser/content-evaluator-module.ts @@ -180,26 +180,39 @@ export class ContentEvaluatorModule implements Module { allComments: AllComments, prComments: PrCommentToEvaluate[] ): Promise { - let commentRelevances: Relevances = {}; - let prCommentRelevances: Relevances = {}; - - if (comments.length) { - const dummyResponse = JSON.stringify(this._generateDummyResponse(comments), null, 2); - const maxTokens = this._calculateMaxTokens(dummyResponse); - - const promptForComments = this._generatePromptForComments(specification, comments, allComments); - commentRelevances = await this._submitPrompt(promptForComments, maxTokens); - } - - if (prComments.length) { - const dummyResponse = JSON.stringify(this._generateDummyResponse(prComments), null, 2); - const maxTokens = this._calculateMaxTokens(dummyResponse); - - const promptForPrComments = this._generatePromptForPrComments(specification, prComments); - prCommentRelevances = await this._submitPrompt(promptForPrComments, maxTokens); - } + // let commentRelevances: Relevances = {}; + // let prCommentRelevances: Relevances = {}; + + return Promise.resolve( + (() => { + const relevance: { [k: string]: number } = {}; + comments.forEach((comment) => { + relevance[`${comment.id}`] = 0.8; + }); + prComments.forEach((comment) => { + relevance[`${comment.id}`] = 0.7; + }); + return relevance; + })() + ); - return { ...commentRelevances, ...prCommentRelevances }; + // if (comments.length) { + // const dummyResponse = JSON.stringify(this._generateDummyResponse(comments), null, 2); + // const maxTokens = this._calculateMaxTokens(dummyResponse); + // + // const promptForComments = this._generatePromptForComments(specification, comments, allComments); + // commentRelevances = await this._submitPrompt(promptForComments, maxTokens); + // } + // + // if (prComments.length) { + // const dummyResponse = JSON.stringify(this._generateDummyResponse(prComments), null, 2); + // const maxTokens = this._calculateMaxTokens(dummyResponse); + // + // const promptForPrComments = this._generatePromptForPrComments(specification, prComments); + // prCommentRelevances = await this._submitPrompt(promptForPrComments, maxTokens); + // } + // + // return { ...commentRelevances, ...prCommentRelevances }; } async _submitPrompt(prompt: string, maxTokens: number): Promise {