Skip to content

Commit

Permalink
chore(WIP): missing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Oct 11, 2024
1 parent 321a62c commit c808820
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions src/parser/content-evaluator-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,26 +180,39 @@ export class ContentEvaluatorModule implements Module {
allComments: AllComments,
prComments: PrCommentToEvaluate[]
): Promise<Relevances> {
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<Relevances> {
Expand Down

0 comments on commit c808820

Please sign in to comment.