Skip to content

Commit 40c0457

Browse files
authored
Merge pull request #518 from samhvw8/revert-onChange-onInput
Revert onChange back to onInput
2 parents 343d3fa + 0c81f42 commit 40c0457

File tree

4 files changed

+22
-49
lines changed

4 files changed

+22
-49
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
156156
value={apiConfiguration?.apiKey || ""}
157157
style={{ width: "100%" }}
158158
type="password"
159-
onChange={handleInputChange("apiKey")}
159+
onInput={handleInputChange("apiKey")}
160160
placeholder="Enter API Key...">
161161
<span style={{ fontWeight: 500 }}>Anthropic API Key</span>
162162
</VSCodeTextField>
@@ -181,7 +181,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
181181
value={apiConfiguration?.anthropicBaseUrl || ""}
182182
style={{ width: "100%", marginTop: 3 }}
183183
type="url"
184-
onChange={handleInputChange("anthropicBaseUrl")}
184+
onInput={handleInputChange("anthropicBaseUrl")}
185185
placeholder="Default: https://api.anthropic.com"
186186
/>
187187
)}
@@ -210,7 +210,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
210210
value={apiConfiguration?.glamaApiKey || ""}
211211
style={{ width: "100%" }}
212212
type="password"
213-
onChange={handleInputChange("glamaApiKey")}
213+
onInput={handleInputChange("glamaApiKey")}
214214
placeholder="Enter API Key...">
215215
<span style={{ fontWeight: 500 }}>Glama API Key</span>
216216
</VSCodeTextField>
@@ -239,7 +239,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
239239
value={apiConfiguration?.openAiNativeApiKey || ""}
240240
style={{ width: "100%" }}
241241
type="password"
242-
onChange={handleInputChange("openAiNativeApiKey")}
242+
onInput={handleInputChange("openAiNativeApiKey")}
243243
placeholder="Enter API Key...">
244244
<span style={{ fontWeight: 500 }}>OpenAI API Key</span>
245245
</VSCodeTextField>
@@ -267,7 +267,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
267267
value={apiConfiguration?.mistralApiKey || ""}
268268
style={{ width: "100%" }}
269269
type="password"
270-
onChange={handleInputChange("mistralApiKey")}
270+
onInput={handleInputChange("mistralApiKey")}
271271
placeholder="Enter API Key...">
272272
<span style={{ fontWeight: 500 }}>Mistral API Key</span>
273273
</VSCodeTextField>
@@ -298,7 +298,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
298298
value={apiConfiguration?.openRouterApiKey || ""}
299299
style={{ width: "100%" }}
300300
type="password"
301-
onChange={handleInputChange("openRouterApiKey")}
301+
onInput={handleInputChange("openRouterApiKey")}
302302
placeholder="Enter API Key...">
303303
<span style={{ fontWeight: 500 }}>OpenRouter API Key</span>
304304
</VSCodeTextField>
@@ -344,23 +344,23 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
344344
value={apiConfiguration?.awsAccessKey || ""}
345345
style={{ width: "100%" }}
346346
type="password"
347-
onChange={handleInputChange("awsAccessKey")}
347+
onInput={handleInputChange("awsAccessKey")}
348348
placeholder="Enter Access Key...">
349349
<span style={{ fontWeight: 500 }}>AWS Access Key</span>
350350
</VSCodeTextField>
351351
<VSCodeTextField
352352
value={apiConfiguration?.awsSecretKey || ""}
353353
style={{ width: "100%" }}
354354
type="password"
355-
onChange={handleInputChange("awsSecretKey")}
355+
onInput={handleInputChange("awsSecretKey")}
356356
placeholder="Enter Secret Key...">
357357
<span style={{ fontWeight: 500 }}>AWS Secret Key</span>
358358
</VSCodeTextField>
359359
<VSCodeTextField
360360
value={apiConfiguration?.awsSessionToken || ""}
361361
style={{ width: "100%" }}
362362
type="password"
363-
onChange={handleInputChange("awsSessionToken")}
363+
onInput={handleInputChange("awsSessionToken")}
364364
placeholder="Enter Session Token...">
365365
<span style={{ fontWeight: 500 }}>AWS Session Token</span>
366366
</VSCodeTextField>
@@ -426,7 +426,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
426426
<VSCodeTextField
427427
value={apiConfiguration?.vertexProjectId || ""}
428428
style={{ width: "100%" }}
429-
onChange={handleInputChange("vertexProjectId")}
429+
onInput={handleInputChange("vertexProjectId")}
430430
placeholder="Enter Project ID...">
431431
<span style={{ fontWeight: 500 }}>Google Cloud Project ID</span>
432432
</VSCodeTextField>
@@ -484,7 +484,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
484484
value={apiConfiguration?.geminiApiKey || ""}
485485
style={{ width: "100%" }}
486486
type="password"
487-
onChange={handleInputChange("geminiApiKey")}
487+
onInput={handleInputChange("geminiApiKey")}
488488
placeholder="Enter API Key...">
489489
<span style={{ fontWeight: 500 }}>Gemini API Key</span>
490490
</VSCodeTextField>
@@ -512,15 +512,15 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
512512
value={apiConfiguration?.openAiBaseUrl || ""}
513513
style={{ width: "100%" }}
514514
type="url"
515-
onChange={handleInputChange("openAiBaseUrl")}
515+
onInput={handleInputChange("openAiBaseUrl")}
516516
placeholder={"Enter base URL..."}>
517517
<span style={{ fontWeight: 500 }}>Base URL</span>
518518
</VSCodeTextField>
519519
<VSCodeTextField
520520
value={apiConfiguration?.openAiApiKey || ""}
521521
style={{ width: "100%" }}
522522
type="password"
523-
onChange={handleInputChange("openAiApiKey")}
523+
onInput={handleInputChange("openAiApiKey")}
524524
placeholder="Enter API Key...">
525525
<span style={{ fontWeight: 500 }}>API Key</span>
526526
</VSCodeTextField>
@@ -563,7 +563,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
563563
<VSCodeTextField
564564
value={apiConfiguration?.azureApiVersion || ""}
565565
style={{ width: "100%", marginTop: 3 }}
566-
onChange={handleInputChange("azureApiVersion")}
566+
onInput={handleInputChange("azureApiVersion")}
567567
placeholder={`Default: ${azureOpenAiDefaultApiVersion}`}
568568
/>
569569
)}
@@ -1013,14 +1013,14 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
10131013
value={apiConfiguration?.lmStudioBaseUrl || ""}
10141014
style={{ width: "100%" }}
10151015
type="url"
1016-
onChange={handleInputChange("lmStudioBaseUrl")}
1016+
onInput={handleInputChange("lmStudioBaseUrl")}
10171017
placeholder={"Default: http://localhost:1234"}>
10181018
<span style={{ fontWeight: 500 }}>Base URL (optional)</span>
10191019
</VSCodeTextField>
10201020
<VSCodeTextField
10211021
value={apiConfiguration?.lmStudioModelId || ""}
10221022
style={{ width: "100%" }}
1023-
onChange={handleInputChange("lmStudioModelId")}
1023+
onInput={handleInputChange("lmStudioModelId")}
10241024
placeholder={"e.g. meta-llama-3.1-8b-instruct"}>
10251025
<span style={{ fontWeight: 500 }}>Model ID</span>
10261026
</VSCodeTextField>
@@ -1082,7 +1082,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
10821082
value={apiConfiguration?.deepSeekApiKey || ""}
10831083
style={{ width: "100%" }}
10841084
type="password"
1085-
onChange={handleInputChange("deepSeekApiKey")}
1085+
onInput={handleInputChange("deepSeekApiKey")}
10861086
placeholder="Enter API Key...">
10871087
<span style={{ fontWeight: 500 }}>DeepSeek API Key</span>
10881088
</VSCodeTextField>
@@ -1172,14 +1172,14 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
11721172
value={apiConfiguration?.ollamaBaseUrl || ""}
11731173
style={{ width: "100%" }}
11741174
type="url"
1175-
onChange={handleInputChange("ollamaBaseUrl")}
1175+
onInput={handleInputChange("ollamaBaseUrl")}
11761176
placeholder={"Default: http://localhost:11434"}>
11771177
<span style={{ fontWeight: 500 }}>Base URL (optional)</span>
11781178
</VSCodeTextField>
11791179
<VSCodeTextField
11801180
value={apiConfiguration?.ollamaModelId || ""}
11811181
style={{ width: "100%" }}
1182-
onChange={handleInputChange("ollamaModelId")}
1182+
onInput={handleInputChange("ollamaModelId")}
11831183
placeholder={"e.g. llama3.1"}>
11841184
<span style={{ fontWeight: 500 }}>Model ID</span>
11851185
</VSCodeTextField>

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,8 @@ const GlamaModelPicker: React.FC = () => {
167167
placeholder="Search and select a model..."
168168
value={searchTerm}
169169
onInput={(e) => {
170-
const newModelId = (e.target as HTMLInputElement)?.value?.toLowerCase()
171-
const apiConfig = {
172-
...apiConfiguration,
173-
openAiModelId: newModelId,
174-
}
175-
setApiConfiguration(apiConfig)
176-
setSearchTerm(newModelId)
177-
setIsDropdownVisible(true)
178-
}}
179-
onChange={(e) => {
180170
handleModelChange((e.target as HTMLInputElement)?.value?.toLowerCase())
171+
setIsDropdownVisible(true)
181172
}}
182173
onFocus={() => setIsDropdownVisible(true)}
183174
onKeyDown={handleKeyDown}

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,8 @@ const OpenAiModelPicker: React.FC = () => {
159159
placeholder="Search and select a model..."
160160
value={searchTerm}
161161
onInput={(e) => {
162-
const newModelId = (e.target as HTMLInputElement)?.value?.toLowerCase()
163-
const apiConfig = {
164-
...apiConfiguration,
165-
openAiModelId: newModelId,
166-
}
167-
setApiConfiguration(apiConfig)
168-
setSearchTerm(newModelId)
169-
setIsDropdownVisible(true)
170-
}}
171-
onChange={(e) => {
172162
handleModelChange((e.target as HTMLInputElement)?.value?.toLowerCase())
163+
setIsDropdownVisible(true)
173164
}}
174165
onFocus={() => setIsDropdownVisible(true)}
175166
onKeyDown={handleKeyDown}

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,8 @@ const OpenRouterModelPicker: React.FC = () => {
167167
placeholder="Search and select a model..."
168168
value={searchTerm}
169169
onInput={(e) => {
170-
const newModelId = (e.target as HTMLInputElement)?.value?.toLowerCase()
171-
const apiConfig = {
172-
...apiConfiguration,
173-
openAiModelId: newModelId,
174-
}
175-
setApiConfiguration(apiConfig)
176-
setSearchTerm(newModelId)
177-
setIsDropdownVisible(true)
178-
}}
179-
onChange={(e) => {
180170
handleModelChange((e.target as HTMLInputElement)?.value?.toLowerCase())
171+
setIsDropdownVisible(true)
181172
}}
182173
onFocus={() => setIsDropdownVisible(true)}
183174
onKeyDown={handleKeyDown}

0 commit comments

Comments
 (0)