-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add Chat Limits Feature #2209
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
base: main
Are you sure you want to change the base?
Add Chat Limits Feature #2209
Conversation
@defsanmith is attempting to deploy a commit to the Typebot Team on Vercel. A member of the Team first needs to authorize it. |
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Please note that these changes do not change the |
Add Chat Limits Feature
Closes #1952
This PR introduces a comprehensive chat limits feature that allows typebot owners to configure limits per day/week/month/total for their typebots. Once the configured limit is reached, new chat sessions are blocked and users see a "bot closed" message. This feature helps manage resource usage and provides better control over typebot interactions.
Changes Made
1. Schema Updates
File:
/packages/settings/src/schemas.ts
chatLimitsSchema
with validation for chat limits configurationisEnabled
,limit
, andlimitType
fieldslimit >= 0
(where 0 means unlimited)2. Constants Updates
File:
/packages/settings/src/constants.ts
defaultSettings
3. UI Component Implementation
File:
/apps/builder/src/features/settings/components/GeneralSettingsForm.tsx
4. Translation Support
File:
/apps/builder/src/i18n/en.json
5. Backend Logic Implementation
File:
/packages/bot-engine/src/startSession.ts
7. Database Query Support
File:
/packages/bot-engine/src/queries/countResults.ts
8. Comprehensive Test Coverage
File:
/apps/viewer/src/test/chatLimits.spec.ts
createTypebots()
helper function for consistent test setupparseDefaultGroupWithBlock()
for proper typebot structure