Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: symbol coefficients and configurable scores per group #68

Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
93ccc25
feat: html score is now based per select item
gentlementlegen Jul 23, 2024
baf7746
chore: fixed tests
gentlementlegen Jul 23, 2024
44904a9
chore: fixed tests
gentlementlegen Jul 23, 2024
45489d3
feat: multipliers are based on symbols representing a regex
gentlementlegen Jul 23, 2024
c345948
chore: fixing tests
gentlementlegen Jul 24, 2024
a372bab
chore: fixing tests
gentlementlegen Jul 24, 2024
5046c14
chore: fixing tests
gentlementlegen Jul 24, 2024
39bd186
chore: fixing tests
gentlementlegen Jul 24, 2024
c92d0a5
chore: fixing tests
gentlementlegen Jul 24, 2024
6a4d9f6
chore: fixing tests
gentlementlegen Jul 24, 2024
eca0aa0
chore: fixing tests
gentlementlegen Jul 24, 2024
d170c9f
chore: fixing tests
gentlementlegen Jul 24, 2024
b8c83c0
chore: fixing tests
gentlementlegen Jul 24, 2024
c2e9443
chore: updated README.md
gentlementlegen Jul 24, 2024
44bb136
chore: merge develop
gentlementlegen Jul 26, 2024
6a9361f
chore: default configuration to null
gentlementlegen Jul 26, 2024
23bc825
chore: fixed README.md and infinite division
gentlementlegen Jul 26, 2024
73458ba
chore: updated README.md
gentlementlegen Jul 26, 2024
5ec57f7
chore: changed total count
gentlementlegen Jul 26, 2024
1e5aedb
chore: optional formatting evaluator
gentlementlegen Jul 26, 2024
1e42677
chore: log configuration
gentlementlegen Jul 26, 2024
5717dc3
chore: log configuration
gentlementlegen Jul 26, 2024
8bf00cc
chore: null defaults for configuration
gentlementlegen Jul 26, 2024
7a64286
chore: null defaults for configuration
gentlementlegen Jul 26, 2024
e92faf0
Merge branch 'refs/heads/feat/symbol-coefficient' into fix/undefined-…
gentlementlegen Jul 26, 2024
af63549
chore: changed error message for module configuration
gentlementlegen Jul 26, 2024
c155eed
Merge branch 'development' into feat/symbol-coefficient
gentlementlegen Jul 29, 2024
027af97
chore: fix merge
gentlementlegen Jul 29, 2024
20f123d
chore: removed default configuration merging
gentlementlegen Jul 30, 2024
89237e6
Update src/configuration/incentives.ts
gentlementlegen Jul 30, 2024
20bd994
chore: merged fixes
gentlementlegen Aug 5, 2024
f892bc9
Merge branch 'development' into feat/symbol-coefficient
gentlementlegen Aug 15, 2024
61f8ec0
chore: new schema (WIP)
gentlementlegen Aug 15, 2024
6749a5f
Merge branch 'fix/undefined-configuration' into feat/symbol-coefficient
gentlementlegen Aug 15, 2024
5117a4f
chore: fixed mock for valid configuration
gentlementlegen Aug 15, 2024
90bc3a8
chore: fix tests for split reward
gentlementlegen Aug 15, 2024
c11ebc3
chore: fix tests
gentlementlegen Aug 15, 2024
db0b6ec
chore: added default missing objects in README.md
gentlementlegen Aug 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 97 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Be sure to review all `*.test.*` files for implementation details.
}
},
"wordValue": 0.1,
"formattingMultiplier": 1
"multiplier": 1
},
"reward": 0.8,
"relevance": 0.5
Expand All @@ -42,7 +42,7 @@ Be sure to review all `*.test.*` files for implementation details.
}
```

Reward formula: `((count * wordValue) * (score * formattingMultiplier) * n) * relevance + task.reward = total`
Reward formula: `((count * wordValue) * (score * multiplier) * n) * relevance + task.reward = total`

## Plugin configuration

Expand All @@ -51,79 +51,101 @@ Here is a possible valid configuration to enable this plugin. See [these files](
```yaml
plugin: ubiquibot/conversation-rewards
with:
evmNetworkId: 100
evmPrivateEncrypted: "encrypted-key"
erc20RewardToken: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
dataCollection:
maxAttempts: 10
delayMs: 10000
incentives:
requirePriceLabel: true
contentEvaluator:
userExtractor:
redeemTask: true
dataPurge:
formattingEvaluator:
multipliers:
- select: [ISSUE_SPECIFICATION]
formattingMultiplier: 1
symbols:
"\\b\\w+\\b": 0.1
scores: # Scores can be set for each item differently
br: 0
code: 1
p: 1
em: 0
img: 0
strong: 0
blockquote: 0
h1: 1
h2: 1
h3: 1
h4: 1
h5: 1
h6: 1
a: 1
li: 1
td: 1
hr: 0
- select: [ ISSUE_AUTHOR ]
formattingMultiplier: 1
symbols:
"\\b\\w+\\b": 0.2
- select: [ ISSUE_ASSIGNEE ]
formattingMultiplier: 0
symbols:
"\\b\\w+\\b": 0
- select: [ ISSUE_COLLABORATOR ]
formattingMultiplier: 1
symbols:
"\\b\\w+\\b": 0.1
- select: [ ISSUE_CONTRIBUTOR ]
formattingMultiplier: 0.25
symbols:
"\\b\\w+\\b": 0.1
- select: [ PULL_SPECIFICATION ]
formattingMultiplier: 0
symbols:
"\\b\\w+\\b": 0
- select: [ PULL_AUTHOR ]
formattingMultiplier: 2
symbols:
"\\b\\w+\\b": 0.2
- select: [ PULL_ASSIGNEE ]
formattingMultiplier: 1
symbols:
"\\b\\w+\\b": 0.1
- select: [ PULL_COLLABORATOR ]
formattingMultiplier: 1
symbols:
"\\b\\w+\\b": 0.1
- select: [ PULL_CONTRIBUTOR ]
formattingMultiplier: 0.25
symbols:
"\\b\\w+\\b": 0.1
permitGeneration:
evmNetworkId: 100
evmPrivateEncrypted: "encrypted-key"
erc20RewardToken: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
dataCollection:
maxAttempts: 10
delayMs: 10000
incentives:
requirePriceLabel: true
contentEvaluator:
multipliers:
- role: [ISSUE_SPECIFICATION]
relevance: 1
- role: [PULL_AUTHOR]
relevance: 1
- role: [PULL_ASSIGNEE]
relevance: 1
- role: [PULL_COLLABORATOR]
relevance: 1
- role: [PULL_CONTRIBUTOR]
relevance: 1
userExtractor:
redeemTask: true
dataPurge: {}
formattingEvaluator:
multipliers:
- role: [ ISSUE_SPECIFICATION ]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
scores: # Scores can be set for each item differently
br: 0
code: 1
p: 1
em: 0
img: 0
strong: 0
blockquote: 0
h1: 1
h2: 1
h3: 1
h4: 1
h5: 1
h6: 1
a: 1
li: 1
ul: 1
td: 1
hr: 0
- role: [ISSUE_AUTHOR]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.2
- role: [ISSUE_ASSIGNEE]
multiplier: 0
rewards:
regex:
"\\b\\w+\\b": 0
- role: [ISSUE_COLLABORATOR]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ISSUE_CONTRIBUTOR]
multiplier: 0.25
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [PULL_SPECIFICATION]
multiplier: 0
rewards:
regex:
"\\b\\w+\\b": 0
- role: [PULL_AUTHOR]
multiplier: 2
rewards:
regex:
"\\b\\w+\\b": 0.2
- role: [PULL_ASSIGNEE]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [PULL_COLLABORATOR]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [PULL_CONTRIBUTOR]
multiplier: 0.25
rewards:
regex:
"\\b\\w+\\b": 0.1
permitGeneration: {}
githubComment:
post: true
debug: false
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"dotenv": "16.4.5",
"ethers": "^6.13.0",
"jsdom": "24.0.0",
"lodash": "4.17.21",
"markdown-it": "14.1.0",
"openai": "4.29.1",
"tsx": "4.7.1",
Expand Down
9 changes: 4 additions & 5 deletions src/configuration/config-reader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Value } from "@sinclair/typebox/value";
import { merge } from "lodash";
import program from "../parser/command-line";
import { IncentivesConfiguration, incentivesConfigurationSchema, validateIncentivesConfiguration } from "./incentives";

