feat: AWS Bedrock icons

This commit is contained in:
Danny Avila 2024-09-02 15:11:06 -04:00
parent 7d54f7147f
commit 11eb215922
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364
5 changed files with 91 additions and 46 deletions

View file

@ -568,7 +568,7 @@ export const alternateName = {
[EModelEndpoint.google]: 'Google',
[EModelEndpoint.anthropic]: 'Anthropic',
[EModelEndpoint.custom]: 'Custom',
[EModelEndpoint.bedrock]: 'Bedrock',
[EModelEndpoint.bedrock]: 'AWS Bedrock',
};
const sharedOpenAIModels = [

View file

@ -190,7 +190,7 @@ export const parseConvo = ({
// TODO: POC for default schema
// defaultSchema?: Partial<EndpointSchema>,
}) => {
let schema = endpointSchemas[endpoint];
let schema = endpointSchemas[endpoint] as EndpointSchema | undefined;
if (!schema && !endpointType) {
throw new Error(`Unknown endpoint: ${endpoint}`);
@ -202,14 +202,14 @@ export const parseConvo = ({
// schema = schemaCreators[endpoint](defaultSchema);
// }
const convo = schema.parse(conversation) as s.TConversation;
const convo = schema?.parse(conversation) as s.TConversation | undefined;
const { models, secondaryModels } = possibleValues ?? {};
if (models && convo) {
convo.model = getFirstDefinedValue(models) ?? convo.model;
}
if (secondaryModels && convo.agentOptions) {
if (secondaryModels && convo?.agentOptions) {
convo.agentOptions.model = getFirstDefinedValue(secondaryModels) ?? convo.agentOptions.model;
}
@ -217,9 +217,17 @@ export const parseConvo = ({
};
export const getResponseSender = (endpointOption: t.TEndpointOption): string => {
const { model, endpoint, endpointType, modelDisplayLabel, chatGptLabel, modelLabel, jailbreak } =
endpointOption;
const {
model: _m,
endpoint,
endpointType,
modelDisplayLabel,
chatGptLabel,
modelLabel,
jailbreak,
} = endpointOption;
const model = _m ?? '';
if (
[
EModelEndpoint.openAI,
@ -232,14 +240,14 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string =>
return chatGptLabel;
} else if (model && model.includes('gpt-3')) {
return 'GPT-3.5';
} else if (model && model.includes('gpt-4')) {
return 'GPT-4';
} else if (model && model.includes('gpt-4o')) {
return 'GPT-4o';
} else if (model && model.includes('gpt-4')) {
return 'GPT-4';
} else if (model && model.includes('mistral')) {
return 'Mistral';
}
return alternateName[endpoint] ?? 'ChatGPT';
return (alternateName[endpoint] as string | undefined) ?? 'ChatGPT';
}
if (endpoint === EModelEndpoint.bingAI) {
@ -250,6 +258,10 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string =>
return modelLabel ?? 'Claude';
}
if (endpoint === EModelEndpoint.bedrock) {
return modelLabel ?? alternateName[endpoint];
}
if (endpoint === EModelEndpoint.google) {
if (modelLabel) {
return modelLabel;
@ -271,6 +283,8 @@ export const getResponseSender = (endpointOption: t.TEndpointOption): string =>
return 'Mistral';
} else if (model && model.includes('gpt-3')) {
return 'GPT-3.5';
} else if (model && model.includes('gpt-4o')) {
return 'GPT-4o';
} else if (model && model.includes('gpt-4')) {
return 'GPT-4';
} else if (modelDisplayLabel) {