-
Notifications
You must be signed in to change notification settings - Fork 514
feat(ui):Add max cost auto-approval setting similar to max requests #1271
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?
Conversation
|
5188ed1
to
f59c0d7
Compare
ef2d4cc
to
230a9e0
Compare
7e6ba04
to
22ebf4e
Compare
9a86012
to
f954f97
Compare
ee1af7a
to
4d44377
Compare
f954f97
to
0cb992b
Compare
4d44377
to
978cccf
Compare
Introduces a new `DecoratedVSCodeTextField` component that wraps the standard VSCode text field and allows for the addition of left and right nodes (e.g., icons, currency symbols). This enhances the flexibility and visual presentation of text input fields within the UI. The component includes: - Support for `leftNodes` and `rightNodes` to display content inside the text field. - Automatic padding adjustment based on the presence of nodes. - Storybook stories demonstrating various use cases (price input, search input). - Unit tests to ensure proper rendering and functionality of the component with and without nodes.
This commit introduces a new auto-approval setting that allows users to define a maximum API cost. The system will automatically approve requests up to this cost limit before prompting the user for approval to continue the task. Key changes include: - Added `allowedMaxCost` to `globalSettingsSchema` in `@packages/types`. - Implemented cost tracking and limit enforcement in `Task.ts`. - Integrated `allowedMaxCost` into `ClineProvider` and `webviewMessageHandler` for state management. - Created new UI components `CostInput`, `FormattedTextField`, and `MaxLimitInputs` in `webview-ui` to handle cost input and formatting. - Updated `AutoApproveMenu` and `AutoApproveSettings` to include the new cost limit input. - Added new Storybook stories for `AutoApproveMenu` and `AutoApproveSettings`. - Included new test files for `FormattedTextField` and `MaxCostInput`. - Updated i18n localization files across all supported languages to include new strings for the API cost limit setting.
Refactors `DecoratedVSCodeTextField` to extend `ComponentProps<typeof VSCodeTextField>`, removing redundant prop definitions and simplifying its interface. This change improves maintainability and ensures consistency with the underlying VSCode text field component. Also adjusts `FormattedTextField` to correctly forward refs with the updated prop types.
Removed redundant description props from MaxCostInput and MaxRequestsInput components. The common description for both API limits is now handled in MaxLimitInputs, improving consistency and reducing duplication across i18n files.
This commit enhances the auto-approval warning system to distinguish between reaching the request limit and the cost limit. - **`src/core/task/Task.ts`**: Modified to pass a `type` parameter (`"requests"` or `"cost"`) to the `ask` method when the auto-approval limit is reached. - **`webview-ui/src/components/chat/AutoApprovedRequestLimitWarning.tsx`**: Updated to use the new `type` parameter to dynamically select appropriate i18n keys for title, description, and button text, providing clearer messages to the user. - **`webview-ui/src/components/settings/MaxCostInput.tsx`**: Refactored to use a new `FormattedTextField` component, simplifying input handling and validation for the max cost setting. This change removes redundant state management and event handlers. - **`webview-ui/src/components/settings/__tests__/MaxCostInput.spec.tsx`**: Updated tests to reflect the changes in `MaxCostInput`, specifically removing tests related to blur/enter events and focusing on direct value changes. - **`webview-ui/src/i18n/locales/*/chat.json`**: Added new translation keys (`autoApprovedCostLimitReached.title`, `description`, `button`) across all supported languages to support the cost limit warning. This change improves user clarity and experience by providing specific feedback when either the request count or the monetary cost limit for auto-approved actions is reached.
06ea770
to
aa58ea4
Compare
Introduces the `allowedMaxCost` setting to control the maximum cost allowed for auto-approved requests. This change includes: - Adding `allowedMaxCost` to `GlobalSettingsSchema`, `ExtensionState`, and `WebviewMessage` types. - Updating `Task.ts` to track `consecutiveAutoApprovedCost`. - Modifying `ClineProvider.ts` to handle `allowedMaxCost` in state management. - Updating `webviewMessageHandler.ts` to process `allowedMaxCost` messages. - Creating new UI components `MaxCostInput.tsx` and `MaxLimitInputs.tsx` for the setting. - Enhancing `FormattedTextField.tsx` with `unlimitedDecimalFormatter` for cost input. - Updating `AutoApproveMenu.tsx` and `SettingsView.tsx` to integrate the new cost limit input. - Adjusting `AutoApprovedRequestLimitWarning.tsx` to differentiate between request and cost limits. - Adding `kilocode_change` markers where necessary for upstream compatibility.
aa58ea4
to
dd700ff
Compare
Add a new Max cost field similar to the 'max request count' field we already have.