[ACS-9564] Fix rendering of Knowledge Retrieval answer after change in answer structure

This commit is contained in:
Aleksander Sklorz
2025-04-25 13:48:23 +02:00
parent 130f979514
commit c250b4e7d7
4 changed files with 412 additions and 279 deletions

661
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -30,11 +30,11 @@
},
"private": true,
"dependencies": {
"@alfresco/adf-content-services": "8.1.0-14605928703",
"@alfresco/adf-core": "8.1.0-14605928703",
"@alfresco/adf-extensions": "8.1.0-14605928703",
"@alfresco/eslint-plugin-eslint-angular": "8.1.0-14605928703",
"@alfresco/js-api": "9.1.0-14605928703",
"@alfresco/adf-content-services": "8.1.0-14660630465",
"@alfresco/adf-core": "8.1.0-14660630465",
"@alfresco/adf-extensions": "8.1.0-14660630465",
"@alfresco/eslint-plugin-eslint-angular": "8.1.0-14660630465",
"@alfresco/js-api": "9.1.0-14660630465",
"@angular/animations": "17.1.3",
"@angular/cdk": "17.1.2",
"@angular/common": "17.1.3",
@@ -66,7 +66,7 @@
"zone.js": "0.14.8"
},
"devDependencies": {
"@alfresco/adf-cli": "8.1.0-14605928703",
"@alfresco/adf-cli": "8.1.0-14660630465",
"@angular-devkit/build-angular": "17.3.16",
"@angular-devkit/core": "17.1.4",
"@angular-devkit/schematics": "17.1.4",

View File

@@ -46,7 +46,14 @@ import { searchAiMarkedOptions } from './search-ai-marked-options';
const questionMock: QuestionModel = { question: 'test', questionId: 'testId', restrictionQuery: { nodesIds: [] } };
const getAiAnswerEntry = (noAnswer?: boolean): AiAnswerEntry => {
return { entry: { answer: noAnswer ? '' : 'Some answer', questionId: 'some id', references: [] } };
return {
entry: {
answer: noAnswer ? '' : 'Some answer',
question: 'some question',
objectReferences: [],
complete: true
}
};
};
describe('SearchAiResultsComponent', () => {
@@ -512,7 +519,12 @@ describe('SearchAiResultsComponent', () => {
spyOn(userPreferencesService, 'set');
spyOn(userPreferencesService, 'get').and.returnValue(knowledgeRetrievalNodes);
const answer = getAiAnswerEntry();
answer.entry.references = [{ referenceId: nodeId, referenceText: 'some text' }];
answer.entry.objectReferences = [
{
objectId: nodeId,
references: []
}
];
spyOn(searchAiService, 'getAnswer').and.returnValues(throwError('error'), of(answer));
mockQueryParams.next({ query: 'test', agentId: 'agentId1' });

View File

@@ -198,7 +198,7 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit {
}
this.queryAnswer = response.entry;
this._displayedAnswer = this.preprocessMarkdownFormat(response.entry.answer);
return forkJoin(this.queryAnswer.references.map((reference) => this.nodesApiService.getNode(reference.referenceId)));
return forkJoin(this.queryAnswer.objectReferences.map((reference) => this.nodesApiService.getNode(reference.objectId)));
}),
retryWhen((errors: Observable<Error>) => this.aiSearchRetryWhen(errors)),
finalize(() => (this._loading = false)),