@docbrasil/api-systemmanager 1.1.79 → 1.1.81

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.
Files changed (87) hide show
  1. package/api/admin/user.js +2 -2
  2. package/api/{ai.js → ai/index.js} +3 -0
  3. package/api/ai/sessions.js +153 -0
  4. package/dist/bundle.cjs +152 -2
  5. package/dist/bundle.mjs +1 -1
  6. package/doc/api.md +134 -47
  7. package/docs/AISession.html +1370 -0
  8. package/docs/Admin.html +1 -1
  9. package/docs/AdminDocuments.html +1 -1
  10. package/docs/AdminForm.html +1 -1
  11. package/docs/AdminLists.html +1 -1
  12. package/docs/AdminMessage.html +1 -1
  13. package/docs/AdminNotification.html +1 -1
  14. package/docs/AdminPlugin.html +1 -1
  15. package/docs/AdminPolicy.html +1 -1
  16. package/docs/AdminProcesses.html +1 -1
  17. package/docs/AdminTask.html +1 -1
  18. package/docs/AdminUser.html +1 -1
  19. package/docs/Application.html +1 -1
  20. package/docs/Chart.html +1 -1
  21. package/docs/Dashboard.html +1 -1
  22. package/docs/Datasource.html +1 -1
  23. package/docs/Dispatch.html +1 -1
  24. package/docs/Documents.html +1 -1
  25. package/docs/External.html +1 -1
  26. package/docs/GeoLocation.html +1 -1
  27. package/docs/Help.html +1 -1
  28. package/docs/Kanban.html +1 -1
  29. package/docs/Login.html +1 -1
  30. package/docs/MyTasks.html +1 -1
  31. package/docs/MyndAI.html +5 -5
  32. package/docs/Notification.html +1 -1
  33. package/docs/Organization.html +1 -1
  34. package/docs/Page.html +1 -1
  35. package/docs/Process.html +1 -1
  36. package/docs/Register.html +1 -1
  37. package/docs/Report.html +1 -1
  38. package/docs/Session.html +1 -1
  39. package/docs/Settings.html +1 -1
  40. package/docs/Task.html +1 -1
  41. package/docs/TaskAvailable.html +1 -1
  42. package/docs/Updates.html +1 -1
  43. package/docs/User.html +1 -1
  44. package/docs/Users.html +1 -1
  45. package/docs/admin_doctypes.js.html +1 -1
  46. package/docs/admin_document.js.html +1 -1
  47. package/docs/admin_form.js.html +1 -1
  48. package/docs/admin_index.js.html +1 -1
  49. package/docs/admin_list.js.html +1 -1
  50. package/docs/admin_message.js.html +1 -1
  51. package/docs/admin_notification.js.html +1 -1
  52. package/docs/admin_organization.js.html +1 -1
  53. package/docs/admin_plugin.js.html +1 -1
  54. package/docs/admin_policy.js.html +1 -1
  55. package/docs/admin_processes.js.html +1 -1
  56. package/docs/admin_task.js.html +1 -1
  57. package/docs/admin_user.js.html +3 -3
  58. package/docs/{ai.js.html → ai_index.js.html} +6 -3
  59. package/docs/ai_sessions.js.html +270 -0
  60. package/docs/dispatch.js.html +1 -1
  61. package/docs/external.js.html +1 -1
  62. package/docs/general_geoLocation.js.html +1 -1
  63. package/docs/general_index.js.html +1 -1
  64. package/docs/index.html +1 -1
  65. package/docs/login.js.html +1 -1
  66. package/docs/session.js.html +1 -1
  67. package/docs/user_application.js.html +1 -1
  68. package/docs/user_dashboard.js.html +1 -1
  69. package/docs/user_datasource.js.html +1 -1
  70. package/docs/user_document.js.html +1 -1
  71. package/docs/user_help.js.html +1 -1
  72. package/docs/user_index.js.html +1 -1
  73. package/docs/user_kanban.js.html +1 -1
  74. package/docs/user_my_tasks.js.html +1 -1
  75. package/docs/user_notification.js.html +1 -1
  76. package/docs/user_organization.js.html +1 -1
  77. package/docs/user_page.js.html +1 -1
  78. package/docs/user_process.js.html +1 -1
  79. package/docs/user_register.js.html +1 -1
  80. package/docs/user_settings.js.html +1 -1
  81. package/docs/user_task.js.html +1 -1
  82. package/docs/user_task_available.js.html +1 -1
  83. package/docs/user_updates.js.html +1 -1
  84. package/docs/user_user.js.html +1 -1
  85. package/docs/utils_promises.js.html +1 -1
  86. package/index.js +1 -1
  87. package/package.json +1 -1
