mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-8201] Knowledge Retrieval - getting AI response for one or more selected files (#4127)
* [ACS-8202] basic flow getting ai response for one or more selected files (#3936) * ACS-8202 Added animated icon * ACS-8202 Added search ai input * ACS-8202 Added AI search results page * ACS-8202 Allow to run knowledge retrieval on files inside library, shared, favourites and recent files * ACS-8202 Hide icon when selected more than 100 files or non text files * ACS-8202 Display notification when too many files are selected * ACS-8202 Added agents dropdown * ACS-8202 Styles for AI response * ACS-8202 Applied design changes * ACS-8202 Added query card to Knowledge retrieval page results * ACS-8202 Fixed search collapsing when opened results page * ACS-8202 Changed placeholder in input for results page, wrapping text and scrolling for results page * ACS-8202 Display snackbar with messages when conditions are not met * ACS-8202 Disallow run knowledge retrieval for libraries, leave input when click on x button * ACS-8202 Renaming files * ACS-8202 Trigger ai input by selecting agent instead of clicking on button * ACS-8202 Reverted triggering showing input by selecting option from select * ACS-8202 Display dropdown with agents by clicking on button * ACS-8202 Structural changes - services and agents button component * ACS-8202 Removed part for examples from search page * ACS-8202 Simplified html for search page * ACS-8202 Refactored html and styles for search page, translations for search page * ACS-8202 More html and styles refactoring * ACS-8202 Formatting html * ACS-8202 Removed references to angular material classes * ACS-8202 Added data automation id attributes * ACS-8202 Load agents from backend, formatting html for agents button component and adding data automation ids to that component * ACS-8202 Correction after rebase * ACS-8202 Set agent for input based on selected agent from dropdown for agents button * ACS-8202 Hide agent button for libraries pages and use translations for warnings when clicked on agents button * ACS-8202 Pass agent id to search results page * ACS-8202 Used form control instead of ngmodel for search query * ACS-8202 Moved search ai service and search ai input state to ADF * ACS-8202 Results page ts clean up * ACS-8202 Used ask and getAnswer functions from search ai service * ACS-8202 Cleaning of search ai navigation service * ACS-8202 Small clean ups * ACS-8202 Renamed sources to references * ACS-8202 Fixed asking next question from results page * ACS-8202 Added possibility to use knowledge retrieval from search results page * ACS-8202 Fixed issue with selecting the same agent after previously closing input on search results page * ACS-8202 Disallowed using knowledge retrieval on trash page * ACS-8202 Hide toggling knowledge retrieval for tasks and processes, fixed displaying ask button for favorites page * ACS-8202 Removed redundant image and function * ACS-8202 Renamed breadcrumbTemplate to header * ACS-8202 Removed redundant code, added some comments, made some fields as private * ACS-8202 Display error message on search page * ACS-8202 Accessibility changes * ACS-8202 Small correction * ACS-8202 Addressed comments * ACS-8202 Displayed correct initials * ACS-8202 Removed redundant imports * ACS-8202 Change css value * ACS-8202 Removed icon animation * ACS-8202 Removed icon animation * ACS-8201 Small correction after rebasing with Angular 15 * [ACS-8398] unit tests (#3973) * ACS-8398 Unit tests for agents button and part for agents menu * ACS-8398 Unit tests for search ai input component * [ACS-8210] Agent basic details popup (#3942) * [ACS-8210] Agent basic details popup * [ACS-8210] Agent basic details popup - review fixes --------- Co-authored-by: Aleksander Sklorz <aleksander.sklorz@hyland.com> * [ACS-8382] Blurring the AI answer section before getting response from backend (#3948) * [ACS-8398] Unit tests part 2 (#3989) * ACS-8398 Unit tests for search ai input container * ACS-8398 Unit tests for search ai navigation service and rest tests for search ai input container component * ACS-8398 Added missing type * [ACS-8484] Add feature flag to knowledge retrieval (#4003) * [ACS-8562] "Ask Agent" button name is changed to "Ask Discovery" * [ACS-8573] Allow user to ask question without file selection * [ACS-8312] Display warning about losing response (#4012) * ACS-8201 Fixed issues after rebase * [ACS-8588] Navigation is triggered twice when leaving Knowledge Retrieval page (#4030) [ACS-8588] Navigation is triggered twice when leaving Knowledge Retrieval page * [ACS-8399] Integrate all changes with backend (#4076) * [ACS-8399] Integrate all changes with backend * [ACS-8399] Integrate all changes with backend - review fixes * Answers endpoint fix * Answers endpoint fix (#4107) * [ACS-8664] generic question redirection to hx insight page (#4102) * ACS-8664 Open page in new tab * ACS-8664 Loading HX insight url * ACS-8664 Unit tests * ACS-8664 Fix after rebasing * ACS-8664 Fixed unit tests * ACS-8664 Added type * ACS-8664 Removed duplicated lines * ACS-8664 Removed duplicated lines * ACS-8664 Addressed comments * [ACS-8695] Getting Agent avatar (#4110) * [ACS-8695] Getting Agent avatar * [ACS-8695] Getting Agent avatar - fixes * [ACS-8695] Getting Agent avatar - fixes 2 * Adding mocked agent avatars (#4117) * [ACS-8201] review fixes * [ACS-8201] review fixes * [E2E] excluded failing tests to fix later pt.1 * [ACS-8767] allow to open referenced files (#4129) * ACS-8767 Opening referenced files * ACS-8767 Reverted one line * ACS-8767 Removed unwanted code * ACS-8767 * ACS-8767 Unit tests for allowing clicking on references * ACS-8767 Unit tests * ACS-8767 Moved duplicated code to function * ACS-8767 Resolved sonar issue * ACS-8767 Resolved sonar issue * [ACS-8201] knowledge retrieval feature flag - false * [E2E] excluded failing tests to fix later pt.2 * ACS-8201 Fixed tests --------- Co-authored-by: AleksanderSklorz <115619721+AleksanderSklorz@users.noreply.github.com> Co-authored-by: Aleksander Sklorz <Aleksander.Sklorz@hyland.com> Co-authored-by: datguychen <adam.swiderski@hyland.com>
This commit is contained in:
@@ -215,4 +215,9 @@ describe('ViewerService', () => {
|
||||
const ids = await viewerService.getFileIds('libraries', null);
|
||||
expect(ids).toEqual([]);
|
||||
});
|
||||
|
||||
it('should return custom nodes order if did not find nodes', async () => {
|
||||
viewerService.customNodesOrder = ['someNode1', 'someNode2'];
|
||||
expect(await viewerService.getFileIds('', null)).toEqual(['someNode1', 'someNode2']);
|
||||
});
|
||||
});
|
||||
|
@@ -36,6 +36,12 @@ interface AdjacentFiles {
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ViewerService {
|
||||
private _customNodesOrder: string[] = [];
|
||||
|
||||
set customNodesOrder(customNodesOrder: string[]) {
|
||||
this._customNodesOrder = customNodesOrder;
|
||||
}
|
||||
|
||||
constructor(private preferences: UserPreferencesService, private contentApi: ContentApiService) {}
|
||||
|
||||
recentFileFilters = [
|
||||
@@ -103,7 +109,6 @@ export class ViewerService {
|
||||
}
|
||||
const isClient = this.preferences.get(`${source}.sorting.mode`) === 'client';
|
||||
const [sortKey, sortDirection, previousSortKey, previousSortDir] = this.getSortKeyDir(source);
|
||||
let entries: Node[] | SharedLink[] = [];
|
||||
let nodes: NodePaging | FavoritePaging | SharedLinkPaging | ResultSetPaging;
|
||||
|
||||
if (source === 'personal-files' || source === 'libraries-files') {
|
||||
@@ -164,15 +169,7 @@ export class ViewerService {
|
||||
};
|
||||
nodes = await this.contentApi.search(query).toPromise();
|
||||
}
|
||||
|
||||
entries = nodes.list.entries.map((obj) => obj.entry.target?.file ?? obj.entry);
|
||||
if (isClient) {
|
||||
if (previousSortKey) {
|
||||
this.sort(entries, previousSortKey, previousSortDir);
|
||||
}
|
||||
this.sort(entries, sortKey, sortDirection);
|
||||
}
|
||||
return entries.map((entry) => entry.id ?? entry.nodeId);
|
||||
return this.getCustomNodesOrderIfNoNodes(nodes, isClient, previousSortKey, previousSortDir, sortKey, sortDirection);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,4 +221,26 @@ export class ViewerService {
|
||||
return ['modifiedAt', 'desc'];
|
||||
}
|
||||
}
|
||||
|
||||
private getCustomNodesOrderIfNoNodes(
|
||||
nodes: NodePaging | FavoritePaging | SharedLinkPaging | ResultSetPaging,
|
||||
isClient: boolean,
|
||||
previousSortKey: string,
|
||||
previousSortDir: string,
|
||||
sortKey: string,
|
||||
sortDirection: string
|
||||
): string[] {
|
||||
if (nodes) {
|
||||
const entries = nodes.list.entries.map((obj) => obj.entry.target?.file ?? obj.entry);
|
||||
if (isClient) {
|
||||
if (previousSortKey) {
|
||||
this.sort(entries, previousSortKey, previousSortDir);
|
||||
}
|
||||
this.sort(entries, sortKey, sortDirection);
|
||||
}
|
||||
return entries.map((entry) => entry.id ?? entry.nodeId);
|
||||
} else {
|
||||
return this._customNodesOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,3 +29,4 @@
|
||||
export * from './lib/components/viewer/viewer.component';
|
||||
export * from './lib/components/preview/preview.component';
|
||||
export * from './lib/viewer.module';
|
||||
export * from './lib/services/viewer.service';
|
||||
|
Reference in New Issue
Block a user