mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[ACS-8202] basic flow getting ai response for one or more selected files (#9944)
* ACS-8202 Getting list of agents * ACS-8202 Mocked agents, used base api from hxi connector * ACS-8202 Search Ai service * ACS-8202 Small correction and mocked data * ACS-8202 Renamed variable * ACS-8202 Added documentation * ACS-8202 Addressed PR comments * ACS-8202 Type change * ACS-8202 Reverted unwatend change * ACS-8202 Reverted unwanted change
This commit is contained in:
committed by
Aleksander Sklorz
parent
7506c109d8
commit
fd32667c1a
162
lib/js-api/src/api/content-rest-api/docs/SearchAiApi.md
Normal file
162
lib/js-api/src/api/content-rest-api/docs/SearchAiApi.md
Normal file
@@ -0,0 +1,162 @@
|
||||
# SearchAiApi
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|-------------------------|--------------------|-------------------------------------|
|
||||
| [ask](#ask) | **GET** /questions | Ask a question to the AI. |
|
||||
| [getAnswer](#getAnswer) | **GET** /answers | Get an answer to specific question. |
|
||||
|
||||
## ask
|
||||
|
||||
Ask a question to the AI.
|
||||
A list is returned in the response body. For example:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"question": "Some question",
|
||||
"questionId": "Some question id",
|
||||
"restrictionQuery": "Some restriction query"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```javascript
|
||||
import { AlfrescoApi, AgentsApi } from '@alfresco/js-api';
|
||||
|
||||
const alfrescoApi = new AlfrescoApi(/*..*/);
|
||||
const searchAiApi = new SearchAiApi(alfrescoApi);
|
||||
|
||||
searchAiApi.ask([{
|
||||
question: 'Some question',
|
||||
restrictionQuery: 'Some restriction query'
|
||||
}]).then((questionInformation) => {
|
||||
console.log('API called successfully. Returned data: ' + questionInformation);
|
||||
});
|
||||
```
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------|---------------------------------------|-----------------------|
|
||||
| **questions** | [QuestionRequest](#QuestionRequest)[] | The questions to ask. |
|
||||
|
||||
**Return type**: [QuestionModel](#QuestionModel)[]
|
||||
|
||||
## getAnswer
|
||||
|
||||
Get an answer to specific question.
|
||||
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",
|
||||
"questionId": "Some question id",
|
||||
"references": [
|
||||
{
|
||||
"referenceId": "Some reference id",
|
||||
"referenceText": "Some reference text"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```javascript
|
||||
import { AlfrescoApi, AgentsApi } from '@alfresco/js-api';
|
||||
|
||||
const alfrescoApi = new AlfrescoApi(/*..*/);
|
||||
const searchAiApi = new SearchAiApi(alfrescoApi);
|
||||
|
||||
searchAiApi.getAnswer('some question id').then((answer) => {
|
||||
console.log('API called successfully. Returned data: ' + answer);
|
||||
});
|
||||
```
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
|----------------|--------|----------------------------------------------|
|
||||
| **questionId** | string | The ID of the question to get an answer for. |
|
||||
|
||||
**Return type**: [AiAnswerPaging](#AiAnswerPaging)
|
||||
|
||||
# Models
|
||||
|
||||
## AiAnswerPaging
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|------|-------------------------------------------|
|
||||
| list | [AiAnswerPagingList](#AiAnswerPagingList) |
|
||||
|
||||
## AiAnswerPagingList
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|----------------|-----------------------------------|
|
||||
| **pagination** | [Pagination](Pagination.md) |
|
||||
| **entries** | [AiAnswerEntry[]](#AiAnswerEntry) |
|
||||
|
||||
## AiAnswerEntry
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|-----------|-----------------------|
|
||||
| **entry** | [AiAnswer](#AiAnswer) |
|
||||
|
||||
## AiAnswer
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|----------------|-------------------------------------------|
|
||||
| **answer** | string |
|
||||
| **questionId** | string |
|
||||
| **references** | [AiAnswerReference](#AiAnswerReference)[] |
|
||||
|
||||
## AiAnswerReference
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|-------------------|--------|
|
||||
| **referenceId** | string |
|
||||
| **referenceText** | string |
|
||||
|
||||
## QuestionModel
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|----------------------|--------|
|
||||
| **question** | string |
|
||||
| **questionId** | string |
|
||||
| **restrictionQuery** | string |
|
||||
|
||||
## QuestionRequest
|
||||
|
||||
**Properties**
|
||||
|
||||
| Name | Type |
|
||||
|--------------|----------|
|
||||
| **question** | string |
|
||||
| **nodeIds** | string[] |
|
Reference in New Issue
Block a user