package/doc/api.md CHANGED
@@ -37,6 +37,12 @@
37
37
  <dt><a href="#AdminUser">AdminUser</a></dt>
38
38
  <dd><p>Admin Class for user, permission admin</p>
39
39
  </dd>
40
+ <dt><a href="#MyndAI">MyndAI</a></dt>
41
+ <dd><p>Class using AI</p>
42
+ </dd>
43
+ <dt><a href="#AISession">AISession</a></dt>
44
+ <dd><p>Class for AI Session management</p>
45
+ </dd>
40
46
  <dt><a href="#GeoLocation">GeoLocation</a></dt>
41
47
  <dd><p>General Class for user, permission organization</p>
42
48
  </dd>
@@ -103,9 +109,6 @@
103
109
  <dt><a href="#User">User</a></dt>
104
110
  <dd><p>Class for user, permission user</p>
105
111
  </dd>
106
- <dt><a href="#MyndAI">MyndAI</a></dt>
107
- <dd><p>Class using AI</p>
108
- </dd>
109
112
  <dt><a href="#Dispatch">Dispatch</a></dt>
110
113
  <dd><p>Api dispatch manager</p>
111
114
  </dd>
@@ -1757,6 +1760,134 @@ const params = { orgId: '5edd11c46b6ce9729c2c297c' };
1757
1760
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1758
1761
  const users = await api.admin.user.getOrgUsers(params, session);
