Upload APIKeyManager.tsx
Browse files
app/components/chat/APIKeyManager.tsx
CHANGED
|
@@ -39,11 +39,6 @@ export const APIKeyManager: React.FC<APIKeyManagerProps> = ({ provider, apiKey,
|
|
| 39 |
return savedState !== null ? JSON.parse(savedState) : true;
|
| 40 |
});
|
| 41 |
|
| 42 |
-
useEffect(() => {
|
| 43 |
-
// Update localStorage whenever the prompt caching state changes
|
| 44 |
-
localStorage.setItem('PROMPT_CACHING_ENABLED', JSON.stringify(isPromptCachingEnabled));
|
| 45 |
-
}, [isPromptCachingEnabled]);
|
| 46 |
-
|
| 47 |
function cachedApiKeysOps() {
|
| 48 |
const STORAGE_KEY = 'PROVIDER_API_KEYS';
|
| 49 |
|
|
@@ -72,6 +67,17 @@ export const APIKeyManager: React.FC<APIKeyManagerProps> = ({ provider, apiKey,
|
|
| 72 |
cachedApiKeysOps().save(tempKey);
|
| 73 |
};
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
return (
|
| 76 |
<div className="space-y-4">
|
| 77 |
<div className="flex items-start sm:items-center mt-2 mb-2 flex-col sm:flex-row">
|
|
|
|
| 39 |
return savedState !== null ? JSON.parse(savedState) : true;
|
| 40 |
});
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
function cachedApiKeysOps() {
|
| 43 |
const STORAGE_KEY = 'PROVIDER_API_KEYS';
|
| 44 |
|
|
|
|
| 67 |
cachedApiKeysOps().save(tempKey);
|
| 68 |
};
|
| 69 |
|
| 70 |
+
useEffect(() => {
|
| 71 |
+
if (tempKey) {
|
| 72 |
+
setApiKey(tempKey);
|
| 73 |
+
}
|
| 74 |
+
}, [tempKey]);
|
| 75 |
+
|
| 76 |
+
useEffect(() => {
|
| 77 |
+
// Update localStorage whenever the prompt caching state changes
|
| 78 |
+
localStorage.setItem('PROMPT_CACHING_ENABLED', JSON.stringify(isPromptCachingEnabled));
|
| 79 |
+
}, [isPromptCachingEnabled]);
|
| 80 |
+
|
| 81 |
return (
|
| 82 |
<div className="space-y-4">
|
| 83 |
<div className="flex items-start sm:items-center mt-2 mb-2 flex-col sm:flex-row">
|