-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(settings): add rate limit control for Profile configuration #1785
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
Closed
olweraltuve
wants to merge
7
commits into
RooCodeInc:main
from
olweraltuve:rate-limit-profile-specificv3
Closed
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9efc90d
feat(settings): add rate limit control for API configuration
olweraltuve 474c177
fix
olweraltuve 68f50fa
fix
olweraltuve 95bd374
Merge branch 'main' into rate-limit-profile-specificv3
olweraltuve 2f4873a
Merge branch 'main' into rate-limit-profile-specificv3
olweraltuve 1356f0d
feat(config): implement rate limit migration for API configurations
olweraltuve 733f2de
fix(tests): enhance ConfigManager tests with global state mocking
olweraltuve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" | ||
| import { useEffect, useState } from "react" | ||
| import { useAppTranslation } from "@/i18n/TranslationContext" | ||
| import { useDebounce } from "react-use" | ||
|
|
||
| interface RateLimitControlProps { | ||
| value: number | undefined | null | ||
| onChange: (value: number | undefined | null) => void | ||
| maxValue?: number | ||
| } | ||
|
|
||
| export const RateLimitControl = ({ value, onChange, maxValue = 60 }: RateLimitControlProps) => { | ||
| const { t } = useAppTranslation() | ||
| const [isCustomRateLimit, setIsCustomRateLimit] = useState(value !== undefined) | ||
| const [inputValue, setInputValue] = useState(value) | ||
| useDebounce(() => onChange(inputValue), 50, [onChange, inputValue]) | ||
| // Sync internal state with prop changes when switching profiles | ||
| useEffect(() => { | ||
| const hasCustomRateLimit = value !== undefined && value !== null | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This checkbox doesn't seem to be serializing correctly Screen.Recording.2025-03-24.at.3.10.38.PM.mov |
||
| setIsCustomRateLimit(hasCustomRateLimit) | ||
| setInputValue(value) | ||
| }, [value]) | ||
|
|
||
| return ( | ||
| <> | ||
| <div> | ||
| <VSCodeCheckbox | ||
| checked={isCustomRateLimit} | ||
| onChange={(e: any) => { | ||
olweraltuve marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const isChecked = e.target.checked | ||
| setIsCustomRateLimit(isChecked) | ||
| if (!isChecked) { | ||
| setInputValue(null) // Unset the rate limit, note that undefined is unserializable | ||
| } else { | ||
| setInputValue(value ?? 0) // Use the value from apiConfiguration, if set | ||
| } | ||
| }}> | ||
| <span className="font-medium">{t("settings:rateLimit.useCustom")}</span> | ||
| </VSCodeCheckbox> | ||
| <div className="text-sm text-vscode-descriptionForeground"> | ||
| {t("settings:advanced.rateLimit.description")} | ||
| </div> | ||
| </div> | ||
|
|
||
| {isCustomRateLimit && ( | ||
| <div | ||
| style={{ | ||
| marginLeft: 0, | ||
| paddingLeft: 10, | ||
| borderLeft: "2px solid var(--vscode-button-background)", | ||
| }}> | ||
| <div style={{ display: "flex", alignItems: "center", gap: "5px" }}> | ||
| <input | ||
| type="range" | ||
| min="0" | ||
| max={maxValue} | ||
| step="1" | ||
| value={inputValue ?? 0} | ||
| className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background" | ||
| onChange={(e) => setInputValue(parseInt(e.target.value))} | ||
| /> | ||
| <span>{inputValue}s</span> | ||
| </div> | ||
| <p className="text-vscode-descriptionForeground text-sm mt-1"> | ||
| {t("settings:advanced.rateLimit.description")} | ||
| </p> | ||
| </div> | ||
| )} | ||
| </> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this just an empty section now? Can we get rid of it?