Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion webview-ui/src/components/chat/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getApiMetrics } from "../../../../src/shared/getApiMetrics"
import { useExtensionState } from "../../context/ExtensionStateContext"
import { vscode } from "../../utils/vscode"
import HistoryPreview from "../history/HistoryPreview"
import { normalizeApiConfiguration } from "../settings/ApiOptions"
import { normalizeApiConfiguration } from "../settings/ProviderSettings"
import Announcement from "./Announcement"
import BrowserSessionRow from "./BrowserSessionRow"
import ChatRow from "./ChatRow"
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/components/chat/TaskHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { HistoryItem } from "../../../../src/shared/HistoryItem"

import { useExtensionState } from "../../context/ExtensionStateContext"
import Thumbnails from "../common/Thumbnails"
import { normalizeApiConfiguration } from "../settings/ApiOptions"
import { normalizeApiConfiguration } from "../settings/ProviderSettings"
import { DeleteTaskDialog } from "../history/DeleteTaskDialog"

interface TaskHeaderProps {
Expand Down
111 changes: 58 additions & 53 deletions webview-ui/src/components/settings/AdvancedSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { EXPERIMENT_IDS, ExperimentId } from "../../../../src/shared/experiments
import { TERMINAL_OUTPUT_LIMIT } from "../../../../src/shared/terminal"

import { cn } from "@/lib/utils"
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui"

import { SetCachedStateField, SetExperimentEnabled } from "./types"
import { sliderLabelStyle } from "./styles"
Expand Down Expand Up @@ -43,6 +44,12 @@ export const AdvancedSettings = ({
className,
...props
}: AdvancedSettingsProps) => {
const diffStrategy = experiments[EXPERIMENT_IDS.DIFF_STRATEGY]
? "unified"
: experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE]
? "multiBlock"
: "standard"

return (
<div className={cn("flex flex-col gap-2", className)} {...props}>
<SectionHeader>
Expand Down Expand Up @@ -122,6 +129,7 @@ export const AdvancedSettings = ({
checked={diffEnabled}
onChange={(e: any) => {
setCachedStateField("diffEnabled", e.target.checked)

if (!e.target.checked) {
// Reset both experimental strategies when diffs are disabled.
setExperimentEnabled(EXPERIMENT_IDS.DIFF_STRATEGY, false)
Expand All @@ -135,19 +143,12 @@ export const AdvancedSettings = ({
truncated full-file writes. Works best with the latest Claude 3.7 Sonnet model.
</p>
{diffEnabled && (
<div className="flex flex-col gap-2 mt-3 mb-2 pl-3 border-l-2 border-vscode-button-background">
<div className="flex flex-col gap-2">
<span className="font-medium">Diff strategy</span>
<select
value={
experiments[EXPERIMENT_IDS.DIFF_STRATEGY]
? "unified"
: experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE]
? "multiBlock"
: "standard"
}
onChange={(e) => {
const value = e.target.value
<div className="flex flex-col gap-2 border-l-2 border-vscode-button-background pl-3">
<div>
<div className="font-medium">Diff strategy</div>
<Select
value={diffStrategy}
onValueChange={(value) => {
if (value === "standard") {
setExperimentEnabled(EXPERIMENT_IDS.DIFF_STRATEGY, false)
setExperimentEnabled(EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE, false)
Expand All @@ -158,48 +159,52 @@ export const AdvancedSettings = ({
setExperimentEnabled(EXPERIMENT_IDS.DIFF_STRATEGY, false)
setExperimentEnabled(EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE, true)
}
}}
className="p-2 rounded w-full bg-vscode-input-background text-vscode-input-foreground border border-vscode-input-border outline-none focus:border-vscode-focusBorder">
<option value="standard">Standard (Single block)</option>
<option value="multiBlock">Experimental: Multi-block diff</option>
<option value="unified">Experimental: Unified diff</option>
</select>
}}>
<SelectTrigger className="w-full mt-1">
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectItem value="standard">Standard (Single block)</SelectItem>
<SelectItem value="multiBlock">Experimental: Multi-block diff</SelectItem>
<SelectItem value="unified">Experimental: Unified diff</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
<p className="text-vscode-descriptionForeground text-sm mt-1">
{!experiments[EXPERIMENT_IDS.DIFF_STRATEGY] &&
!experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] &&
"Standard diff strategy applies changes to a single code block at a time."}
{experiments[EXPERIMENT_IDS.DIFF_STRATEGY] &&
"Unified diff strategy takes multiple approaches to applying diffs and chooses the best approach."}
{experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] &&
"Multi-block diff strategy allows updating multiple code blocks in a file in one request."}
</p>
</div>

{/* Description for selected strategy */}
<p className="text-vscode-descriptionForeground text-sm mt-1">
{!experiments[EXPERIMENT_IDS.DIFF_STRATEGY] &&
!experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] &&
"Standard diff strategy applies changes to a single code block at a time."}
{experiments[EXPERIMENT_IDS.DIFF_STRATEGY] &&
"Unified diff strategy takes multiple approaches to applying diffs and chooses the best approach."}
{experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] &&
"Multi-block diff strategy allows updating multiple code blocks in a file in one request."}
</p>

{/* Match precision slider */}
<span className="font-medium mt-3">Match precision</span>
<div className="flex items-center gap-2">
<input
type="range"
min="0.8"
max="1"
step="0.005"
value={fuzzyMatchThreshold ?? 1.0}
onChange={(e) => {
setCachedStateField("fuzzyMatchThreshold", parseFloat(e.target.value))
}}
className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background"
/>
<span style={{ ...sliderLabelStyle }}>
{Math.round((fuzzyMatchThreshold || 1) * 100)}%
</span>
<div>
<div className="font-medium">Match precision</div>
<div className="flex items-center gap-2">
<input
type="range"
min="0.8"
max="1"
step="0.005"
value={fuzzyMatchThreshold ?? 1.0}
onChange={(e) =>
setCachedStateField("fuzzyMatchThreshold", parseFloat(e.target.value))
}
className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background"
/>
<span style={{ ...sliderLabelStyle }}>
{Math.round((fuzzyMatchThreshold || 1) * 100)}%
</span>
</div>
<p className="text-vscode-descriptionForeground text-sm mt-1">
This slider controls how precisely code sections must match when applying diffs.
Lower values allow more flexible matching but increase the risk of incorrect
replacements. Use values below 100% with extreme caution.
</p>
</div>
<p className="text-vscode-descriptionForeground text-sm mt-0">
This slider controls how precisely code sections must match when applying diffs. Lower
values allow more flexible matching but increase the risk of incorrect replacements. Use
values below 100% with extreme caution.
</p>
</div>
)}
</div>
Expand Down
76 changes: 34 additions & 42 deletions webview-ui/src/components/settings/BrowserSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { HTMLAttributes } from "react"
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
import { Dropdown, type DropdownOption } from "vscrui"
import { SquareMousePointer } from "lucide-react"

import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui"

import { SetCachedStateField } from "./types"
import { sliderLabelStyle } from "./styles"
import { SectionHeader } from "./SectionHeader"
Expand Down Expand Up @@ -43,53 +44,44 @@ export const BrowserSettings = ({
computer use.
</p>
{browserToolEnabled && (
<div
style={{
marginLeft: 0,
paddingLeft: 10,
borderLeft: "2px solid var(--vscode-button-background)",
}}>
<div className="flex flex-col gap-2 border-l-2 border-vscode-button-background pl-3">
<div>
<label style={{ fontWeight: "500", display: "block", marginBottom: 5 }}>
Viewport size
</label>
<div className="dropdown-container">
<Dropdown
value={browserViewportSize}
onChange={(value: unknown) => {
setCachedStateField("browserViewportSize", (value as DropdownOption).value)
}}
style={{ width: "100%" }}
options={[
{ value: "1280x800", label: "Large Desktop (1280x800)" },
{ value: "900x600", label: "Small Desktop (900x600)" },
{ value: "768x1024", label: "Tablet (768x1024)" },
{ value: "360x640", label: "Mobile (360x640)" },
]}
/>
</div>
<p className="text-vscode-descriptionForeground text-sm mt-0">
<label className="font-medium">Viewport size</label>
<Select
value={browserViewportSize}
onValueChange={(value) => setCachedStateField("browserViewportSize", value)}>
<SelectTrigger className="w-full mt-1">
<SelectValue placeholder="Select" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectItem value="1280x800">Large Desktop (1280x800)</SelectItem>
<SelectItem value="900x600">Small Desktop (900x600)</SelectItem>
<SelectItem value="768x1024">Tablet (768x1024)</SelectItem>
<SelectItem value="360x640">Mobile (360x640)</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
<p className="text-vscode-descriptionForeground text-sm mt-1">
Select the viewport size for browser interactions. This affects how websites are
displayed and interacted with.
</p>
</div>
<div>
<div style={{ display: "flex", flexDirection: "column", gap: "5px" }}>
<span className="font-medium">Screenshot quality</span>
<div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
<input
type="range"
min="1"
max="100"
step="1"
value={screenshotQuality ?? 75}
className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background"
onChange={(e) =>
setCachedStateField("screenshotQuality", parseInt(e.target.value))
}
/>
<span style={{ ...sliderLabelStyle }}>{screenshotQuality ?? 75}%</span>
</div>
<span className="font-medium">Screenshot quality</span>
<div className="flex items-center gap-2">
<input
type="range"
min="1"
max="100"
step="1"
value={screenshotQuality ?? 75}
onChange={(e) =>
setCachedStateField("screenshotQuality", parseInt(e.target.value))
}
className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background"
/>
<span style={{ ...sliderLabelStyle }}>{screenshotQuality ?? 75}%</span>
</div>
<p className="text-vscode-descriptionForeground text-sm mt-0">
Adjust the WebP quality of browser screenshots. Higher values provide clearer
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/src/components/settings/ModelPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem }

import { ApiConfiguration, ModelInfo } from "../../../../src/shared/api"

import { normalizeApiConfiguration } from "./ApiOptions"
import { normalizeApiConfiguration } from "./ProviderSettings"
import { ThinkingBudget } from "./ThinkingBudget"
import { ModelInfoView } from "./ModelInfoView"

Expand Down
Loading
Loading