1759
1762
  ```
1763
+ <a name="MyndAI"></a>
1764
+
1765
+ ## MyndAI
1766
+ Class using AI
1767
+
1768
+ **Kind**: global class
1769
+ <a name="MyndAI+explain"></a>
1770
+
1771
+ ### myndAI.explain(params) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code> \| <code>number</code>
1772
+ Create new document
1773
+
1774
+ **Kind**: instance method of [<code>MyndAI</code>](#MyndAI)
1775
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success true|false for success<code>object</code> - data.result the result of the AI call<code>string</code> - data.result.response The actual text response according the prompt<code>number</code> - data.result.tokens The quantity of token used in this request
1776
+ **Access**: public
1777
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1778
+
1779
+ | Param | Type | Default | Description |
1780
+ | --- | --- | --- | --- |
1781
+ | params | <code>object</code> | | Object for add new document |
1782
+ | params.model | <code>string</code> | | The model to use for the explain |
1783
+ | params.context | <code>object</code> | | The context to apply to a prompt |
1784
+ | params.text | <code>string</code> | | The text to add to the prompt |
1785
+ | params.medias | <code>array.&lt;object&gt;</code> | | Medias to add (PDF, Image, Video, Audio) |
1786
+ | params.medias.type | <code>string</code> | | can be base64 | document |
1787
+ | params.medias.mime | <code>string</code> | | the mime type of the media |
1788
+ | params.medias.base64 | <code>string</code> | | the base64 of the image (in the case the type is base64) |
1789
+ | params.medias.document | <code>string</code> | | the document path for the image (in the case the type is document) |
1790
+ | params.prompt | <code>string</code> | | The actual prompt with context and text to apply to |
1791
+ | params.json | <code>boolean</code> | <code>false</code> | If we return in json format or not |
1792
+
1793
+ **Example**
1794
+ ```js
1795
+ const API = require('@docbrasil/api-systemmanager');
1796
+ const api = new API();
1797
+ const authorization = '...';
1798
+ const params = {
1799
+ model: 'model-name',
1800
+ context: { name: 'Some name' },
1801
+ text: 'Say hello to the world',
1802
+ medias: ['...'],
1803
+ prompt: 'Write a story about {{name}} with the following theme: {{text}}',
1804
+ };
1805
+ const retData = await api.ai.explain(params, authorization);
1806
+ ```
1807
+ <a name="AISession"></a>
1808
+
1809
+ ## AISession
1810
+ Class for AI Session management
1811
+
1812
+ **Kind**: global class
1813
+
1814
+ * [AISession](#AISession)
1815
+ * [.getByDocument(params, authorization)](#AISession+getByDocument) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code>
1816
+ * [.updateData(params, authorization)](#AISession+updateData) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1817
+
1818
+ <a name="AISession+getByDocument"></a>
1819
+
1820
+ ### aiSession.getByDocument(params, authorization) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code>
1821
+ Get full session data by document ID.
1822
+ Returns session, execution, activities, pages, triples and summary.
1823
+
1824
+ **Kind**: instance method of [<code>AISession</code>](#AISession)
1825
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data The full session data<code>object</code> - data.session The session object<code>object</code> - data.execution The latest execution or null<code>array.&lt;object&gt;</code> - data.activities Activity log entries<code>array.&lt;object&gt;</code> - data.pages Extracted page objects<code>array.&lt;object&gt;</code> - data.triples Ontology triple objects<code>object</code> - data.summary Document summary or null
1826
+ **Access**: public
1827
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1828
+
1829
+ | Param | Type | Description |
1830
+ | --- | --- | --- |
1831
+ | params | <code>object</code> | Parameters |
1832
+ | params.documentId | <code>string</code> | The document ID to look up the session for |
1833
+ | authorization | <code>string</code> | Authorization token |
1834
+
1835
+ **Example**
1836
+ ```js
1837
+ const API = require('@docbrasil/api-systemmanager');
1838
+ const api = new API();
1839
+ const authorization = '...';
1840
+ const params = { documentId: 'doc-123' };
1841
+ const retData = await api.ai.sessions.getByDocument(params, authorization);
1842
+ ```
1843
+ <a name="AISession+updateData"></a>
1844
+
1845
+ ### aiSession.updateData(params, authorization) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1846
+ Update session document data (pages, triples, summary).
1847
+ Used by Scarface to push corrections or enrichments for a document.
1848
+
1849
+ **Kind**: instance method of [<code>AISession</code>](#AISession)
1850
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data The update results<code>array.&lt;object&gt;</code> - data.pages Page update results [{pageNumber, updated}]<code>object</code> - data.triples Triple insert results {added: number}<code>object</code> - data.summary Applied summary updates
1851
+ **Access**: public
1852
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1853
+
1854
+ | Param | Type | Description |
1855
+ | --- | --- | --- |
1856
+ | params | <code>object</code> | Parameters |
1857
+ | params.documentId | <code>string</code> | The document ID |
1858
+ | [params.pages] | <code>array.&lt;object&gt;</code> | Page updates |
1859
+ | params.pages.pageNumber | <code>number</code> | 1-based page number |
1860
+ | [params.pages.markdown] | <code>string</code> | Updated markdown text |
1861
+ | [params.pages.entities] | <code>array.&lt;object&gt;</code> | Updated entities |
1862
+ | [params.triples] | <code>array.&lt;object&gt;</code> | New triples to add |
1863
+ | params.triples.pageNumber | <code>number</code> | Source page number |
1864
+ | params.triples.subject | <code>string</code> | Subject entity text |
1865
+ | params.triples.predicate | <code>string</code> | Relationship predicate |
1866
+ | params.triples.object | <code>string</code> | Object entity text |
1867
+ | [params.summary] | <code>object</code> | Summary field updates |
1868
+ | [params.summary.documentName] | <code>string</code> | Document name |
1869
+ | [params.summary.entityCount] | <code>number</code> | Total entity count |
1870
+ | [params.summary.tripleCount] | <code>number</code> | Total triple count |
1871
+ | authorization | <code>string</code> | Authorization token |
1872
+
1873
+ **Example**
1874
+ ```js
1875
+ const API = require('@docbrasil/api-systemmanager');
1876
+ const api = new API();
1877
+ const authorization = '...';
1878
+ const params = {
1879
+ documentId: 'doc-123',
1880
+ pages: [
1881
+ { pageNumber: 1, markdown: '# Updated page content' }
1882
+ ],
1883
+ summary: {
1884
+ documentName: 'Patient Report.pdf',
1885
+ entityCount: 42,
1886
+ tripleCount: 15
1887
+ }
1888
+ };
1889
+ const retData = await api.ai.sessions.updateData(params, authorization);
1890
+ ```
1760
1891
  <a name="GeoLocation"></a>
1761
1892
 
1762
1893
  ## GeoLocation
@@ -5193,50 +5324,6 @@ const orgIds: ['616eccaaa9360a05293b10fe'];
5193
5324
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
5194
5325
  const jwtToken = await api.user.getChartTags(orgIds, session);
5195
5326
  ```
