Skip to content

Commit

Permalink
Merge branch 'fix/3040-upload-files-to-the-shared-folder' of https://…
Browse files Browse the repository at this point in the history
…github.com/epam/ai-dial-chat into fix/3040-upload-files-to-the-shared-folder
  • Loading branch information
denys-kolomiitsev committed Jan 30, 2025
2 parents 6c7ddfb + b5bd796 commit 26e4fbe
Show file tree
Hide file tree
Showing 167 changed files with 889 additions and 653 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
gitlab-dev-deploy:
if: ${{ github.event.registry_package.package_version.container_metadata.tag.name == 'development' }}
uses: epam/ai-dial-ci/.github/workflows/[email protected].0
uses: epam/ai-dial-ci/.github/workflows/[email protected].1
with:
gitlab-project-id: "1827"
secrets:
Expand All @@ -16,7 +16,7 @@ jobs:

gitlab-dev-deploy-overlay:
if: ${{ github.event.registry_package.package_version.container_metadata.tag.name == 'development' }}
uses: epam/ai-dial-ci/.github/workflows/[email protected].0
uses: epam/ai-dial-ci/.github/workflows/[email protected].1
with:
gitlab-project-id: "1856"
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
e2e-tests:
if: ${{ github.event.registry_package.package_version.container_metadata.tag.name == 'development' }}
uses: epam/ai-dial-ci/.github/workflows/[email protected].0
uses: epam/ai-dial-ci/.github/workflows/[email protected].1
with:
gitlab-project-id: "1843"
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ concurrency:

