From 756d3f2b855a2d508f73e9d91006b13da60fc625 Mon Sep 17 00:00:00 2001 From: eduardruzga Date: Tue, 12 Nov 2024 11:25:58 +0200 Subject: [PATCH] Bug fixes --- app/components/chat/APIKeyManager.tsx | 14 +++++++++-- app/components/chat/BaseChat.tsx | 24 +++++++++--------- app/components/chat/Chat.client.tsx | 4 +-- app/utils/constants.ts | 35 ++++++++++++++++----------- 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/app/components/chat/APIKeyManager.tsx b/app/components/chat/APIKeyManager.tsx index 1343ece42..54654b535 100644 --- a/app/components/chat/APIKeyManager.tsx +++ b/app/components/chat/APIKeyManager.tsx @@ -6,9 +6,15 @@ interface APIKeyManagerProps { provider: ProviderInfo; apiKey: string; setApiKey: (key: string) => void; + getApiKeyLink?: string; + labelForGetApiKey?: string; } -export const APIKeyManager: React.FC = ({ provider, apiKey, setApiKey }) => { +export const APIKeyManager: React.FC = ({ + provider, + apiKey, + setApiKey, + }) => { const [isEditing, setIsEditing] = useState(false); const [tempKey, setTempKey] = useState(apiKey); @@ -43,7 +49,11 @@ export const APIKeyManager: React.FC = ({ provider, apiKey, setIsEditing(true)} title="Edit API Key">
- {!!provider?.getApiKeyLink ? {provider?.labelForGetApiKey || "Get API Key"} : "" } + + {provider?.getApiKeyLink && window.open(provider?.getApiKeyLink)} title="Edit API Key"> + {provider?.labelForGetApiKey || 'Get API Key'} +
+ } )}
diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index 134b4f8f7..09ee11878 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -7,7 +7,7 @@ import { Menu } from '~/components/sidebar/Menu.client'; import { IconButton } from '~/components/ui/IconButton'; import { Workbench } from '~/components/workbench/Workbench.client'; import { classNames } from '~/utils/classNames'; -import { MODEL_LIST, DEFAULT_PROVIDER, PROVIDER_LIST } from '~/utils/constants'; +import { MODEL_LIST, DEFAULT_PROVIDER, PROVIDER_LIST, ProviderInfo } from '~/utils/constants'; import { Messages } from './Messages.client'; import { SendButton } from './SendButton.client'; import { useState } from 'react'; @@ -30,9 +30,9 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov return (