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

Studio: Disable text input if the limit is reached UI and update to new headers #244

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

kozer
Copy link
Contributor

@kozer kozer commented Jun 12, 2024

Fixes https://github.com/Automattic/dotcom-forge/issues/7420

Proposed Changes

This PR updates the app to use the new quota headers.
It is also use those quotas to disable user input

Testing Instructions

  • Apply the following diff:
index 282b02a..9a119e1 100644
--- a/src/hooks/use-prompt-usage.tsx
+++ b/src/hooks/use-prompt-usage.tsx
@@ -46,7 +46,7 @@ export function PromptUsageProvider( { children }: PromptUsageProps ) {
                                return;
                        }
                        setPromptLimit( limit );
-                       setPromptCount( limit - remaining );
+                       setPromptCount( limit );
                        if ( ! initiated ) {
                                setInitiated( true );
                        }
  1. Navigate to Assistant tab.
  2. Ensure that input is disabled.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@kozer kozer requested a review from a team June 12, 2024 17:25
@kozer kozer self-assigned this Jun 12, 2024
@kozer kozer changed the title Fix/quota disable input Studio: Disable text input if the limit is reached UI and update to new headers Jun 12, 2024
Copy link
Contributor

@jeroenpf jeroenpf left a comment

Choose a reason for hiding this comment

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

Nice work! I see the quota updated in the UI when i interact with the AI. Also, when I apply the diff, i can no longer use the AI assistant.

We should have some feedback in the assistant tab to let the user know they can't send more messages because they reached the quota. What do you think?

CleanShot 2024-06-13 at 22 41 27@2x

@matt-west
Copy link
Contributor

matt-west commented Jun 13, 2024

@jeroenpf @kozer We have some designs for that here.

image

@kozer
Copy link
Contributor Author

kozer commented Jun 14, 2024

@matt-west , @jeroenpf I'll create a new ticket for the designs, as now that the old HEAD request is missing it "breaks" Studio app.

@kozer kozer merged commit ed27130 into trunk Jun 14, 2024
13 checks passed
@kozer kozer deleted the fix/quota_disable_input branch June 14, 2024 06:57
@kozer
Copy link
Contributor Author

kozer commented Jun 14, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants