mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-10 14:11:42 +00:00
[ACS-8432] Sending all file types to HX instead of only the text file types (#10087)
This commit is contained in:
committed by
Aleksander Sklorz
parent
bc8305b15e
commit
261d35b805
@@ -706,7 +706,6 @@
|
|||||||
"SEARCH": {
|
"SEARCH": {
|
||||||
"WARNINGS": {
|
"WARNINGS": {
|
||||||
"TOO_MANY_FILES_SELECTED": "Please select no more than {{ maxFiles }} files.",
|
"TOO_MANY_FILES_SELECTED": "Please select no more than {{ maxFiles }} files.",
|
||||||
"NON_TEXT_FILE_SELECTED": "Only text related files are compatible with AI Agents.",
|
|
||||||
"FOLDER_SELECTED": "Folders are not compatible with AI Agents."
|
"FOLDER_SELECTED": "Folders are not compatible with AI Agents."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -120,9 +120,7 @@ describe('SearchAiService', () => {
|
|||||||
describe('checkSearchAvailability', () => {
|
describe('checkSearchAvailability', () => {
|
||||||
let translateService: TranslateService;
|
let translateService: TranslateService;
|
||||||
|
|
||||||
const noFilesSelectedError = 'Please select some file.';
|
|
||||||
const tooManyFilesSelectedError = 'Please select no more than 100 files.';
|
const tooManyFilesSelectedError = 'Please select no more than 100 files.';
|
||||||
const nonTextFileSelectedError = 'Only text related files are compatible with AI Agents.';
|
|
||||||
const folderSelectedError = 'Folders are not compatible with AI Agents.';
|
const folderSelectedError = 'Folders are not compatible with AI Agents.';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -131,8 +129,6 @@ describe('SearchAiService', () => {
|
|||||||
switch (key) {
|
switch (key) {
|
||||||
case 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.TOO_MANY_FILES_SELECTED':
|
case 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.TOO_MANY_FILES_SELECTED':
|
||||||
return tooManyFilesSelectedError;
|
return tooManyFilesSelectedError;
|
||||||
case 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.NON_TEXT_FILE_SELECTED':
|
|
||||||
return nonTextFileSelectedError;
|
|
||||||
case 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.FOLDER_SELECTED':
|
case 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.FOLDER_SELECTED':
|
||||||
return folderSelectedError;
|
return folderSelectedError;
|
||||||
default:
|
default:
|
||||||
@@ -141,7 +137,7 @@ describe('SearchAiService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return error for no selected nodes', () => {
|
it('should not return error if user did not select any files', () => {
|
||||||
expect(
|
expect(
|
||||||
service.checkSearchAvailability({
|
service.checkSearchAvailability({
|
||||||
count: 0,
|
count: 0,
|
||||||
@@ -149,7 +145,7 @@ describe('SearchAiService', () => {
|
|||||||
libraries: [],
|
libraries: [],
|
||||||
isEmpty: true
|
isEmpty: true
|
||||||
})
|
})
|
||||||
).toBe(noFilesSelectedError);
|
).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return error for too many files selected', () => {
|
it('should return error for too many files selected', () => {
|
||||||
@@ -167,29 +163,24 @@ describe('SearchAiService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return error for non text file selected if non text file is selected and it is not a folder', () => {
|
it('should return error for folder selected', () => {
|
||||||
expect(
|
expect(
|
||||||
service.checkSearchAvailability({
|
service.checkSearchAvailability({
|
||||||
count: 1,
|
count: 1,
|
||||||
nodes: [
|
nodes: [
|
||||||
{
|
{
|
||||||
entry: {
|
entry: {
|
||||||
isFolder: false,
|
isFolder: true
|
||||||
content: {
|
|
||||||
mimeType: 'image/jpeg',
|
|
||||||
mimeTypeName: 'image/jpeg',
|
|
||||||
sizeInBytes: 100
|
|
||||||
}
|
|
||||||
} as Node
|
} as Node
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
libraries: [],
|
libraries: [],
|
||||||
isEmpty: false
|
isEmpty: false
|
||||||
})
|
})
|
||||||
).toBe(nonTextFileSelectedError);
|
).toBe(folderSelectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not return error for non text file selected if non text mime type node is selected and it is a folder', () => {
|
it('should return error for folder and if non text mime type node is selected', () => {
|
||||||
expect(
|
expect(
|
||||||
service.checkSearchAvailability({
|
service.checkSearchAvailability({
|
||||||
count: 1,
|
count: 1,
|
||||||
@@ -208,23 +199,6 @@ describe('SearchAiService', () => {
|
|||||||
libraries: [],
|
libraries: [],
|
||||||
isEmpty: false
|
isEmpty: false
|
||||||
})
|
})
|
||||||
).not.toBe(nonTextFileSelectedError);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return error for folder selected if', () => {
|
|
||||||
expect(
|
|
||||||
service.checkSearchAvailability({
|
|
||||||
count: 1,
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
entry: {
|
|
||||||
isFolder: true
|
|
||||||
} as Node
|
|
||||||
}
|
|
||||||
],
|
|
||||||
libraries: [],
|
|
||||||
isEmpty: false
|
|
||||||
})
|
|
||||||
).toBe(folderSelectedError);
|
).toBe(folderSelectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -235,7 +209,7 @@ describe('SearchAiService', () => {
|
|||||||
nodes: [
|
nodes: [
|
||||||
{
|
{
|
||||||
entry: {
|
entry: {
|
||||||
isFolder: false,
|
isFolder: true,
|
||||||
content: {
|
content: {
|
||||||
mimeType: 'image/jpeg',
|
mimeType: 'image/jpeg',
|
||||||
mimeTypeName: 'image/jpeg',
|
mimeTypeName: 'image/jpeg',
|
||||||
@@ -247,7 +221,7 @@ describe('SearchAiService', () => {
|
|||||||
libraries: [],
|
libraries: [],
|
||||||
isEmpty: false
|
isEmpty: false
|
||||||
})
|
})
|
||||||
).toBe(`${tooManyFilesSelectedError} ${nonTextFileSelectedError}`);
|
).toBe(`${tooManyFilesSelectedError} ${folderSelectedError}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -28,15 +28,6 @@ import { SearchAiInputState } from '../models/search-ai-input-state';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SearchAiService {
|
export class SearchAiService {
|
||||||
private readonly textFileMimeTypes = [
|
|
||||||
'application/msword',
|
|
||||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
||||||
'application/vnd.oasis.opendocument.text',
|
|
||||||
'application/rtf',
|
|
||||||
'text/plain',
|
|
||||||
'application/pdf'
|
|
||||||
];
|
|
||||||
|
|
||||||
private toggleSearchAiInput = new BehaviorSubject<SearchAiInputState>({
|
private toggleSearchAiInput = new BehaviorSubject<SearchAiInputState>({
|
||||||
active: false
|
active: false
|
||||||
});
|
});
|
||||||
@@ -139,11 +130,6 @@ export class SearchAiService {
|
|||||||
maxFiles: maxSelectedNodes
|
maxFiles: maxSelectedNodes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (selectedNodesState.nodes.some((node) => !node.entry.isFolder && !this.textFileMimeTypes.includes(node.entry.content.mimeType))) {
|
|
||||||
messages.push({
|
|
||||||
key: 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.NON_TEXT_FILE_SELECTED'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (selectedNodesState.nodes.some((node) => node.entry.isFolder)) {
|
if (selectedNodesState.nodes.some((node) => node.entry.isFolder)) {
|
||||||
messages.push({
|
messages.push({
|
||||||
key: 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.FOLDER_SELECTED'
|
key: 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.FOLDER_SELECTED'
|
||||||
|
Reference in New Issue
Block a user