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: create and export UsageLimitedChatService #1182

Merged
merged 14 commits into from
Mar 15, 2025

Conversation

Awnder
Copy link
Contributor

@Awnder Awnder commented Mar 15, 2025

Create UsageLimitedChatService, register in PuterAIModule, and create check in AIChatService to set service to usage-limited-chat when user exceeds usage limit

@CLAassistant
Copy link

CLAassistant commented Mar 15, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Awnder
❌ Rishabh Shinde


Rishabh Shinde seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Awnder Awnder marked this pull request as ready for review March 15, 2025 01:03
@@ -363,49 +363,61 @@ class AIChatService extends BaseService {
parameters
};
await svc_event.emit('ai.prompt.validate', event);
if ( ! event.allow ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to remove these whitespace changes please? The changes here make this file inconsistent with other files in the same location.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RadoBoiii has fixed the whitespace issues in AIChatService and UsageLimitedChatService

});
} else {
// Normal fallback flow continues
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was fallback functionality tested after making this change?

I tested it, it's still working

if ( ! event.allowed ) {
throw new APIError('forbidden');

// Check if usage is not allowed or there's an error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these comments might confuse the purpose of the check_usage method. These comments imply check_usage verifies if use is allowed, but the meaning of "usage" here is the amount of extent of use (and specifically, whether the user has gone over the usage limit)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed comments to better reflect what check_usage does. Let me know if these work!

@KernelDeimos
Copy link
Contributor

Record of manual test (1.7x speed)

pr-1182_1.7x.mp4

.gitignore Outdated
@@ -30,3 +30,5 @@ dist/
# Local Netlify folder
.netlify
src/emulator/release/
.qodo
test-app
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to remove the test-app from the gitignore

@KernelDeimos
Copy link
Contributor

Thanks for making the requested changes! I'm merging this now

@KernelDeimos KernelDeimos merged commit bf3d63a into HeyPuter:main Mar 15, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants