Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Browse files Browse the repository at this point in the history
…to development
  • Loading branch information
Derikyan committed Dec 15, 2024
2 parents 96a239a + 8f0446a commit ae2825c
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 59 deletions.
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/testData/expectedConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,13 @@ export const Import = {
v14AppBisonChatName: 'bison chat king',
v14AppImportedFilename: 'ai_dial_chat_history_1-4_version.json',
v19AppImportedFilename: 'ai_dial_chat_history_1-9_version.json',
importedAttachmentsFilename: 'ai_dial_chat_with_attachments.zip',
importedAttachmentsFilename: 'ai_dial_chat_with_attachments.dial',
importedConversationWithAttachmentsName: `test`,
importedGpt4VisionAttachmentName: 'SDRequestAttachment.png',
importedStableDiffusionAttachmentName: 'SDResponseAttachment.png',
v14AppFolderPromptName: 'Version 1.4 A*B',
oldVersionAppGpt35Message: '11 * 12 =',
importAttachmentExtension: '.zip',
importAttachmentExtension: '.dial',
};

export const Attachment = {
Expand Down
1 change: 1 addition & 0 deletions apps/chat-e2e/src/ui/pages/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export class BasePage {
throw new Error(`Download failed:`);
}
}

public async uploadData<T>(
uploadData: UploadDownloadData,
method: () => Promise<T>,
Expand Down
2 changes: 1 addition & 1 deletion apps/chat/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ DIAL_ROLES_FIELD="dial_roles"


# Application UI settings
ENABLED_FEATURES="conversations-section,prompts-section,top-settings,top-clear-conversation,top-chat-info,top-chat-model-settings,hide-top-context-menu,empty-chat-settings,hide-empty-chat-change-agent,header,footer,request-api-key,report-an-issue,likes,conversations-sharing,prompts-sharing,input-files,attachments-manager,conversations-publishing,prompts-publishing,custom-logo,input-links,custom-applications,message-templates,marketplace,quick-apps,code-apps,disallow-change-agent"
ENABLED_FEATURES="conversations-section,prompts-section,top-settings,top-clear-conversation,top-chat-info,top-chat-model-settings,empty-chat-settings,header,footer,request-api-key,report-an-issue,likes,conversations-sharing,prompts-sharing,input-files,attachments-manager,conversations-publishing,prompts-publishing,custom-logo,input-links,custom-applications,message-templates,marketplace,quick-apps,code-apps"
NEXT_PUBLIC_APP_NAME="Local Development APP Name"
NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT=""
NEXT_PUBLIC_DEFAULT_TEMPERATURE="1"
Expand Down
102 changes: 54 additions & 48 deletions apps/chat/src/components/Chat/ChatHeader/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,28 +186,50 @@ export const ChatHeader = ({
data-qa="chat-header"
>
{isShowChatInfo && (
<Tooltip
tooltip={conversation.name}
triggerClassName={classNames(
'truncate text-center',
isChatFullWidth &&
'flex h-full max-w-full items-center justify-center lg:max-w-[90%]',
conversation.publicationInfo?.action === PublishActions.DELETE &&
'text-error',
)}
>
<span
className={classNames(
'truncate whitespace-pre text-center',
!isChatFullWidth &&
'block max-w-full md:max-w-[330px] lg:max-w-[425px]',
isConversationInvalid && 'text-secondary',
<>
<Tooltip
tooltip={conversation.name}
triggerClassName={classNames(
'truncate text-center',
isChatFullWidth &&
'flex h-full max-w-full items-center justify-center lg:max-w-[90%]',
conversation.publicationInfo?.action ===
PublishActions.DELETE && 'text-error',
)}
data-qa="chat-title"
>
{conversation.name}
</span>
</Tooltip>
<span
className={classNames(
'truncate whitespace-pre text-center',
!isChatFullWidth &&
'block max-w-full md:max-w-[330px] lg:max-w-[425px]',
isConversationInvalid && 'text-secondary',
)}
data-qa="chat-title"
>
{conversation.name}
</span>
</Tooltip>
{publicVersionGroupId && (
<span className="h-[18px] border-l border-l-primary pl-2">
{!isReviewEntity ? (
<PublicVersionSelector
publicVersionGroupId={publicVersionGroupId}
onChangeSelectedVersion={handleChangeSelectedVersion}
/>
) : (
<p
className={classNames(
conversation.publicationInfo?.action ===
PublishActions.DELETE && 'text-error',
)}
data-qa="version"
>
{t('v.')} {conversation.publicationInfo?.version}
</p>
)}
</span>
)}
</>
)}
<div className="flex lg:[&>*:first-child]:border-l lg:[&>*:not(:first-child)]:pl-2 [&>*:not(:last-child)]:border-r [&>*:not(:last-child)]:pr-2 [&>*]:border-x-primary [&>*]:pl-2">
{isShowChatInfo && (
Expand Down Expand Up @@ -365,34 +387,6 @@ export const ChatHeader = ({
</button>
</Tooltip>
)}
{isPlayback && !isExternal && (
<button
className="cursor-pointer text-accent-primary"
onClick={onCancelPlaybackMode}
data-qa="cancel-playback-mode"
>
{screenState === ScreenState.MOBILE
? t('Stop')
: t('Stop playback')}
</button>
)}
{publicVersionGroupId &&
(!isReviewEntity ? (
<PublicVersionSelector
publicVersionGroupId={publicVersionGroupId}
onChangeSelectedVersion={handleChangeSelectedVersion}
/>
) : (
<p
className={classNames(
conversation.publicationInfo?.action ===
PublishActions.DELETE && 'text-error',
)}
data-qa="version"
>
{t('v.')} {conversation.publicationInfo?.version}
</p>
))}

{isContextMenuVisible && (
<ConversationContextMenu
Expand All @@ -406,6 +400,18 @@ export const ChatHeader = ({
/>
)}

{isPlayback && !isExternal && (
<button
className="cursor-pointer text-accent-primary"
onClick={onCancelPlaybackMode}
data-qa="cancel-playback-mode"
>
{screenState === ScreenState.MOBILE
? t('Stop')
: t('Stop playback')}
</button>
)}

{isCompareMode && selectedConversationIds.length > 1 && (
<Tooltip
isTriggerClickable
Expand Down
4 changes: 2 additions & 2 deletions apps/chat/src/components/Chat/ModelVersionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const VersionPrefix = () => {
const { t } = useTranslation(Translation.Chat);

return (
<div className="flex items-center gap-2">
<div className="mr-2 flex items-center">
<span className="hidden md:block">{t('Version: ')}</span>
<span className="md:hidden">{t('v. ')}</span>
</div>
Expand Down Expand Up @@ -52,7 +52,7 @@ export const ModelVersionSelect = ({
if (entities.length && entities[0].version) {
return (
<div
className={classNames('flex gap-2 truncate', className)}
className={classNames('flex truncate', className)}
data-qa="version"
>
{showVersionPrefix && <VersionPrefix />}
Expand Down
2 changes: 1 addition & 1 deletion apps/chat/src/components/Chat/TalkTo/TalkToCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export const TalkToCard = ({
<ModelIcon entityId={entity.id} entity={entity} size={iconSize} />
)}
</div>
<div className="flex grow flex-col justify-center gap-2 overflow-hidden leading-4">
<div className="flex grow flex-col justify-center overflow-hidden leading-4">
{!!versionsToSelect.length && (
<div className="flex items-center">
<p className="mr-1 text-xs text-secondary">{t('Version')}: </p>
Expand Down
5 changes: 3 additions & 2 deletions apps/chat/src/components/Settings/Import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ export const Import: FC<CustomTriggerMenuRendererProps> = ({
className="sr-only"
tabIndex={-1}
type="file"
accept="application/json, application/x-zip-compressed, application/zip"
accept=".json, .zip, .dial"
onClick={onClickHandler}
onChange={(e) => {
if (!e.target.files?.length) return;
const file = e.target.files[0];

if (
file.type === 'application/zip' ||
file.type === 'application/x-zip-compressed'
file.type === 'application/x-zip-compressed' ||
file.name.endsWith('.dial')
) {
typedImportHandler?.({ content: file, zip: true });
return;
Expand Down
5 changes: 3 additions & 2 deletions apps/chat/src/store/models/models.reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ export const modelsSlice = createSlice({
const isDefaultModelAvailable = state.models.some(
({ id }) => id === payload.defaultModelId,
);
if (payload.localStorageRecentModelsIds) {

if (payload.localStorageRecentModelsIds?.length) {
state.recentModelsIds = payload.localStorageRecentModelsIds;
} else if (payload.defaultRecentModelsIds.length !== 0) {
} else if (payload.defaultRecentModelsIds.length) {
state.recentModelsIds = payload.defaultRecentModelsIds;
} else if (payload.defaultModelId && isDefaultModelAvailable) {
state.recentModelsIds = [payload.defaultModelId];
Expand Down
2 changes: 1 addition & 1 deletion apps/chat/src/utils/app/zip-import-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const downloadExportZip = (content: string, fileName?: string) => {
const downloadName = getDownloadFileName(fileName);
triggerDownload(
`data:application/zip;base64,${content}`,
`${downloadName}_chat_with_attachments_${currentDate()}.zip`,
`${downloadName}_chat_with_attachments_${currentDate()}.dial`,
);
};

Expand Down
1 change: 1 addition & 0 deletions apps/chat/src/utils/server/get-common-page-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { URL, URLSearchParams } from 'url';
const disabledFeaturesForIsolatedView = new Set([
Feature.ConversationsSection,
Feature.PromptsSection,
Feature.MessageTemplates,
]);

const hiddenFeaturesForIsolatedView = [
Expand Down

0 comments on commit ae2825c

Please sign in to comment.