jobs:
pr-title-check:
uses: epam/ai-dial-ci/.github/workflows/[email protected].0
uses: epam/ai-dial-ci/.github/workflows/[email protected].1
secrets:
ACTIONS_BOT_TOKEN: ${{ secrets.ACTIONS_BOT_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
run_tests:
uses: epam/ai-dial-ci/.github/workflows/[email protected].0
uses: epam/ai-dial-ci/.github/workflows/[email protected].1
secrets: inherit
with:
ort_version: 42.1.0
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
release:
uses: epam/ai-dial-ci/.github/workflows/[email protected].0
uses: epam/ai-dial-ci/.github/workflows/[email protected].1
secrets: inherit
with:
ort_version: 42.1.0
2 changes: 1 addition & 1 deletion apps/chat-e2e/src/testData/expectedConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const ExpectedConstants = {
controlChars: `\b\t \f`,
hieroglyphChars: `あおㅁㄹñ¿äß맞습니다. 한국어 학습의 인기는 그 나라의 문화와 경제뿐만 아니라 언어 자체의 매력에서도 비롯됩니다. 한국어는 한글이라는 고유한 문자 시스템을 사용하는데, 이는 15세기에 세종대왕에 의해 창안되었습니다. 한글은 그 논리적이고 과학적인 설계로 인해 배우기 쉬운 것으로 여겨지며, 이 또`,
attachedFileError: (filename: string) =>
`You've trying to upload files with incorrect type: ${filename}`,
`You're trying to upload files with incorrect type: ${filename}`,
allowedSpecialChars: "(`~!@#$^*-_+[]'|<>.?)",
allowedSpecialSymbolsInName: () =>
`Test ${ExpectedConstants.allowedSpecialChars}`,
Expand Down
4 changes: 2 additions & 2 deletions apps/chat/src/components/Chat/ChangePathDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react';

import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { updateEntitiesFoldersAndIds } from '@/src/utils/app/common';
import { constructPath } from '@/src/utils/app/file';
Expand Down Expand Up @@ -159,7 +159,7 @@ export const ChangePathDialog = ({
setSelectedFolderId(newFolderId);

if (error) {
setErrorMessage(t(error) as string);
setErrorMessage(t(error));
return;
}
const { updatedOpenedFoldersIds } = updateEntitiesFoldersAndIds(
Expand Down
10 changes: 5 additions & 5 deletions apps/chat/src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
useState,
} from 'react';

import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { useTranslation } from '@/src/hooks/useTranslation';

import { clearStateForMessages } from '@/src/utils/app/clear-messages-state';
import {
excludeSystemMessages,
Expand Down Expand Up @@ -755,7 +755,7 @@ export const ChatView = memo(() => {
/>
)}

{!isPlayback && <ChatStarters />}
<ChatStarters />

{!isPlayback && (
<ChatInput
Expand Down Expand Up @@ -907,7 +907,7 @@ export function Chat() {
<div className="h-screen pt-2">
<NotFoundEntity
entity={t('Agent is')}
additionalText={t('Please contact your administrator.') || ''}
additionalText={t('Please contact your administrator.')}
/>
</div>
);
Expand All @@ -930,7 +930,7 @@ export function Chat() {
return (
<NotFoundEntity
entity={t('Conversation')}
additionalText={t('Please select another conversation.') || ''}
additionalText={t('Please select another conversation.')}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/chat/src/components/Chat/ChatCompareRotate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { Translation } from '@/src/types/translation';

Expand Down
4 changes: 2 additions & 2 deletions apps/chat/src/components/Chat/ChatCompareSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IconCheck } from '@tabler/icons-react';
import { ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react';

import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { isValidConversationForCompare } from '@/src/utils/app/conversation';
import { sortByName } from '@/src/utils/app/folders';
Expand Down Expand Up @@ -171,7 +171,7 @@ export const ChatCompareSelect = ({
<input
value={searchValue}
onChange={(e) => setSearchValue(e.target.value)}
placeholder={t('Search conversations') ?? ''}
placeholder={t('Search conversations')}
className="input-form peer"
data-qa="search-compare-conversation"
/>
Expand Down
7 changes: 2 additions & 5 deletions apps/chat/src/components/Chat/ChatHeader/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import {
} from '@tabler/icons-react';
import { useCallback, useEffect, useMemo, useState } from 'react';

import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { usePublicVersionGroupId } from '@/src/hooks/usePublicVersionGroupIdFromPublicEntity';
import { useScreenState } from '@/src/hooks/useScreenState';
import { useTranslation } from '@/src/hooks/useTranslation';

import { isEntityNameOrPathInvalid } from '@/src/utils/app/common';
import {
Expand Down Expand Up @@ -454,9 +453,7 @@ export const ChatHeader = Inversify.register(
<ConfirmDialog
isOpen={isClearConversationModalOpen}
heading={t('Confirm deleting all messages in the conversation')}
description={
t('Are you sure that you want to delete all messages?') || ''
}
description={t('Are you sure that you want to delete all messages?')}
confirmLabel={t('Delete')}
cancelLabel={t('Cancel')}
onClose={(result) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { getOpenAIEntityFullName } from '@/src/utils/app/conversation';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { useTranslation } from '@/src/hooks/useTranslation';

import { getOpenAIEntityFullName } from '@/src/utils/app/conversation';

import { DialAIEntityAddon, DialAIEntityModel } from '@/src/types/models';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IconPlayerPlay } from '@tabler/icons-react';

import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { Translation } from '@/src/types/translation';

Expand Down
4 changes: 2 additions & 2 deletions apps/chat/src/components/Chat/ChatInput/ChatControls.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { IconPlayerPlay } from '@tabler/icons-react';
import { FC, useCallback } from 'react';

import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { useTranslation } from '@/src/hooks/useTranslation';

import { Translation } from '@/src/types/translation';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IconCopy } from '@tabler/icons-react';

import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { isEntityIdExternal } from '@/src/utils/app/id';

Expand Down
11 changes: 4 additions & 7 deletions apps/chat/src/components/Chat/ChatInput/ChatInputMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import {
useState,
} from 'react';

import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { usePromptSelection } from '@/src/hooks/usePromptSelection';
import { useTokenizer } from '@/src/hooks/useTokenizer';
import { useTranslation } from '@/src/hooks/useTranslation';

import { getUserCustomContent } from '@/src/utils/app/file';
import {
Expand Down Expand Up @@ -590,11 +589,9 @@ export const ChatInputMessage = Inversify.register(
<ConfirmDialog
isOpen={isPromptLimitModalOpen}
heading={t('Prompt limit exceeded')}
description={
t(
`Prompt limit is ${maxTokensLength} tokens. ${getPromptLimitDescription(getTokensLength(content), maxTokensLength)}`,
) || ''
}
description={t(
`Prompt limit is ${maxTokensLength} tokens. ${getPromptLimitDescription(getTokensLength(content), maxTokensLength)}`,
)}
confirmLabel={t('Confirm')}
onClose={() => {
setIsPromptLimitModalOpen(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
useState,
} from 'react';

import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { useTranslation } from '@/src/hooks/useTranslation';

import { hasParentWithAttribute } from '@/src/utils/app/modals';
import { parseVariablesFromContent } from '@/src/utils/app/prompts';
import { onBlur } from '@/src/utils/app/style-helpers';
Expand Down Expand Up @@ -203,11 +203,9 @@ export const PromptVariablesDialog: FC<Props> = ({
style={{ resize: 'none' }}
required
title=""
placeholder={
t('Enter a value for {{key}}...', {
key: variable.key,
}) as string
}
placeholder={t('Enter a value for {{key}}...', {
key: variable.key,
})}
value={variable.value}
onBlur={(e) => {
handleOnBlur(index, e);
Expand Down
4 changes: 2 additions & 2 deletions apps/chat/src/components/Chat/ChatInput/ReplayVariables.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from 'react';

import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import {
getEntitiesFromTemplateMapping,
Expand Down Expand Up @@ -62,7 +62,7 @@ const ReplayVariablesDialog = () => {
replayUserMessagesStack:
conversation.replay.replayUserMessagesStack.map(
(message, index) =>
(index === conversation.replay?.activeReplayIndex ?? 0)
index === (conversation.replay?.activeReplayIndex ?? 0)
? {
...message,
content: newContent,
Expand Down
10 changes: 4 additions & 6 deletions apps/chat/src/components/Chat/ChatInput/SchemaCompareWarning.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { Translation } from '@/src/types/translation';

Expand All @@ -11,11 +11,9 @@ export const SchemaCompareWarning = () => {
<div className="flex justify-center">
<div className="max-w-2xl">
<ErrorMessage
error={
t(
'Compare Mode is unavailable with agents requiring a configuration. Please either select a single chat or switch to agents without configuration schema to continue.',
) ?? ''
}
error={t(
'Compare Mode is unavailable with agents requiring a configuration. Please either select a single chat or switch to agents without configuration schema to continue.',
)}
type="warning"
/>
</div>
Expand Down
8 changes: 8 additions & 0 deletions apps/chat/src/components/Chat/ChatInput/SendMessageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {

import classNames from 'classnames';

import { useTranslation } from '@/src/hooks/useTranslation';

import { Translation } from '@/src/types/translation';

import { ConversationsSelectors } from '@/src/store/conversations/conversations.reducers';
import { useAppSelector } from '@/src/store/hooks';
import { ModelsSelectors } from '@/src/store/models/models.reducers';
Expand All @@ -28,6 +32,8 @@ interface Props {
export const SendMessageButton = Inversify.register(
'SendMessageButton',
({ isLastMessageError, onSend, isDisabled, tooltip, isLoading }: Props) => {
const { t } = useTranslation(Translation.Chat);

const isModelsLoading = useAppSelector(
ModelsSelectors.selectModelsIsLoading,
);
Expand All @@ -52,6 +58,7 @@ export const SendMessageButton = Inversify.register(
isLastMessageError && 'text-error',
isOverlay ? 'right-3' : 'right-4',
)}
aria-label={t('Send a message')}
onClick={onSend}
data-qa="regenerate"
>
Expand All @@ -73,6 +80,7 @@ export const SendMessageButton = Inversify.register(
'absolute top-[calc(50%_-_12px)] rounded hover:text-accent-primary disabled:cursor-not-allowed disabled:text-secondary',
isOverlay ? 'right-3' : 'right-4',
)}
aria-label={t('Send a message')}
onClick={onSend}
disabled={disabled}
data-qa={dataQa}
Expand Down
6 changes: 2 additions & 4 deletions apps/chat/src/components/Chat/ChatMessage/ChatMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, memo, useCallback, useEffect, useState } from 'react';

import { useTranslation } from 'next-i18next';
import { useTranslation } from '@/src/hooks/useTranslation';

import { isEntityNameOrPathInvalid } from '@/src/utils/app/common';
import { isMobile, isSmallScreen } from '@/src/utils/app/mobile';
Expand Down Expand Up @@ -203,9 +203,7 @@ export const ChatMessage: FC<Props> = memo(
<ConfirmDialog
isOpen={isDeleteConfirmationOpened}
heading={t('Confirm deleting message')}
description={
t('Are you sure that you want to delete the message?') || ''
}
description={t('Are you sure that you want to delete the message?')}
confirmLabel={t('Delete')}
cancelLabel={t('Cancel')}
onClose={(result) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { memo } from 'react';

import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { useTranslation } from '@/src/hooks/useTranslation';

import { isEntityNameOrPathInvalid } from '@/src/utils/app/common';

import { Conversation } from '@/src/types/chat';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { IconPaperclip } from '@tabler/icons-react';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';

import { useTranslation } from 'next-i18next';

import classNames from 'classnames';

import { useTranslation } from '@/src/hooks/useTranslation';

import { isEntityNameOrPathInvalid } from '@/src/utils/app/common';
import {
getDialFilesFromAttachments,
Expand Down Expand Up @@ -112,6 +112,7 @@ export const UserMessage = memo(function UserMessage({
SettingsSelectors.isFeatureEnabled(state, Feature.MessageTemplates),
);
const isChatFullWidth = useAppSelector(UISelectors.selectIsChatFullWidth);

const isMobileOrOverlay = isSmallScreen() || isOverlay;
const isInputDisabled = isMessageInputDisabled(messageIndex, allMessages);

Expand Down
Loading

0 comments on commit 26e4fbe

Please sign in to comment.