From c366a6e26e16e8311160bd5bd5f8608d5da624b1 Mon Sep 17 00:00:00 2001 From: System233 Date: Mon, 17 Feb 2025 22:26:40 +0800 Subject: [PATCH] Revert "Update API options on blur instead of on input" This reverts commit 6a8902fae4efead3f733afefee86aab17e750358. --- .../src/components/settings/ApiOptions.tsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index 66459eba49..00f9455f3c 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -178,7 +178,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.apiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("apiKey")} + onInput={handleInputChange("apiKey")} placeholder="Enter API Key..."> Anthropic API Key @@ -203,7 +203,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.anthropicBaseUrl || ""} style={{ width: "100%", marginTop: 3 }} type="url" - onBlur={handleInputChange("anthropicBaseUrl")} + onInput={handleInputChange("anthropicBaseUrl")} placeholder="Default: https://api.anthropic.com" /> )} @@ -232,7 +232,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.glamaApiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("glamaApiKey")} + onInput={handleInputChange("glamaApiKey")} placeholder="Enter API Key..."> Glama API Key @@ -282,7 +282,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.openAiNativeApiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("openAiNativeApiKey")} + onInput={handleInputChange("openAiNativeApiKey")} placeholder="Enter API Key..."> OpenAI API Key @@ -310,7 +310,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.mistralApiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("mistralApiKey")} + onInput={handleInputChange("mistralApiKey")} placeholder="Enter API Key..."> Mistral API Key @@ -364,7 +364,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.openRouterApiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("openRouterApiKey")} + onInput={handleInputChange("openRouterApiKey")} placeholder="Enter API Key..."> OpenRouter API Key @@ -446,7 +446,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A AWS Profile Name @@ -457,7 +457,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.awsAccessKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("awsAccessKey")} + onInput={handleInputChange("awsAccessKey")} placeholder="Enter Access Key..."> AWS Access Key @@ -465,7 +465,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.awsSecretKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("awsSecretKey")} + onInput={handleInputChange("awsSecretKey")} placeholder="Enter Secret Key..."> AWS Secret Key @@ -473,7 +473,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.awsSessionToken || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("awsSessionToken")} + onInput={handleInputChange("awsSessionToken")} placeholder="Enter Session Token..."> AWS Session Token @@ -541,7 +541,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A Google Cloud Project ID @@ -599,7 +599,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.geminiApiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("geminiApiKey")} + onInput={handleInputChange("geminiApiKey")} placeholder="Enter API Key..."> Gemini API Key @@ -627,7 +627,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.openAiBaseUrl || ""} style={{ width: "100%" }} type="url" - onBlur={handleInputChange("openAiBaseUrl")} + onInput={handleInputChange("openAiBaseUrl")} placeholder={"Enter base URL..."}> Base URL @@ -635,7 +635,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.openAiApiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("openAiApiKey")} + onInput={handleInputChange("openAiApiKey")} placeholder="Enter API Key..."> API Key @@ -678,7 +678,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A )} @@ -1128,14 +1128,14 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.lmStudioBaseUrl || ""} style={{ width: "100%" }} type="url" - onBlur={handleInputChange("lmStudioBaseUrl")} + onInput={handleInputChange("lmStudioBaseUrl")} placeholder={"Default: http://localhost:1234"}> Base URL (optional) Model ID @@ -1197,7 +1197,7 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.deepSeekApiKey || ""} style={{ width: "100%" }} type="password" - onBlur={handleInputChange("deepSeekApiKey")} + onInput={handleInputChange("deepSeekApiKey")} placeholder="Enter API Key..."> DeepSeek API Key @@ -1287,14 +1287,14 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage, fromWelcomeView }: A value={apiConfiguration?.ollamaBaseUrl || ""} style={{ width: "100%" }} type="url" - onBlur={handleInputChange("ollamaBaseUrl")} + onInput={handleInputChange("ollamaBaseUrl")} placeholder={"Default: http://localhost:11434"}> Base URL (optional) Model ID