Automattic / studio

Studio by WordPress.com, a free desktop app that helps developers streamline their local WordPress development workflow.
https://developer.wordpress.com/studio/
GNU General Public License v2.0
138 stars 12 forks source link

Studio: Implement disable chat UI when the user reaches prompt limit #266

Closed katinthehatsite closed 6 days ago

katinthehatsite commented 1 week ago

Closes https://github.com/Automattic/dotcom-forge/issues/7761

Proposed Changes

This PR adds UI for the case when the user has reached the limit of prompts. When the chat is new:

Screenshot 2024-06-18 at 3 49 45 PM

When the user has previous messages in chat:

Screenshot 2024-06-18 at 3 49 38 PM

Testing Instructions

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 );
                        }

Pre-merge Checklist

katinthehatsite commented 1 week ago

Please note that I have not disabled Clear conversation button in the UI. I am not sure if it should disabled? I see both sides: the user should be able to clear stored conversation but it might give an impression to the user that by doing that, they will reset the prompts. Any thoughts?

matt-west commented 1 week ago

Please note that I have not disabled Clear conversation button in the UI. I am not sure if it should disabled? I see both sides: the user should be able to clear stored conversation but it might give an impression to the user that by doing that, they will reset the prompts. Any thoughts?

I think it makes sense to keep the Clear conversation button accessible.