mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
[ACS-9564] Fix rendering of Knowledge Retrieval answer after change in answer structure
This commit is contained in:
@@ -46,7 +46,14 @@ import { searchAiMarkedOptions } from './search-ai-marked-options';
|
|||||||
|
|
||||||
const questionMock: QuestionModel = { question: 'test', questionId: 'testId', restrictionQuery: { nodesIds: [] } };
|
const questionMock: QuestionModel = { question: 'test', questionId: 'testId', restrictionQuery: { nodesIds: [] } };
|
||||||
const getAiAnswerEntry = (noAnswer?: boolean): AiAnswerEntry => {
|
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', () => {
|
describe('SearchAiResultsComponent', () => {
|
||||||
@@ -512,7 +519,12 @@ describe('SearchAiResultsComponent', () => {
|
|||||||
spyOn(userPreferencesService, 'set');
|
spyOn(userPreferencesService, 'set');
|
||||||
spyOn(userPreferencesService, 'get').and.returnValue(knowledgeRetrievalNodes);
|
spyOn(userPreferencesService, 'get').and.returnValue(knowledgeRetrievalNodes);
|
||||||
const answer = getAiAnswerEntry();
|
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));
|
spyOn(searchAiService, 'getAnswer').and.returnValues(throwError('error'), of(answer));
|
||||||
mockQueryParams.next({ query: 'test', agentId: 'agentId1' });
|
mockQueryParams.next({ query: 'test', agentId: 'agentId1' });
|
||||||
|
|
||||||
|
@@ -198,7 +198,7 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
this.queryAnswer = response.entry;
|
this.queryAnswer = response.entry;
|
||||||
this._displayedAnswer = this.preprocessMarkdownFormat(response.entry.answer);
|
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)),
|
retryWhen((errors: Observable<Error>) => this.aiSearchRetryWhen(errors)),
|
||||||
finalize(() => (this._loading = false)),
|
finalize(() => (this._loading = false)),
|
||||||
|
Reference in New Issue
Block a user