From a7ce5e5ddfae52dcbef89c1262d8b9586669cb44 Mon Sep 17 00:00:00 2001 From: Ashhar Date: Sat, 11 Jan 2025 18:16:37 +0530 Subject: [PATCH] fixed layouting of prompt caching toggle --- app/components/chat/APIKeyManager.tsx | 146 +++++++++++++------------- 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/app/components/chat/APIKeyManager.tsx b/app/components/chat/APIKeyManager.tsx index fa1d6a6dd..41e2a3cfe 100644 --- a/app/components/chat/APIKeyManager.tsx +++ b/app/components/chat/APIKeyManager.tsx @@ -98,89 +98,91 @@ export const APIKeyManager: React.FC = ({ provider, apiKey, }; return ( -
-
-
- {provider?.name} API Key: - {!isEditing && ( -
- {isEnvKeySet ? ( - <> -
- - Set via {providerBaseUrlEnvKeys[provider.name].apiTokenKey} environment variable - - - ) : apiKey ? ( - <> -
- Set via UI - - ) : ( - <> -
- Not Set (Please set via UI or ENV_VAR) - - )} -
- )} -
-
- -
- {isEditing && !isEnvKeySet ? ( +
+
+
- setTempKey(e.target.value)} - className="w-[300px] px-3 py-1.5 text-sm rounded border border-bolt-elements-borderColor - bg-bolt-elements-prompt-background text-bolt-elements-textPrimary - focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus" - /> - -
- - setIsEditing(false)} - title="Cancel" - className="bg-red-500/10 hover:bg-red-500/20 text-red-500" - > -
- + {provider?.name} API Key: + {!isEditing && ( +
+ {isEnvKeySet ? ( + <> +
+ + Set via {providerBaseUrlEnvKeys[provider.name].apiTokenKey} environment variable + + + ) : apiKey ? ( + <> +
+ Set via UI + + ) : ( + <> +
+ Not Set (Please set via UI or ENV_VAR) + + )} +
+ )}
- ) : ( - <> - {!isEnvKeySet && ( +
+ +
+ {isEditing && !isEnvKeySet ? ( +
+ setTempKey(e.target.value)} + className="w-[300px] px-3 py-1.5 text-sm rounded border border-bolt-elements-borderColor + bg-bolt-elements-prompt-background text-bolt-elements-textPrimary + focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus" + /> setIsEditing(true)} - title="Edit API Key" - className="bg-blue-500/10 hover:bg-blue-500/20 text-blue-500" + onClick={handleSave} + title="Save API Key" + className="bg-green-500/10 hover:bg-green-500/20 text-green-500" > -
+
- )} - {provider?.getApiKeyLink && !isEnvKeySet && ( window.open(provider?.getApiKeyLink)} - title="Get API Key" - className="bg-purple-500/10 hover:bg-purple-500/20 text-purple-500 flex items-center gap-2" + onClick={() => setIsEditing(false)} + title="Cancel" + className="bg-red-500/10 hover:bg-red-500/20 text-red-500" > - {provider?.labelForGetApiKey || 'Get API Key'} -
+
- )} - - )} +
+ ) : ( + <> + {!isEnvKeySet && ( + setIsEditing(true)} + title="Edit API Key" + className="bg-blue-500/10 hover:bg-blue-500/20 text-blue-500" + > +
+ + )} + {provider?.getApiKeyLink && !isEnvKeySet && ( + window.open(provider?.getApiKeyLink)} + title="Get API Key" + className="bg-purple-500/10 hover:bg-purple-500/20 text-purple-500 flex items-center gap-2" + > + {provider?.labelForGetApiKey || 'Get API Key'} +
+ + )} + + )} +
{provider?.name === 'Anthropic' && ( -
+