Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 19 additions & 58 deletions webview-ui/src/components/chat/AutoApproveMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,29 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
overflowY: "auto",
...style,
}}>
{isExpanded && (
<div className="flex flex-col gap-2">
<AutoApproveToggle {...toggles} onToggle={onAutoApproveToggle} />
<div
style={{
color: "var(--vscode-descriptionForeground)",
fontSize: "12px",
}}>
<Trans
i18nKey="chat:autoApprove.description"
components={{
settingsLink: <VSCodeLink href="#" onClick={handleOpenSettings} />,
}}
/>
</div>
</div>
)}
<div
style={{
display: "flex",
alignItems: "center",
gap: "8px",
padding: isExpanded ? "8px 0" : "8px 0 0 0",
padding: "8px 0",
cursor: "pointer",
}}
onClick={toggleExpanded}>
Expand Down Expand Up @@ -175,70 +192,14 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
{enabledActionsList || t("chat:autoApprove.none")}
</span>
<span
className={`codicon codicon-chevron-${isExpanded ? "down" : "right"}`}
className={`codicon codicon-chevron-${isExpanded ? "up" : "right"}`}
style={{
flexShrink: 0,
marginLeft: isExpanded ? "2px" : "-2px",
}}
/>
</div>
</div>

{isExpanded && (
<div className="flex flex-col gap-2">
<div
style={{
color: "var(--vscode-descriptionForeground)",
fontSize: "12px",
}}>
<Trans
i18nKey="chat:autoApprove.description"
components={{
settingsLink: <VSCodeLink href="#" onClick={handleOpenSettings} />,
}}
/>
</div>

<AutoApproveToggle {...toggles} onToggle={onAutoApproveToggle} />

{/* Auto-approve API request count limit input row inspired by Cline */}
<div
style={{
display: "flex",
alignItems: "center",
gap: "8px",
marginTop: "10px",
marginBottom: "8px",
color: "var(--vscode-descriptionForeground)",
}}>
<span style={{ flexShrink: 1, minWidth: 0 }}>
<Trans i18nKey="settings:autoApprove.apiRequestLimit.title" />:
</span>
<VSCodeTextField
placeholder={t("settings:autoApprove.apiRequestLimit.unlimited")}
value={(allowedMaxRequests ?? Infinity) === Infinity ? "" : allowedMaxRequests?.toString()}
onInput={(e) => {
const input = e.target as HTMLInputElement
// Remove any non-numeric characters
input.value = input.value.replace(/[^0-9]/g, "")
const value = parseInt(input.value)
const parsedValue = !isNaN(value) && value > 0 ? value : undefined
setAllowedMaxRequests(parsedValue)
vscode.postMessage({ type: "allowedMaxRequests", value: parsedValue })
}}
style={{ flex: 1 }}
/>
</div>
<div
style={{
color: "var(--vscode-descriptionForeground)",
fontSize: "12px",
marginBottom: "10px",
}}>
<Trans i18nKey="settings:autoApprove.apiRequestLimit.description" />
</div>
</div>
)}
</div>
)
}
Expand Down