Closed jaykayudo closed 1 week ago
@0x4007 I have added tests. Also wouldn't this new change also imply that the html output mocks in the tests folder be modified as well?
@0x4007 @gentlementlegen Please review this PR. I just made changes.
Please post QA
I have Posted QA as well
QA added to fees.test.ts
I mean run it and share a link to the GitHub comment
I mean run it and share a link to the GitHub comment
Could you guide me through the process of running it on github. I have only been able to successfully run the tests locally.
I mean run it and share a link to the GitHub comment
Could you guide me through the process of running it on github. I have only been able to successfully run the tests locally.
You should install an app on your own organization or account, then run https://github.com/ubiquity-os/ubiquity-os-kernel locally so events are dispatched, and finally the plugin will run. Find more doc here.
You should install an app on your own organization or account, then run https://github.com/ubiquity-os/ubiquity-os-kernel locally so events are dispatched, and finally the plugin will run. Find more doc here.
I have installed my app and ran the kernel but i am still confused on how to run this plugin. could you clarify this more for me? @gentlementlegen
@UbiquityOS Explain how to install and run the kernel, and install text-conversation-rewards
plugin.
! 413 Request Entity Too Large
@UbiquityOS Explain how to install and run the kernel, and install text-conversation-rewards plugin, in a short way.
! 413 Request Entity Too Large
@jaykayudo You will need to add this plugin in your configuration so the kernel can call it, like so https://github.com/ubiquity-os-marketplace/text-conversation-rewards?tab=readme-ov-file#plugin-configuration
Then on your repo once you close an issue, it will trigger a run.
@gentlementlegen I am still having some issues so i am going to share the steps i took so please help me point where i might have made a mistake
feat/new-fee-column
(not the development
branch) in the .github/.ubiquity-os.config.dev.yml
file.
status: 404,
request: {
method: 'GET',
url:
'https://api.github.com/repos/codebestiatestorg/.ubiquity-os/contents/.github%2F.ubiquity-os.config.dev.yml',
headers: {
accept: 'application/vnd.github.v3.raw',
'user-agent': 'octokit-core.js/6.1.2
Cloudflare-Workers',
authorization: 'token [REDACTED]'
},
request: { hook: [Function: bound bound register] }
},
response: {
url:
'https://api.github.com/repos/codebestiatestorg/.ubiquity-os/contents/.github%2F.ubiquity-os.config.dev.yml',
status: 404,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location,
Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining,
X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes,
X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO,
X-GitHub-Request-Id, Deprecation, Sunset',
'content-length': '127',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Fri, 25 Oct 2024 17:01:05 GMT',
'referrer-policy': 'origin-when-cross-origin,
strict-origin-when-cross-origin',
server: 'github.com',
'strict-transport-security': 'max-age=31536000;
includeSubdomains; preload',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-github-permissions': 'contents=read',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-api-version-selected': '2022-11-28',
'x-github-media-type': 'github.v3; param=raw',
'x-github-request-id':
'5196:12F7EB:1DDA76:1F4DED:671BCED1',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4977',
'x-ratelimit-reset': '1729877827',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '23',
'x-xss-protection': '0'
},
data: {
message: 'Not Found',
documentation_url:
'https://docs.github.com/rest/repos/contents#get-repository-content',
status: '404'
}
}
}
✘ [ERROR] {
type: 42,
schema: {
additionalProperties: false,
type: 'object',
properties: { plugins: [Object] },
required: [ 'plugins' ],
[Symbol(TypeBox.Kind)]: 'Object'
},
path: '/plugin',
value: 'ubiquity-os/conversation-rewards',
message: 'Unexpected property'
}
{
type: 42,
schema: {
additionalProperties: false,
type: 'object',
properties: { plugins: [Object] },
required: [ 'plugins' ],
[Symbol(TypeBox.Kind)]: 'Object'
},
path: '/with',
value: {
logLevel: 'info',
evmNetworkId: 100,
evmPrivateEncrypted: 'encrypted-key',
erc20RewardToken: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
dataCollection: { maxAttempts: 10, delayMs: 10000 },
incentives: {
requirePriceLabel: true,
contentEvaluator: [Object],
userExtractor: [Object],
dataPurge: {},
formattingEvaluator: [Object]
}
},
message: 'Unexpected property'
}
Error decoding configuration for codebestiatestorg/conversation-rewards, will
ignore. TransformDecodeCheckError: Unable to decode value as it does not match
the expected schema
! 413 Request Entity Too Large
@sshivaditya
@UbiquityOS Explain how to install and run the kernel, and install text-conversation-rewards plugin, in a short way.
This query afaik probably wouldn't work, it pulls the repo readme into the conversation to understand setup instructions. I've not seeded my DB and investigated (I assume reviewers have done this already and confirmed it's all good) what is being returned from the embedding-related search or what is stored in the DB so I may be mistaken here.
@jaykayudo here is a walkthrough by our LLM, but it looks like it's a yml
syntax error you are experiencing. yml
relies on indentation and it can be tricky some times. I too had issues with the configuration in this repo.
@gentlementlegen perhaps a helper CLI tool like kernel-telegram
has would be super helpful here?
! 413 Request Entity Too Large
The plug-in should not have run on a quoted comment also.
What I've seen is that it tried to diff the dist
folders which contain the compiled program (around 15 mb of code) which triggered this error.
Perhaps this strategy is valid:
Basically this strategy would start by excluding dist and likely other large changes like lock file etc. it will be able to include tens of small files dynamically though.
@UbiquityOS Explain how to install and run the kernel, and install text-conversation-rewards
plugin.
text-conversation-rewards
PluginTo set up the UbiquityOS kernel and install the text-conversation-rewards
plugin, follow the steps outlined below. This guide assumes you have basic knowledge of using Git, Node.js, and your terminal or command prompt.
Before proceeding, ensure you have the following installed on your system:
Begin by cloning the main kernel repository from GitHub.
git clone https://github.com/ubiquity-os/kernel.git
Navigate to the cloned directory:
cd kernel
Install the necessary dependencies using either npm
or yarn
.
Using npm:
npm install
Using yarn:
yarn install
Create a .env
file to store your environment-specific configurations. You can use the provided .env.example
as a template.
cp .env.example .env
Open the .env
file in your preferred text editor and populate it with the required values:
# Example .env file
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
ETHEREUM_NETWORK_ID=your_ethereum_network_id
ETHEREUM_PRIVATE_KEY=encryption_of_your_private_key
OPENAI_API_KEY=your_openai_api_key
PERMIT_FEE_RATE=20
Notes:
PERMIT_FEE_RATE
as needed (e.g., 20
for 20%).Compile the TypeScript code and prepare the application for running.
Using npm:
npm run build
Using yarn:
yarn build
Start the kernel application.
Using npm:
npm start
Using yarn:
yarn start
The kernel should now be running. You can verify its status by checking the console logs or accessing the relevant endpoints as configured.
text-conversation-rewards
PluginThe text-conversation-rewards
plugin enhances the kernel with reward functionalities based on text interactions. Follow these steps to install and configure it.
Assuming the kernel has a designated plugins
directory:
cd plugins
Clone the text-conversation-rewards
plugin into the plugins
directory.
git clone https://github.com/ubiquity-os-marketplace/text-conversation-rewards.git
Navigate to the plugin directory and install its dependencies.
Using npm:
cd text-conversation-rewards
npm install
Using yarn:
yarn install
Create a configuration file for the plugin, typically config.yml
, based on the provided specification.
# Example config.yml
plugin: ubiquity-os/conversation-rewards
with:
logLevel: "info"
evmNetworkId: 100
evmPrivateEncrypted: "your_encrypted_private_key"
erc20RewardToken: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
dataCollection:
maxAttempts: 10
delayMs: 10000
incentives:
requirePriceLabel: true
contentEvaluator:
openAi:
model: "gpt-4"
endpoint: "https://api.openai.com/v1"
multipliers:
- role: [ISSUE_SPECIFICATION, PULL_AUTHOR, PULL_ASSIGNEE, PULL_COLLABORATOR, PULL_CONTRIBUTOR]
relevance: 1
userExtractor:
redeemTask: true
dataPurge: {}
formattingEvaluator:
wordCountExponent: 0.85
multipliers:
- role: ["ISSUE_SPECIFICATION"]
multiplier: 1
rewards:
html:
br: { score: 0, countWords: true }
code: { score: 5, countWords: false }
# ... other HTML elements
wordValue: 0.1
# ... other roles
permitGeneration: {}
githubComment:
post: true
debug: false
Important Configuration Parameters:
evmPrivateEncrypted
ParameterTo securely store your Ethereum private key, follow these steps:
Obtain Your GitHub Owner ID:
Replace GITHUB_PAT_TOKEN
with your GitHub Personal Access Token.
curl -H "Accept: application/json" -H "Authorization: token GITHUB_PAT_TOKEN" https://api.github.com/orgs/ubiquity
Note the id
from the response.
Generate an Encrypted Key:
Visit Keygen.Ubq.fi and follow the instructions:
x25519_PRIVATE_KEY
.0x
prefix) and GitHub Owner ID in the format PRIVATE_KEY:GITHUB_OWNER_ID
into the PLAIN_TEXT
input.CIPHER_TEXT
.Update the Plugin Configuration:
Set the evmPrivateEncrypted
field in your config.yml
with the encrypted value obtained.
Set Environment Variables:
Add the X25519_PRIVATE_KEY
to your GitHub repository secrets to allow the plugin to decrypt the private key.
After configuring the plugin, navigate back to the root directory, rebuild the kernel to include the new plugin, and restart the application.
cd ../../
npm run build
npm start
Ensure that both the kernel and the text-conversation-rewards
plugin are running correctly:
Testing: Run the test suite to ensure everything is functioning as expected.
npm run test
Code Quality: Maintain code quality using ESLint and Prettier.
npm run lint
npm run format
Continuous Integration: Ensure GitHub Actions workflows are properly set up for automated testing and deployment.
Documentation: Refer to the UbiquityOS Documentation and the text-conversation-rewards
Plugin Documentation for more detailed information and advanced configurations.
By following these steps, you should have a fully functional UbiquityOS kernel integrated with the text-conversation-rewards
plugin, enhancing your project's interaction and reward mechanisms.
Pretty solid. Looks like very minor url hallucinations. Good job. Based on your reactions seems like that wasn't the output you expected.
Pretty solid. Looks like very minor url hallucinations. Good job. Based on your reactions seems like that wasn't the output you expected.
I expected it to be a lot less verbose. It still dumps out the entire thing.
@UbiquityOS Could you check the file src/parser/permit-generation-module.ts file and explain the changes ?
@UbiquityOS Could you check the file src/parser/permit-generation-module.ts file and explain the changes ?
No output because the API calls are rate-limited.
We should throw an error and comment that. I thought this was already the default behavior
We should throw an error and comment that. I thought this was already the default behavior
Add Comment to the issue also got rate limited, so it could not log the error to the comment.
@UbiquityOS Could you check the file src/parser/permit-generation-module.ts file and explain the changes ?
Certainly! Here's a detailed overview of the changes made to the src/parser/permit-generation-module.ts
file in Pull Request #161:
Before the Change:
result[key].feeRate = feeRateDecimal.toNumber();
feeRate
was being set directly from feeRateDecimal
, which represented the fee as a decimal (e.g., 0.2
for 20%). This caused confusion in subsequent calculations and displays, where a feeRate
of 20%
was incorrectly showing as 20
instead of 0.2
.After the Change:
result[key].feeRate = new Decimal(env.PERMIT_FEE_RATE).toNumber();
feeRate
is now directly assigned from the environment variable PERMIT_FEE_RATE
, which is expected to be a percentage value (e.g., 20
for 20%). This ensures that the fee rate is consistently represented as a percentage throughout the application.Original Logic:
feeRateDecimal
with the original reward. However, assigning the fee directly to total
led to incorrect fee deductions.Updated Logic:
feeRate
as a percentage, the calculations are clearer and more accurate. The total
now correctly reflects the amount after subtracting the fee, ensuring that rewards are calculated based on the intended fee structure.Changes in tests/__mocks__/results/output.html
:
<tr><td>Issue</td><td>Task</td><td>1</td><td>400</td></tr>
<tr><td>Issue</td><td>Task</td><td>1</td><td>400</td><td>-</td></tr>
<th>Fee</th>
column was added to the contributions overview table to display fee-related information clearly.Clarity: Displaying the feeRate
as a percentage (20%
) instead of a decimal (0.2
) makes the information more intuitive and aligns with common financial representations.
Accuracy: Ensuring that feeRate
is correctly represented prevents miscalculations in reward distributions and maintains the integrity of financial transactions within the system.
Consistency: By sourcing the feeRate
from an environment variable (env.PERMIT_FEE_RATE
), it allows for easier configuration and consistency across different environments (development, staging, production).
User Interface: Wrapping the <a/>
tags with spaces was also addressed to ensure proper spacing in HTML outputs, enhancing readability.
Future Maintenance: These changes pave the way for more accurate data handling and simplify future updates related to fee calculations and displays.
The primary modification in permit-generation-module.ts
ensures that the feeRate
is accurately represented and calculated as a percentage, enhancing both the clarity and correctness of fee-related operations. Additionally, corresponding updates in test outputs and HTML formatting improve the overall reliability and user experience of the application.
If you have any further questions or need additional clarification on these changes, feel free to ask!
I think we did hit some sort of Secondary Rate Limit for GQL Queries or something.
I wonder if we can fallback to github actions bot auth in extreme situations to comment the error
I wonder if we can fallback to github actions bot auth in extreme situations to comment the error
I agree with this, for extreme situations, the kernel should be be able to log a message/comment from where the even was invoked ?
@jaykayudo, this task has been idle for a while. Please provide an update.
Resolves https://github.com/ubiquity-os-marketplace/text-conversation-rewards/issues/161