Expand All @@ -12,10 +11,10 @@ try {
}

if (program.settings) {
const settings = merge(
configuration,
Value.Default(incentivesConfigurationSchema, JSON.parse(program.settings)) as IncentivesConfiguration
);
const settings = Value.Default(
incentivesConfigurationSchema,
JSON.parse(program.settings)
) as IncentivesConfiguration;
if (validateIncentivesConfiguration.test(settings)) {
configuration = Value.Decode(incentivesConfigurationSchema, settings);
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/configuration/content-evaluator-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ export const contentEvaluatorConfigurationType = Type.Object({
*/
multipliers: Type.Array(
Type.Object({
select: Type.Array(commentType),
role: Type.Array(commentType),
relevance: Type.Optional(Type.Number()),
}),
{
default: [
{
select: ["ISSUE_SPECIFICATION"],
role: ["ISSUE_SPECIFICATION"],
relevance: 1,
},
{
select: ["PULL_AUTHOR"],
role: ["PULL_AUTHOR"],
relevance: 1,
},
{
select: ["PULL_ASSIGNEE"],
role: ["PULL_ASSIGNEE"],
relevance: 1,
},
{
select: ["PULL_COLLABORATOR"],
role: ["PULL_COLLABORATOR"],
relevance: 1,
},
{
select: ["PULL_CONTRIBUTOR"],
role: ["PULL_CONTRIBUTOR"],
relevance: 1,
},
],
Expand Down
Loading
Loading