Skip to content

Commit 83f02d5

Browse files
committed
fix: input field showed NaN -> annoying UX
1 parent a204169 commit 83f02d5

File tree

1 file changed

+9
-8
lines changed
  • webview-ui/src/components/settings/providers

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,17 @@ export const Gemini = ({
271271
onValueChange={([value]) => setApiConfigurationField("contextLimit", value)}
272272
/>
273273
<VSCodeTextField
274-
value={(
275-
apiConfiguration.contextLimit ??
276-
modelInfo?.contextWindow ??
277-
1048576
278-
).toString()}
274+
value={(() => {
275+
const val =
276+
apiConfiguration.contextLimit ?? modelInfo?.contextWindow ?? 1048576
277+
return Number.isNaN(val) ? "" : val.toString()
278+
})()}
279279
type="text"
280280
inputMode="numeric"
281-
onInput={handleInputChange("contextLimit", (e) =>
282-
parseInt((e as any).target.value, 10),
283-
)}
281+
onInput={handleInputChange("contextLimit", (e) => {
282+
const val = parseInt((e as any).target.value, 10)
283+
return Number.isNaN(val) ? undefined : val
284+
})}
284285
className="w-24"
285286
/>
286287
<span className="text-sm">

0 commit comments

Comments
 (0)