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 = {
|
||||
entry: {
|
||||
answer: 'Some answer 1',
|
||||
questionId,
|
||||
references: [
|
||||
complete: true,
|
||||
question: 'Some question',
|
||||
objectReferences: [
|
||||
{
|
||||
referenceId: 'some reference id 1',
|
||||
referenceText: 'some reference text 1'
|
||||
objectId: 'some id 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
|
||||
{
|
||||
"list": {
|
||||
"pagination": {
|
||||
"count": 2,
|
||||
"hasMoreItems": false,
|
||||
"totalItems": 2,
|
||||
"skipCount": 0,
|
||||
"maxItems": 100
|
||||
},
|
||||
"entries": [
|
||||
"entry": {
|
||||
"answer": "Some answer",
|
||||
"question": "Some question",
|
||||
"complete": true,
|
||||
"objectReferences": [
|
||||
{
|
||||
"entry": {
|
||||
"answer": "Some answer",
|
||||
"questionId": "Some question id",
|
||||
"references": [
|
||||
{
|
||||
"referenceId": "Some reference id",
|
||||
"referenceText": "Some reference text"
|
||||
}
|
||||
]
|
||||
}
|
||||
"objectId": "some-object-id",
|
||||
"references": [
|
||||
{
|
||||
"referenceId": "some-reference-id1",
|
||||
"rankScore": 0.031,
|
||||
"rank": 2
|
||||
},
|
||||
{
|
||||
"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**
|
||||
|
||||
| Name | Type |
|
||||
|----------------------|-------------------------------------------------------|
|
||||
| **answer** | string |
|
||||
| **question** | string |
|
||||
| **complete** | boolean |
|
||||
| **objectReferences** | [AiAnswerObjectReference](#AiAnswerObjectReference)[] |
|
||||
|
||||
## AiAnswerObjectReference
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|----------------|-------------------------------------------|
|
||||
| **answer** | string |
|
||||
| **questionId** | string |
|
||||
| **objectId** | string |
|
||||
| **references** | [AiAnswerReference](#AiAnswerReference)[] |
|
||||
|
||||
## AiAnswerReference
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|-------------------|--------|
|
||||
| **referenceId** | string |
|
||||
| **referenceText** | string |
|
||||
| Name | Type |
|
||||
|-----------------|--------|
|
||||
| **referenceId** | string |
|
||||
| **rankScore** | number |
|
||||
| **rank** | number |
|
||||
|
||||
## QuestionModel
|
||||
|
||||
|
@ -15,10 +15,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AiAnswerReference } from './aiAnswerReference';
|
||||
import { AiAnswerObjectReference } from './aiAnswerObjectReference';
|
||||
|
||||
export interface AiAnswer {
|
||||
answer: string;
|
||||
questionId: string;
|
||||
references: AiAnswerReference[];
|
||||
answer?: string;
|
||||
question: string;
|
||||
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 {
|
||||
referenceId: string;
|
||||
referenceText: string;
|
||||
rankScore: number;
|
||||
rank: number;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ export * from './agentPagingList';
|
||||
export * from './aiAnswer';
|
||||
export * from './aiAnswerEntry';
|
||||
export * from './aiAnswerReference';
|
||||
export * from './aiAnswerObjectReference';
|
||||
export * from './association';
|
||||
export * from './associationBody';
|
||||
export * from './associationEntry';
|
||||
|
@ -68,11 +68,38 @@ describe('SearchAiApi', () => {
|
||||
assert.deepStrictEqual(answer, {
|
||||
entry: {
|
||||
answer: 'Some answer 1',
|
||||
questionId: 'some id 1',
|
||||
references: [
|
||||
complete: true,
|
||||
question: 'Some question',
|
||||
objectReferences: [
|
||||
{
|
||||
referenceId: 'some reference id 1',
|
||||
referenceText: 'some reference text 1'
|
||||
objectId: 'some id 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, {
|
||||
entry: {
|
||||
answer: 'Some answer 1',
|
||||
questionId: 'some id 1',
|
||||
references: [
|
||||
complete: true,
|
||||
question: 'Some question',
|
||||
objectReferences: [
|
||||
{
|
||||
referenceId: 'some reference id 1',
|
||||
referenceText: 'some reference text 1'
|
||||
objectId: 'some id 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