5196
- <a name="MyndAI"></a>
5197
-
5198
- ## MyndAI
5199
- Class using AI
5200
-
5201
- **Kind**: global class
5202
- <a name="MyndAI+explain"></a>
5203
-
5204
- ### myndAI.explain(params) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code> \| <code>number</code>
5205
- Create new document
5206
-
5207
- **Kind**: instance method of [<code>MyndAI</code>](#MyndAI)
5208
- **Returns**: <code>Promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success true|false for success<code>object</code> - data.result the result of the AI call<code>string</code> - data.result.response The actual text response according the prompt<code>number</code> - data.result.tokens The quantity of token used in this request
5209
- **Access**: public
5210
- **Author**: Myndware <augusto.pissarra@myndware.com>
5211
-
5212
- | Param | Type | Default | Description |
5213
- | --- | --- | --- | --- |
5214
- | params | <code>object</code> | | Object for add new document |
5215
- | params.model | <code>string</code> | | The model to use for the explain |
5216
- | params.context | <code>object</code> | | The context to apply to a prompt |
5217
- | params.text | <code>string</code> | | The text to add to the prompt |
5218
- | params.medias | <code>array.&lt;object&gt;</code> | | Medias to add (PDF, Image, Video, Audio) |
5219
- | params.medias.type | <code>string</code> | | can be base64 | document |
5220
- | params.medias.mime | <code>string</code> | | the mime type of the media |
5221
- | params.medias.base64 | <code>string</code> | | the base64 of the image (in the case the type is base64) |
5222
- | params.medias.document | <code>string</code> | | the document path for the image (in the case the type is document) |
5223
- | params.prompt | <code>string</code> | | The actual prompt with context and text to apply to |
5224
- | params.json | <code>boolean</code> | <code>false</code> | If we return in json format or not |
5225
-
5226
- **Example**
5227
- ```js
5228
- const API = require('@docbrasil/api-systemmanager');
5229
- const api = new API();
5230
- const authorization = '...';
5231
- const params = {
5232
- model: 'model-name',
5233
- context: { name: 'Some name' },
5234
- text: 'Say hello to the world',
5235
- medias: ['...'],
5236
- prompt: 'Write a story about {{name}} with the following theme: {{text}}',
5237
- };
5238
- const retData = await api.ai.explain(params, authorization);
5239
- ```
5240
5327
  <a name="Dispatch"></a>
5241
5328
 
5242
5329
  ## Dispatch