mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACS-9564] Corrected models after change of Knowledge Retrieval answer structure (#10817)
* [ACS-9564] Corrected models after change of Knowledge Retrieval answer structure * [ACS-9564] Changed id * [ACS-9564] Fixed unit tests
This commit is contained in:
parent
b1fca8dd4b
commit
50ad04aeb3
@ -60,11 +60,38 @@ describe('SearchAiService', () => {
|
|||||||
const answer: AiAnswerEntry = {
|
const answer: AiAnswerEntry = {
|
||||||
entry: {
|
entry: {
|
||||||
answer: 'Some answer 1',
|
answer: 'Some answer 1',
|
||||||
questionId,
|
complete: true,
|
||||||
references: [
|
question: 'Some question',
|
||||||
|
objectReferences: [
|
||||||
{
|
{
|
||||||
referenceId: 'some reference id 1',
|
objectId: 'some id 1',
|
||||||
referenceText: 'some reference text 1'
|
references: [
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 1',
|
||||||
|
rank: 1,
|
||||||
|
rankScore: 0.005
|
||||||
|
},
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 2',
|
||||||
|
rank: 2,
|
||||||
|
rankScore: 0.004
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
objectId: 'some id 2',
|
||||||
|
references: [
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 3',
|
||||||
|
rank: 1,
|
||||||
|
rankScore: 0.005
|
||||||
|
},
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 4',
|
||||||
|
rank: 2,
|
||||||
|
rankScore: 0.004
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -52,26 +52,30 @@ A paginated list is returned in the response body. For example:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"list": {
|
"entry": {
|
||||||
"pagination": {
|
"answer": "Some answer",
|
||||||
"count": 2,
|
"question": "Some question",
|
||||||
"hasMoreItems": false,
|
"complete": true,
|
||||||
"totalItems": 2,
|
"objectReferences": [
|
||||||
"skipCount": 0,
|
|
||||||
"maxItems": 100
|
|
||||||
},
|
|
||||||
"entries": [
|
|
||||||
{
|
{
|
||||||
"entry": {
|
"objectId": "some-object-id",
|
||||||
"answer": "Some answer",
|
"references": [
|
||||||
"questionId": "Some question id",
|
{
|
||||||
"references": [
|
"referenceId": "some-reference-id1",
|
||||||
{
|
"rankScore": 0.031,
|
||||||
"referenceId": "Some reference id",
|
"rank": 2
|
||||||
"referenceText": "Some reference text"
|
},
|
||||||
}
|
{
|
||||||
]
|
"referenceId": "some-reference-id2",
|
||||||
}
|
"rankScore": 0.031,
|
||||||
|
"rank": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"referenceId": "some-reference-id3",
|
||||||
|
"rankScore": 0.028,
|
||||||
|
"rank": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -139,20 +143,31 @@ searchAiApi.getConfig().then((answer) => {
|
|||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
|
| Name | Type |
|
||||||
|
|----------------------|-------------------------------------------------------|
|
||||||
|
| **answer** | string |
|
||||||
|
| **question** | string |
|
||||||
|
| **complete** | boolean |
|
||||||
|
| **objectReferences** | [AiAnswerObjectReference](#AiAnswerObjectReference)[] |
|
||||||
|
|
||||||
|
## AiAnswerObjectReference
|
||||||
|
|
||||||
|
**Properties**
|
||||||
|
|
||||||
| Name | Type |
|
| Name | Type |
|
||||||
|----------------|-------------------------------------------|
|
|----------------|-------------------------------------------|
|
||||||
| **answer** | string |
|
| **objectId** | string |
|
||||||
| **questionId** | string |
|
|
||||||
| **references** | [AiAnswerReference](#AiAnswerReference)[] |
|
| **references** | [AiAnswerReference](#AiAnswerReference)[] |
|
||||||
|
|
||||||
## AiAnswerReference
|
## AiAnswerReference
|
||||||
|
|
||||||
**Properties**
|
**Properties**
|
||||||
|
|
||||||
| Name | Type |
|
| Name | Type |
|
||||||
|-------------------|--------|
|
|-----------------|--------|
|
||||||
| **referenceId** | string |
|
| **referenceId** | string |
|
||||||
| **referenceText** | string |
|
| **rankScore** | number |
|
||||||
|
| **rank** | number |
|
||||||
|
|
||||||
## QuestionModel
|
## QuestionModel
|
||||||
|
|
||||||
|
@ -15,10 +15,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AiAnswerReference } from './aiAnswerReference';
|
import { AiAnswerObjectReference } from './aiAnswerObjectReference';
|
||||||
|
|
||||||
export interface AiAnswer {
|
export interface AiAnswer {
|
||||||
answer: string;
|
answer?: string;
|
||||||
questionId: string;
|
question: string;
|
||||||
references: AiAnswerReference[];
|
complete: boolean;
|
||||||
|
objectReferences: AiAnswerObjectReference[];
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AiAnswerReference } from './aiAnswerReference';
|
||||||
|
|
||||||
|
export interface AiAnswerObjectReference {
|
||||||
|
objectId: string;
|
||||||
|
references: AiAnswerReference[];
|
||||||
|
}
|
@ -17,5 +17,6 @@
|
|||||||
|
|
||||||
export interface AiAnswerReference {
|
export interface AiAnswerReference {
|
||||||
referenceId: string;
|
referenceId: string;
|
||||||
referenceText: string;
|
rankScore: number;
|
||||||
|
rank: number;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ export * from './agentPagingList';
|
|||||||
export * from './aiAnswer';
|
export * from './aiAnswer';
|
||||||
export * from './aiAnswerEntry';
|
export * from './aiAnswerEntry';
|
||||||
export * from './aiAnswerReference';
|
export * from './aiAnswerReference';
|
||||||
|
export * from './aiAnswerObjectReference';
|
||||||
export * from './association';
|
export * from './association';
|
||||||
export * from './associationBody';
|
export * from './associationBody';
|
||||||
export * from './associationEntry';
|
export * from './associationEntry';
|
||||||
|
@ -68,11 +68,38 @@ describe('SearchAiApi', () => {
|
|||||||
assert.deepStrictEqual(answer, {
|
assert.deepStrictEqual(answer, {
|
||||||
entry: {
|
entry: {
|
||||||
answer: 'Some answer 1',
|
answer: 'Some answer 1',
|
||||||
questionId: 'some id 1',
|
complete: true,
|
||||||
references: [
|
question: 'Some question',
|
||||||
|
objectReferences: [
|
||||||
{
|
{
|
||||||
referenceId: 'some reference id 1',
|
objectId: 'some id 1',
|
||||||
referenceText: 'some reference text 1'
|
references: [
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 1',
|
||||||
|
rank: 1,
|
||||||
|
rankScore: 0.005
|
||||||
|
},
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 2',
|
||||||
|
rank: 2,
|
||||||
|
rankScore: 0.004
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
objectId: 'some id 2',
|
||||||
|
references: [
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 3',
|
||||||
|
rank: 1,
|
||||||
|
rankScore: 0.005
|
||||||
|
},
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 4',
|
||||||
|
rank: 2,
|
||||||
|
rankScore: 0.004
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,38 @@ export class SearchAiMock extends BaseMock {
|
|||||||
.reply(200, {
|
.reply(200, {
|
||||||
entry: {
|
entry: {
|
||||||
answer: 'Some answer 1',
|
answer: 'Some answer 1',
|
||||||
questionId: 'some id 1',
|
complete: true,
|
||||||
references: [
|
question: 'Some question',
|
||||||
|
objectReferences: [
|
||||||
{
|
{
|
||||||
referenceId: 'some reference id 1',
|
objectId: 'some id 1',
|
||||||
referenceText: 'some reference text 1'
|
references: [
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 1',
|
||||||
|
rank: 1,
|
||||||
|
rankScore: 0.005
|
||||||
|
},
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 2',
|
||||||
|
rank: 2,
|
||||||
|
rankScore: 0.004
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
objectId: 'some id 2',
|
||||||
|
references: [
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 3',
|
||||||
|
rank: 1,
|
||||||
|
rankScore: 0.005
|
||||||
|
},
|
||||||
|
{
|
||||||
|
referenceId: 'some reference id 4',
|
||||||
|
rank: 2,
|
||||||
|
rankScore: 0.004
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user