Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/e2e-publishing-preparation'…
Browse files Browse the repository at this point in the history
… into feat/e2e-publishing-preparation
  • Loading branch information
irinakartun committed Sep 16, 2024
2 parents 344dbd2 + e1b87f3 commit 69cadcf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 13 additions & 1 deletion apps/chat/src/components/Chatbar/ModelIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import SVG from 'react-inlinesvg';
import classNames from 'classnames';

import { getOpenAIEntityFullName } from '@/src/utils/app/conversation';
import { constructPath } from '@/src/utils/app/file';
import { isApplicationId } from '@/src/utils/app/id';
import { getThemeIconUrl } from '@/src/utils/app/themes';

import { EntityType } from '@/src/types/common';
Expand Down Expand Up @@ -34,6 +36,16 @@ const ModelIconTemplate = memo(
: getThemeIconUrl('default-model');
const description = entity ? getOpenAIEntityFullName(entity) : entityId;

const getIconUrl = (entity: DialAIEntity | undefined) => {
if (!entity?.iconUrl) return '';

if (isApplicationId(entity.id)) {
return constructPath('api', entity.iconUrl);
}

return `${getThemeIconUrl(entity.iconUrl)}?v2`;
};

return (
<span
className={classNames(
Expand All @@ -46,7 +58,7 @@ const ModelIconTemplate = memo(
>
<SVG
key={entityId}
src={entity?.iconUrl ? `${getThemeIconUrl(entity.iconUrl)}?v2` : ''}
src={getIconUrl(entity)}
className={classNames(!entity?.iconUrl && 'hidden')}
width={size}
height={size}
Expand Down
8 changes: 3 additions & 5 deletions apps/chat/src/components/Common/ApplicationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { constructPath, notAllowedSymbols } from '@/src/utils/app/file';
import { notAllowedSymbols } from '@/src/utils/app/file';
import { getFolderIdFromEntityId } from '@/src/utils/app/folders';
import { ApiUtils } from '@/src/utils/server/api';

Expand Down Expand Up @@ -136,11 +136,9 @@ const ApplicationDialogView: React.FC<Props> = ({
const newFile = files.find((file) => file.id === selectedFileId);

if (newFile) {
const newIconUrl = constructPath('api', newFile.id);

setDeleteLogo(false);
setLocalLogoFile(newIconUrl);
setValue('iconUrl', newIconUrl);
setLocalLogoFile(newFile.id);
setValue('iconUrl', newFile.id);
trigger('iconUrl');
} else {
setLocalLogoFile(undefined);
Expand Down

0 comments on commit 69cadcf

Please sign in to comment.