-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat: create and export UsageLimitedChatService #1182
Conversation
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. |
@@ -363,49 +363,61 @@ class AIChatService extends BaseService { | |||
parameters | |||
}; | |||
await svc_event.emit('ai.prompt.validate', event); | |||
if ( ! event.allow ) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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!
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 |
There was a problem hiding this comment.
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
tweak: correct mistake on removing extra enter This reverts commit e066e29.
Thanks for making the requested changes! I'm merging this now |
Create UsageLimitedChatService, register in PuterAIModule, and create check in AIChatService to set service to usage-limited-chat when user exceeds usage limit