Skip to content

Commit bcbcd20

Browse files
committed
fix: persist condensing API configuration in Context Management settings
- Added condensingApiConfigId dropdown to ContextManagementSettings component - Dropdown is now visible regardless of auto-condense checkbox state - Updated SettingsView to pass condensingApiConfigId prop - Fixed test expectations to account for new dropdown element Fixes #8871
1 parent 3cbdbc2 commit bcbcd20

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

webview-ui/src/components/settings/ContextManagementSettings.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
2424
maxTotalImageSize?: number
2525
maxConcurrentFileReads?: number
2626
profileThresholds?: Record<string, number>
27+
condensingApiConfigId?: string
2728
includeDiagnosticMessages?: boolean
2829
maxDiagnosticMessages?: number
2930
writeDelayMs: number
@@ -40,6 +41,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
4041
| "maxTotalImageSize"
4142
| "maxConcurrentFileReads"
4243
| "profileThresholds"
44+
| "condensingApiConfigId"
4345
| "includeDiagnosticMessages"
4446
| "maxDiagnosticMessages"
4547
| "writeDelayMs"
@@ -61,6 +63,7 @@ export const ContextManagementSettings = ({
6163
maxTotalImageSize,
6264
maxConcurrentFileReads,
6365
profileThresholds = {},
66+
condensingApiConfigId,
6467
includeDiagnosticMessages,
6568
maxDiagnosticMessages,
6669
writeDelayMs,
@@ -398,6 +401,40 @@ export const ContextManagementSettings = ({
398401
data-testid="auto-condense-context-checkbox">
399402
<span className="font-medium">{t("settings:contextManagement.autoCondenseContext.name")}</span>
400403
</VSCodeCheckbox>
404+
405+
{/* API Configuration dropdown - shown regardless of auto-condense state */}
406+
<div className="mt-4">
407+
<label className="block font-medium mb-1">
408+
{t("prompts:supportPrompts.condense.apiConfiguration")}
409+
</label>
410+
<Select
411+
value={condensingApiConfigId || "-"}
412+
onValueChange={(value) => {
413+
const newConfigId = value === "-" ? "" : value
414+
setCachedStateField("condensingApiConfigId", newConfigId)
415+
vscode.postMessage({
416+
type: "condensingApiConfigId",
417+
text: newConfigId,
418+
})
419+
}}
420+
data-testid="condensing-api-config-select">
421+
<SelectTrigger className="w-full">
422+
<SelectValue placeholder={t("prompts:supportPrompts.condense.useCurrentConfig")} />
423+
</SelectTrigger>
424+
<SelectContent>
425+
<SelectItem value="-">{t("prompts:supportPrompts.condense.useCurrentConfig")}</SelectItem>
426+
{(listApiConfigMeta || []).map((config) => (
427+
<SelectItem key={config.id} value={config.id}>
428+
{config.name}
429+
</SelectItem>
430+
))}
431+
</SelectContent>
432+
</Select>
433+
<div className="text-sm text-vscode-descriptionForeground mt-1">
434+
{t("prompts:supportPrompts.condense.apiConfigDescription")}
435+
</div>
436+
</div>
437+
401438
{autoCondenseContext && (
402439
<div className="flex flex-col gap-3 pl-3 border-l-2 border-vscode-button-background">
403440
<div className="flex items-center gap-4 font-bold">

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
748748
maxTotalImageSize={maxTotalImageSize}
749749
maxConcurrentFileReads={maxConcurrentFileReads}
750750
profileThresholds={profileThresholds}
751+
condensingApiConfigId={condensingApiConfigId}
751752
includeDiagnosticMessages={includeDiagnosticMessages}
752753
maxDiagnosticMessages={maxDiagnosticMessages}
753754
writeDelayMs={writeDelayMs}

webview-ui/src/components/settings/__tests__/ContextManagementSettings.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ describe("ContextManagementSettings", () => {
377377
const slider = screen.getByTestId("condense-threshold-slider")
378378
expect(slider).toBeInTheDocument()
379379

380-
// Should render the profile select dropdown
380+
// Should render the profile select dropdown and condensing API config dropdown
381381
const selects = screen.getAllByRole("combobox")
382-
expect(selects).toHaveLength(1)
382+
expect(selects).toHaveLength(2)
383383
})
384384

385385
describe("Auto Condense Context functionality", () => {
@@ -412,8 +412,8 @@ describe("ContextManagementSettings", () => {
412412

413413
// Threshold settings should be visible
414414
expect(screen.getByTestId("condense-threshold-slider")).toBeInTheDocument()
415-
// One combobox for profile selection
416-
expect(screen.getAllByRole("combobox")).toHaveLength(1)
415+
// Two comboboxes: one for profile selection and one for condensing API config
416+
expect(screen.getAllByRole("combobox")).toHaveLength(2)
417417
})
418418

419419
it("updates auto condense context percent", () => {

0 commit comments

Comments
 (0)