Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
maxTotalImageSize?: number
maxConcurrentFileReads?: number
profileThresholds?: Record<string, number>
condensingApiConfigId?: string
includeDiagnosticMessages?: boolean
maxDiagnosticMessages?: number
writeDelayMs: number
Expand All @@ -40,6 +41,7 @@ type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
| "maxTotalImageSize"
| "maxConcurrentFileReads"
| "profileThresholds"
| "condensingApiConfigId"
| "includeDiagnosticMessages"
| "maxDiagnosticMessages"
| "writeDelayMs"
Expand All @@ -61,6 +63,7 @@ export const ContextManagementSettings = ({
maxTotalImageSize,
maxConcurrentFileReads,
profileThresholds = {},
condensingApiConfigId,
includeDiagnosticMessages,
maxDiagnosticMessages,
writeDelayMs,
Expand Down Expand Up @@ -398,6 +401,40 @@ export const ContextManagementSettings = ({
data-testid="auto-condense-context-checkbox">
<span className="font-medium">{t("settings:contextManagement.autoCondenseContext.name")}</span>
</VSCodeCheckbox>

{/* API Configuration dropdown - shown regardless of auto-condense state */}
<div className="mt-4">
<label className="block font-medium mb-1">
{t("prompts:supportPrompts.condense.apiConfiguration")}
</label>
<Select
value={condensingApiConfigId || "-"}
onValueChange={(value) => {
const newConfigId = value === "-" ? "" : value
setCachedStateField("condensingApiConfigId", newConfigId)
vscode.postMessage({
type: "condensingApiConfigId",
text: newConfigId,
})
}}
data-testid="condensing-api-config-select">
<SelectTrigger className="w-full">
<SelectValue placeholder={t("prompts:supportPrompts.condense.useCurrentConfig")} />
</SelectTrigger>
<SelectContent>
<SelectItem value="-">{t("prompts:supportPrompts.condense.useCurrentConfig")}</SelectItem>
{(listApiConfigMeta || []).map((config) => (
<SelectItem key={config.id} value={config.id}>
{config.name}
</SelectItem>
))}
</SelectContent>
</Select>
<div className="text-sm text-vscode-descriptionForeground mt-1">
{t("prompts:supportPrompts.condense.apiConfigDescription")}
</div>
</div>

{autoCondenseContext && (
<div className="flex flex-col gap-3 pl-3 border-l-2 border-vscode-button-background">
<div className="flex items-center gap-4 font-bold">
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
maxTotalImageSize={maxTotalImageSize}
maxConcurrentFileReads={maxConcurrentFileReads}
profileThresholds={profileThresholds}
condensingApiConfigId={condensingApiConfigId}
includeDiagnosticMessages={includeDiagnosticMessages}
maxDiagnosticMessages={maxDiagnosticMessages}
writeDelayMs={writeDelayMs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ describe("ContextManagementSettings", () => {
const slider = screen.getByTestId("condense-threshold-slider")
expect(slider).toBeInTheDocument()

// Should render the profile select dropdown
// Should render the profile select dropdown and condensing API config dropdown
const selects = screen.getAllByRole("combobox")
expect(selects).toHaveLength(1)
expect(selects).toHaveLength(2)
})

describe("Auto Condense Context functionality", () => {
Expand Down Expand Up @@ -412,8 +412,8 @@ describe("ContextManagementSettings", () => {

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

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