@docbrasil/api-systemmanager 1.1.88 → 1.1.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/ai/sessions.js +83 -0
- package/api/user/process.js +377 -249
- package/dist/bundle.cjs +447 -236
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +137 -10
- package/docs/AISession.html +761 -215
- package/docs/Process.html +665 -68
- package/docs/ai_sessions.js.html +83 -0
- package/docs/user_process.js.html +377 -249
- package/package.json +1 -1
package/docs/ai_sessions.js.html
CHANGED
|
@@ -332,6 +332,89 @@ class AISession {
|
|
|
332
332
|
throw ex;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
337
|
+
* @description Add documents to an existing agent session.
|
|
338
|
+
* The agent will handle the documentIds accordingly.
|
|
339
|
+
* @param {object} params Parameters
|
|
340
|
+
* @param {string} params.sessionId The session ID
|
|
341
|
+
* @param {array<string>} params.documentIds Array of document IDs to add
|
|
342
|
+
* @param {string} authorization Authorization token
|
|
343
|
+
* @return {Promise<object>} data The result from the agent
|
|
344
|
+
* @public
|
|
345
|
+
* @async
|
|
346
|
+
* @example
|
|
347
|
+
*
|
|
348
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
349
|
+
* const api = new API();
|
|
350
|
+
* const authorization = '...';
|
|
351
|
+
* const params = {
|
|
352
|
+
* sessionId: 'session-abc-123',
|
|
353
|
+
* documentIds: ['doc-123', 'doc-456']
|
|
354
|
+
* };
|
|
355
|
+
* const retData = await api.ai.sessions.addDocuments(params, authorization);
|
|
356
|
+
*/
|
|
357
|
+
async addDocuments(params, authorization) {
|
|
358
|
+
const self = this;
|
|
359
|
+
|
|
360
|
+
try {
|
|
361
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
362
|
+
Joi.assert(params.sessionId, Joi.string().required().error(new Error('sessionId is required')));
|
|
363
|
+
Joi.assert(params.documentIds, Joi.array().items(Joi.string()).min(1).required().error(new Error('documentIds is required and must be a non-empty array')));
|
|
364
|
+
|
|
365
|
+
const { sessionId, documentIds } = params;
|
|
366
|
+
|
|
367
|
+
const client = self.parent.dispatch.getAkamaiClient();
|
|
368
|
+
const apiCall = client
|
|
369
|
+
.post(`/agents/${sessionId}/documents/add`, { documentIds }, self._setHeader(authorization));
|
|
370
|
+
|
|
371
|
+
return self._returnData(await apiCall);
|
|
372
|
+
} catch (ex) {
|
|
373
|
+
throw ex;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
379
|
+
* @description Remove documents from an existing agent session.
|
|
380
|
+
* The agent will handle the documentIds accordingly.
|
|
381
|
+
* @param {object} params Parameters
|
|
382
|
+
* @param {string} params.sessionId The session ID
|
|
383
|
+
* @param {array<string>} params.documentIds Array of document IDs to remove
|
|
384
|
+
* @param {string} authorization Authorization token
|
|
385
|
+
* @return {Promise<object>} data The result from the agent
|
|
386
|
+
* @public
|
|
387
|
+
* @async
|
|
388
|
+
* @example
|
|
389
|
+
*
|
|
390
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
391
|
+
* const api = new API();
|
|
392
|
+
* const authorization = '...';
|
|
393
|
+
* const params = {
|
|
394
|
+
* sessionId: 'session-abc-123',
|
|
395
|
+
* documentIds: ['doc-123', 'doc-456']
|
|
396
|
+
* };
|
|
397
|
+
* const retData = await api.ai.sessions.removeDocuments(params, authorization);
|
|
398
|
+
*/
|
|
399
|
+
async removeDocuments(params, authorization) {
|
|
400
|
+
const self = this;
|
|
401
|
+
|
|
402
|
+
try {
|
|
403
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
404
|
+
Joi.assert(params.sessionId, Joi.string().required().error(new Error('sessionId is required')));
|
|
405
|
+
Joi.assert(params.documentIds, Joi.array().items(Joi.string()).min(1).required().error(new Error('documentIds is required and must be a non-empty array')));
|
|
406
|
+
|
|
407
|
+
const { sessionId, documentIds } = params;
|
|
408
|
+
|
|
409
|
+
const client = self.parent.dispatch.getAkamaiClient();
|
|
410
|
+
const apiCall = client
|
|
411
|
+
.post(`/agents/${sessionId}/documents/remove`, { documentIds }, self._setHeader(authorization));
|
|
412
|
+
|
|
413
|
+
return self._returnData(await apiCall);
|
|
414
|
+
} catch (ex) {
|
|
415
|
+
throw ex;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
335
418
|
}
|
|
336
419
|
|
|
337
420
|
export default AISession;
|