Skip to content

Commit

Permalink
Merge pull request #832 from ashera96/endpoint-page-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RakhithaRR authored Oct 24, 2024
2 parents 4460788 + 91fb4f3 commit 963221c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export default function AIEndpointAuth(props) {
let newApiKeyValue = api.endpointConfig?.endpoint_security?.[isProduction ?
'production' : 'sandbox']?.apiKeyValue === '' ? '' : null;

if ((llmProviderName === 'MistralAI' || llmProviderName === 'OpenAI') && newApiKeyValue !== '') {
if ((llmProviderName === 'MistralAI' || llmProviderName === 'OpenAI') &&
newApiKeyValue != null && newApiKeyValue !== '') {
newApiKeyValue = `Bearer ${newApiKeyValue}`;
}

Expand All @@ -68,7 +69,8 @@ export default function AIEndpointAuth(props) {

let updatedApiKeyValue = event.target.value === '********' ? '' : event.target.value;

if ((llmProviderName === 'MistralAI' || llmProviderName === 'OpenAI') && updatedApiKeyValue !== '') {
if ((llmProviderName === 'MistralAI' || llmProviderName === 'OpenAI') &&
updatedApiKeyValue !== null && updatedApiKeyValue !== '') {
updatedApiKeyValue = `Bearer ${updatedApiKeyValue}`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ function Endpoints(props) {
}
}
} else if (production.type === 'apikey') {
if (production.apiKeyValue === null && endpointConfig.production_endpoints) {
if ((production.apiKeyValue === null || production.apiKeyValue === '') &&
endpointConfig.production_endpoints) {
return {
isValid: false,
message: intl.formatMessage({
Expand Down Expand Up @@ -525,7 +526,8 @@ function Endpoints(props) {
}
}
} else if (sandbox.type === 'apikey') {
if (sandbox.apiKeyValue === null && endpointConfig.sandbox_endpoints) {
if ((sandbox.apiKeyValue === null || sandbox.apiKeyValue === '') &&
endpointConfig.sandbox_endpoints) {
return {
isValid: false,
message: intl.formatMessage({
Expand Down

0 comments on commit 963221c

Please sign in to comment.