|
1 | 1 | import { useCallback, useState, useEffect, useMemo } from "react" |
2 | 2 | import { useEvent } from "react-use" |
3 | | -import { VSCodeTextField, VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" |
| 3 | +import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react" |
4 | 4 |
|
5 | 5 | 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" |
13 | 6 |
|
14 | 7 | import { ExtensionMessage } from "@roo/ExtensionMessage" |
15 | 8 | import { vscode } from "@src/utils/vscode" |
16 | 9 | import { useAppTranslation } from "@src/i18n/TranslationContext" |
17 | 10 | 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" |
20 | 12 | import { cn } from "@src/lib/utils" |
21 | 13 | import { formatPrice } from "@/utils/formatPrice" |
22 | 14 |
|
@@ -179,6 +171,16 @@ export const HuggingFace = ({ apiConfiguration, setApiConfigurationField }: Hugg |
179 | 171 | <label className="block font-medium mb-1">{t("settings:providers.huggingFaceApiKey")}</label> |
180 | 172 | </VSCodeTextField> |
181 | 173 |
|
| 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 | + |
182 | 184 | <div className="flex flex-col gap-2"> |
183 | 185 | <label className="block font-medium text-sm"> |
184 | 186 | {t("settings:providers.huggingFaceModelId")} |
@@ -267,62 +269,6 @@ export const HuggingFace = ({ apiConfiguration, setApiConfigurationField }: Hugg |
267 | 269 | )} |
268 | 270 | </div> |
269 | 271 | )} |
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 | | - )} |
326 | 272 | </> |
327 | 273 | ) |
328 | 274 | } |
0 commit comments