🔧 fix: Model Key Retrieval to Account for Bedrock Regions (#5029)

* 🔧 fix: model key retrieval logic to account for Bedrock region

* fix: edit preset dialog styling and potential max depth error with agents endpoint
This commit is contained in:
Danny Avila 2024-12-17 23:04:51 -05:00 committed by GitHub
parent d3cafeee96
commit 649c7a6032
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 46 additions and 23 deletions

View file

@ -49,7 +49,11 @@ export enum BedrockProviders {
export const getModelKey = (endpoint: EModelEndpoint | string, model: string) => {
if (endpoint === EModelEndpoint.bedrock) {
return model.split('.')[0] as BedrockProviders;
const parts = model.split('.');
const provider = [parts[0], parts[1]].find((part) =>
Object.values(BedrockProviders).includes(part as BedrockProviders),
);
return (provider ?? parts[0]) as BedrockProviders;
}
return model;
};