Skip to content

Commit 97ec777

Browse files
authored
Clean up some of the hugging face provider settings (#6236)
1 parent 0504199 commit 97ec777

File tree

1 file changed

+12
-66
lines changed

1 file changed

+12
-66
lines changed

webview-ui/src/components/settings/providers/HuggingFace.tsx

Lines changed: 12 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
import { useCallback, useState, useEffect, useMemo } from "react"
22
import { useEvent } from "react-use"
3-
import { VSCodeTextField, VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
3+
import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
44

55
import type { ProviderSettings } from "@roo-code/types"
6-
import {
7-
HUGGINGFACE_DEFAULT_MAX_TOKENS,
8-
HUGGINGFACE_MAX_TOKENS_FALLBACK,
9-
HUGGINGFACE_SLIDER_STEP,
10-
HUGGINGFACE_SLIDER_MIN,
11-
HUGGINGFACE_TEMPERATURE_MAX_VALUE,
12-
} from "@roo-code/types"
136

147
import { ExtensionMessage } from "@roo/ExtensionMessage"
158
import { vscode } from "@src/utils/vscode"
169
import { useAppTranslation } from "@src/i18n/TranslationContext"
1710
import { VSCodeButtonLink } from "@src/components/common/VSCodeButtonLink"
18-
import { SearchableSelect, type SearchableSelectOption, Slider } from "@src/components/ui"
19-
import { TemperatureControl } from "../TemperatureControl"
11+
import { SearchableSelect, type SearchableSelectOption } from "@src/components/ui"
2012
import { cn } from "@src/lib/utils"
2113
import { formatPrice } from "@/utils/formatPrice"
2214

@@ -179,6 +171,16 @@ export const HuggingFace = ({ apiConfiguration, setApiConfigurationField }: Hugg
179171
<label className="block font-medium mb-1">{t("settings:providers.huggingFaceApiKey")}</label>
180172
</VSCodeTextField>
181173

174+
<div className="text-sm text-vscode-descriptionForeground -mt-2">
175+
{t("settings:providers.apiKeyStorageNotice")}
176+
</div>
177+
178+
{!apiConfiguration?.huggingFaceApiKey && (
179+
<VSCodeButtonLink href="https://huggingface.co/settings/tokens" appearance="secondary">
180+
{t("settings:providers.getHuggingFaceApiKey")}
181+
</VSCodeButtonLink>
182+
)}
183+
182184
<div className="flex flex-col gap-2">
183185
<label className="block font-medium text-sm">
184186
{t("settings:providers.huggingFaceModelId")}
@@ -267,62 +269,6 @@ export const HuggingFace = ({ apiConfiguration, setApiConfigurationField }: Hugg
267269
)}
268270
</div>
269271
)}
270-
271-
{/* Temperature control */}
272-
<TemperatureControl
273-
value={apiConfiguration?.modelTemperature}
274-
onChange={(value) => setApiConfigurationField("modelTemperature", value)}
275-
maxValue={HUGGINGFACE_TEMPERATURE_MAX_VALUE}
276-
/>
277-
278-
{/* Max tokens control */}
279-
<div className="flex flex-col gap-3">
280-
<VSCodeCheckbox
281-
checked={apiConfiguration?.includeMaxTokens ?? false}
282-
onChange={(e) =>
283-
setApiConfigurationField("includeMaxTokens", (e.target as HTMLInputElement).checked)
284-
}>
285-
<label className="block font-medium mb-1">{t("settings:includeMaxOutputTokens")}</label>
286-
</VSCodeCheckbox>
287-
<div className="text-sm text-vscode-descriptionForeground -mt-2">
288-
{t("settings:limitMaxTokensDescription")}
289-
</div>
290-
291-
{apiConfiguration?.includeMaxTokens && (
292-
<div className="flex flex-col gap-3 pl-3 border-l-2 border-vscode-button-background">
293-
<div>
294-
<label className="block font-medium mb-2 text-sm">
295-
{t("settings:maxOutputTokensLabel")}
296-
</label>
297-
<div className="flex items-center gap-2">
298-
<Slider
299-
min={HUGGINGFACE_SLIDER_MIN}
300-
max={modelCapabilities?.maxTokens || HUGGINGFACE_MAX_TOKENS_FALLBACK}
301-
step={HUGGINGFACE_SLIDER_STEP}
302-
value={[apiConfiguration?.modelMaxTokens || HUGGINGFACE_DEFAULT_MAX_TOKENS]}
303-
onValueChange={([value]) => setApiConfigurationField("modelMaxTokens", value)}
304-
/>
305-
<span className="w-16 text-sm">
306-
{apiConfiguration?.modelMaxTokens || HUGGINGFACE_DEFAULT_MAX_TOKENS}
307-
</span>
308-
</div>
309-
<div className="text-vscode-descriptionForeground text-sm mt-1">
310-
{t("settings:maxTokensGenerateDescription")}
311-
</div>
312-
</div>
313-
</div>
314-
)}
315-
</div>
316-
317-
<div className="text-sm text-vscode-descriptionForeground -mt-2">
318-
{t("settings:providers.apiKeyStorageNotice")}
319-
</div>
320-
321-
{!apiConfiguration?.huggingFaceApiKey && (
322-
<VSCodeButtonLink href="https://huggingface.co/settings/tokens" appearance="secondary">
323-
{t("settings:providers.getHuggingFaceApiKey")}
324-
</VSCodeButtonLink>
325-
)}
326272
</>
327273
)
328274
}

0 commit comments

Comments
 (0)