Skip to content

Commit

Permalink
Merge pull request #278 from gentlementlegen/fix/spec-prio-multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 authored Feb 18, 2025
2 parents bf23ebc + 41bae52 commit 4b91261
Show file tree
Hide file tree
Showing 11 changed files with 9,980 additions and 9,974 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dist/** linguist-generated
bun.lockb linguist-generated
bun.lockb linguist-generated
bun.lock linguist-generated
test/__mocks__/ linguist-generated
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ At the heart of the system is a content evaluation module that assigns monetary
- Removes user commands (starting with /) and bot responses
- Filters out quoted text (starting with >)
- Removes HTML comments and footnotes
- For assigned users, considers comment timestamps to optionally exclude those posted during assignment periods, to reduce gaming
- For assigned users, considers comment timestamps to optionally exclude those posted during assignment periods, to reduce gaming
- Processes linked pull request comments through GraphQL API
- Handles minimized/hidden comments
- Credits only unique links to prevent duplicates
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions src/parser/content-evaluator-module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { TypeBoxError } from "@sinclair/typebox";
import { Value } from "@sinclair/typebox/value";
import { postComment } from "@ubiquity-os/plugin-sdk";
import Decimal from "decimal.js";
import { encodingForModel } from "js-tiktoken";
import ms, { StringValue } from "ms";
import OpenAI from "openai";
import { commentEnum, CommentKind, CommentType } from "../configuration/comment-types";
import { CommentAssociation, commentEnum, CommentKind, CommentType } from "../configuration/comment-types";
import { ContentEvaluatorConfiguration } from "../configuration/content-evaluator-config";
import { retry } from "../helpers/retry";
import { IssueActivity } from "../issue-activity";
import {
AllComments,
Expand All @@ -15,10 +19,6 @@ import {
import { BaseModule } from "../types/module";
import { ContextPlugin } from "../types/plugin-input";
import { GithubCommentScore, Result } from "../types/results";
import { postComment } from "@ubiquity-os/plugin-sdk";
import { retry } from "../helpers/retry";
import ms, { StringValue } from "ms";
import { TypeBoxError } from "@sinclair/typebox";

/**
* Evaluates and rates comments.
Expand Down Expand Up @@ -139,7 +139,11 @@ export class ContentEvaluatorModule extends BaseModule {
}

const currentReward = new Decimal(currentComment.score?.reward ?? 0);
const priority = currentComment.score?.priority ?? 1;
const priority =
// We do not apply priority multiplier on issue specification
currentComment.score?.priority && !(currentComment.type & CommentAssociation.SPECIFICATION)
? currentComment.score.priority
: 1;

currentComment.score = {
...(currentComment.score || { multiplier: 0 }),
Expand Down
3,674 changes: 1,837 additions & 1,837 deletions tests/__mocks__/results/content-evaluator-results.json

Large diffs are not rendered by default.

4,110 changes: 2,055 additions & 2,055 deletions tests/__mocks__/results/event-incentives-results.json

Large diffs are not rendered by default.

4,114 changes: 2,057 additions & 2,057 deletions tests/__mocks__/results/github-comment-results.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/__mocks__/results/output.html

Large diffs are not rendered by default.

4,110 changes: 2,055 additions & 2,055 deletions tests/__mocks__/results/permit-generation-results.json

Large diffs are not rendered by default.

3,916 changes: 1,958 additions & 1,958 deletions tests/__mocks__/results/review-incentivizer-results.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/process.issue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import dbSeed from "./__mocks__/db-seed.json";
import { server } from "./__mocks__/node";
import contentEvaluatorResults from "./__mocks__/results/content-evaluator-results.json";
import dataPurgeResults from "./__mocks__/results/data-purge-result.json";
import eventincentivesResults from "./__mocks__/results/event-incentives-results.json";
import eventIncentivesResults from "./__mocks__/results/event-incentives-results.json";
import formattingEvaluatorResults from "./__mocks__/results/formatting-evaluator-results.json";
import githubCommentResults from "./__mocks__/results/github-comment-results.json";
import githubCommentAltResults from "./__mocks__/results/github-comment-zero-results.json";
Expand Down Expand Up @@ -314,7 +314,7 @@ describe("Modules tests", () => {
];
await processor.run(activity);
const result = JSON.parse(processor.dump());
expect(result).toEqual(eventincentivesResults);
expect(result).toEqual(eventIncentivesResults);
});

it("Should generate permits", async () => {
Expand Down

0 comments on commit 4b91261

Please sign in to comment.