@ckeditor/ckeditor5-ai 40.2.0 → 41.0.0

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 (163) hide show
  1. package/LICENSE.md +14 -6
  2. package/README.md +10 -11
  3. package/build/ai.js +8 -8
  4. package/build/translations/af.js +1 -1
  5. package/build/translations/ar.js +1 -1
  6. package/build/translations/bg.js +1 -1
  7. package/build/translations/bn.js +1 -1
  8. package/build/translations/bs.js +1 -1
  9. package/build/translations/ca.js +1 -1
  10. package/build/translations/cs.js +1 -1
  11. package/build/translations/da.js +1 -1
  12. package/build/translations/de-ch.js +1 -1
  13. package/build/translations/de.js +1 -1
  14. package/build/translations/el.js +1 -1
  15. package/build/translations/en-au.js +1 -1
  16. package/build/translations/es-co.js +1 -1
  17. package/build/translations/es.js +1 -1
  18. package/build/translations/et.js +1 -1
  19. package/build/translations/fa.js +1 -1
  20. package/build/translations/fi.js +1 -1
  21. package/build/translations/fr.js +1 -1
  22. package/build/translations/gl.js +1 -1
  23. package/build/translations/he.js +1 -1
  24. package/build/translations/hi.js +1 -1
  25. package/build/translations/hr.js +1 -1
  26. package/build/translations/hu.js +1 -1
  27. package/build/translations/id.js +1 -1
  28. package/build/translations/it.js +1 -1
  29. package/build/translations/ja.js +1 -1
  30. package/build/translations/jv.js +1 -1
  31. package/build/translations/ko.js +1 -1
  32. package/build/translations/lt.js +1 -1
  33. package/build/translations/lv.js +1 -1
  34. package/build/translations/ms.js +1 -1
  35. package/build/translations/nl.js +1 -1
  36. package/build/translations/no.js +1 -1
  37. package/build/translations/pl.js +1 -1
  38. package/build/translations/pt-br.js +1 -1
  39. package/build/translations/pt.js +1 -1
  40. package/build/translations/ro.js +1 -1
  41. package/build/translations/ru.js +1 -1
  42. package/build/translations/sk.js +1 -1
  43. package/build/translations/sr-latn.js +1 -1
  44. package/build/translations/sr.js +1 -1
  45. package/build/translations/sv.js +1 -1
  46. package/build/translations/th.js +1 -1
  47. package/build/translations/tk.js +1 -1
  48. package/build/translations/tr.js +1 -1
  49. package/build/translations/ug.js +1 -1
  50. package/build/translations/uk.js +1 -1
  51. package/build/translations/ur.js +1 -1
  52. package/build/translations/uz.js +1 -1
  53. package/build/translations/vi.js +1 -1
  54. package/build/translations/zh-cn.js +1 -1
  55. package/build/translations/zh.js +1 -1
  56. package/ckeditor5-metadata.json +1 -1
  57. package/lang/contexts.json +3 -3
  58. package/lang/translations/af.po +14 -6
  59. package/lang/translations/ar.po +14 -6
  60. package/lang/translations/bg.po +14 -6
  61. package/lang/translations/bn.po +14 -6
  62. package/lang/translations/bs.po +14 -6
  63. package/lang/translations/ca.po +14 -6
  64. package/lang/translations/cs.po +14 -6
  65. package/lang/translations/da.po +14 -6
  66. package/lang/translations/de-ch.po +14 -6
  67. package/lang/translations/de.po +14 -6
  68. package/lang/translations/el.po +14 -6
  69. package/lang/translations/en-au.po +14 -6
  70. package/lang/translations/en.po +14 -6
  71. package/lang/translations/es-co.po +14 -6
  72. package/lang/translations/es.po +14 -6
  73. package/lang/translations/et.po +14 -6
  74. package/lang/translations/fa.po +14 -6
  75. package/lang/translations/fi.po +14 -6
  76. package/lang/translations/fr.po +14 -6
  77. package/lang/translations/gl.po +14 -6
  78. package/lang/translations/he.po +14 -6
  79. package/lang/translations/hi.po +14 -6
  80. package/lang/translations/hr.po +14 -6
  81. package/lang/translations/hu.po +14 -6
  82. package/lang/translations/id.po +14 -6
  83. package/lang/translations/it.po +14 -6
  84. package/lang/translations/ja.po +14 -6
  85. package/lang/translations/jv.po +14 -6
  86. package/lang/translations/ko.po +14 -6
  87. package/lang/translations/lt.po +14 -6
  88. package/lang/translations/lv.po +14 -6
  89. package/lang/translations/ms.po +14 -6
  90. package/lang/translations/nl.po +14 -6
  91. package/lang/translations/no.po +14 -6
  92. package/lang/translations/pl.po +14 -6
  93. package/lang/translations/pt-br.po +14 -6
  94. package/lang/translations/pt.po +14 -6
  95. package/lang/translations/ro.po +14 -6
  96. package/lang/translations/ru.po +14 -6
  97. package/lang/translations/sk.po +14 -6
  98. package/lang/translations/sr-latn.po +14 -6
  99. package/lang/translations/sr.po +14 -6
  100. package/lang/translations/sv.po +14 -6
  101. package/lang/translations/th.po +14 -6
  102. package/lang/translations/tk.po +14 -6
  103. package/lang/translations/tr.po +14 -6
  104. package/lang/translations/ug.po +14 -6
  105. package/lang/translations/uk.po +14 -6
  106. package/lang/translations/ur.po +14 -6
  107. package/lang/translations/uz.po +14 -6
  108. package/lang/translations/vi.po +14 -6
  109. package/lang/translations/zh-cn.po +14 -6
  110. package/lang/translations/zh.po +14 -6
  111. package/package.json +7 -5
  112. package/src/adapters/aiadapter.d.ts +3 -3
  113. package/src/adapters/aiadapter.js +2 -2
  114. package/src/adapters/aitextadapter.d.ts +3 -3
  115. package/src/adapters/aitextadapter.js +2 -2
  116. package/src/adapters/awstextadapter.d.ts +24 -24
  117. package/src/adapters/awstextadapter.js +2 -2
  118. package/src/adapters/openaitextadapter.d.ts +3 -3
  119. package/src/adapters/openaitextadapter.js +2 -2
  120. package/src/aiassistant.d.ts +5 -5
  121. package/src/aiassistant.js +2 -2
  122. package/src/aiassistantediting.d.ts +13 -12
  123. package/src/aiassistantediting.js +2 -2
  124. package/src/aiassistantui.d.ts +8 -8
  125. package/src/aiassistantui.js +2 -2
  126. package/src/aiconfig.d.ts +5 -5
  127. package/src/aiconfig.js +1 -1
  128. package/src/augmentation.d.ts +7 -7
  129. package/src/augmentation.js +1 -1
  130. package/src/index.d.ts +7 -7
  131. package/src/index.js +2 -2
  132. package/src/ui/aiassistantcontroller.d.ts +12 -12
  133. package/src/ui/aiassistantcontroller.js +2 -2
  134. package/src/ui/dropdown/aicommandslistview.d.ts +2 -2
  135. package/src/ui/dropdown/aicommandslistview.js +2 -2
  136. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +2 -2
  137. package/src/ui/dropdown/buttonlabelwithhighlightview.js +2 -2
  138. package/src/ui/dropdown/labelwithhighlightview.d.ts +2 -2
  139. package/src/ui/dropdown/labelwithhighlightview.js +2 -2
  140. package/src/ui/form/aiformcontentarea.d.ts +3 -3
  141. package/src/ui/form/aiformcontentarea.js +2 -2
  142. package/src/ui/form/aiformerrorview.d.ts +3 -3
  143. package/src/ui/form/aiformerrorview.js +2 -2
  144. package/src/ui/form/aiformpromptview.d.ts +3 -3
  145. package/src/ui/form/aiformpromptview.js +2 -2
  146. package/src/ui/form/aiformtoolbarview.d.ts +12 -8
  147. package/src/ui/form/aiformtoolbarview.js +2 -2
  148. package/src/ui/form/aiformview.d.ts +13 -14
  149. package/src/ui/form/aiformview.js +2 -2
  150. package/src/ui/form/aihistorylistitemview.d.ts +3 -3
  151. package/src/ui/form/aihistorylistitemview.js +2 -2
  152. package/src/ui/form/aihistorylistview.d.ts +3 -3
  153. package/src/ui/form/aihistorylistview.js +2 -2
  154. package/src/ui/form/prompthistory.d.ts +2 -2
  155. package/src/ui/form/prompthistory.js +2 -2
  156. package/src/ui/showaiassistantcommand.d.ts +2 -2
  157. package/src/ui/showaiassistantcommand.js +2 -2
  158. package/src/utils/common-translations.d.ts +2 -2
  159. package/src/utils/common-translations.js +2 -2
  160. package/theme/ai-dropdown.css +1 -1
  161. package/theme/ai-form.css +16 -4
  162. package/theme/ai.css +17 -4
  163. package/theme/icons/robot-pencil.svg +0 -1
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ai",
3
- "version": "40.2.0",
4
- "description": "AI-powered features for CKEditor 5.",
3
+ "version": "41.0.0",
4
+ "description": "AI Assistant feature for CKEditor 5.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
7
- "homepage": "https://ckeditor.com/collaboration/",
7
+ "homepage": "https://ckeditor.com/ckeditor-5",
8
8
  "keywords": [
9
9
  "CKEditor",
10
10
  "ckeditor5",
@@ -23,11 +23,13 @@
23
23
  "framework"
24
24
  ],
25
25
  "dependencies": {
26
- "ckeditor5": "40.2.0",
26
+ "ckeditor5": "41.0.0",
27
+ "ckeditor5-collaboration": "41.0.0",
27
28
  "@aws-sdk/client-bedrock-runtime": "3.470.0",
28
- "@ckeditor/ckeditor5-ui": "40.2.0",
29
+ "@ckeditor/ckeditor5-ui": "41.0.0",
29
30
  "lodash-es": "4.17.21"
30
31
  },
32
+ "type": "module",
31
33
  "main": "src/index.js",
32
34
  "files": [
33
35
  "lang",
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/adapters/aiadapter
7
7
  * @publicApi
8
8
  */
9
- import { Plugin } from 'ckeditor5/src/core';
10
- import type AITextAdapter from './aitextadapter';
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ import type AITextAdapter from './aitextadapter.js';
11
11
  /**
12
12
  * Main adapter plugin that is a common interface between AI features and AI adapters.
13
13
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- var _0x56a8=['name','textAdapter','AIRequestError','aiadapter-text-adapter-not-set','afterInit','AIAdapter','pluginName'];(function(_0x17d11f,_0x56a86a){var _0x272805=function(_0x1fc02f){while(--_0x1fc02f){_0x17d11f['push'](_0x17d11f['shift']());}};_0x272805(++_0x56a86a);}(_0x56a8,0xc8));var _0x2728=function(_0x17d11f,_0x56a86a){_0x17d11f=_0x17d11f-0x0;var _0x272805=_0x56a8[_0x17d11f];return _0x272805;};import{Plugin as _0x1ca293}from'ckeditor5/src/core';import{CKEditorError as _0x557522}from'ckeditor5/src/utils';export default class A extends _0x1ca293{static get[_0x2728('0x2')](){return _0x2728('0x1');}[_0x2728('0x0')](){if(!this[_0x2728('0x4')])throw new _0x557522(_0x2728('0x6'),null);}}export class AIRequestError extends Error{constructor(_0x461e0e){super(_0x461e0e),this[_0x2728('0x3')]=_0x2728('0x5');}}
23
+ var _0x3a78=['AIRequestError','name','AIAdapter','pluginName','aiadapter-text-adapter-not-set'];(function(_0x382be6,_0x3a7886){var _0x3bbc89=function(_0x8064f4){while(--_0x8064f4){_0x382be6['push'](_0x382be6['shift']());}};_0x3bbc89(++_0x3a7886);}(_0x3a78,0x150));var _0x3bbc=function(_0x382be6,_0x3a7886){_0x382be6=_0x382be6-0x0;var _0x3bbc89=_0x3a78[_0x382be6];return _0x3bbc89;};import{Plugin as _0x23cd4a}from'ckeditor5/src/core.js';import{CKEditorError as _0x1bb56a}from'ckeditor5/src/utils.js';export default class I extends _0x23cd4a{static get[_0x3bbc('0x2')](){return _0x3bbc('0x1');}['afterInit'](){if(!this['textAdapter'])throw new _0x1bb56a(_0x3bbc('0x3'),null);}}export class AIRequestError extends Error{constructor(_0x5199d8){super(_0x5199d8),this[_0x3bbc('0x0')]=_0x3bbc('0x4');}}
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/adapters/aitextadapter
7
7
  * @publicApi
8
8
  */
9
- import { Plugin } from 'ckeditor5/src/core';
10
- import { default as AIAdapter } from './aiadapter';
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ import { default as AIAdapter } from './aiadapter.js';
11
11
  /**
12
12
  * Abstract base class for AI adapters that perform text-related requests.
13
13
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x1815=['aitextadapter-send-request-failed','aborted','get','textAdapter','requires','assign','reject','AI_ERROR_GET_PARAMETERS','plugins','editor','locale','catch','object','error','makeRequest','application/json','_prepareRequestParameters','resolve','AI_ERROR_GET_HEADERS','abortController','name','init'];(function(_0xe0dee9,_0x181505){const _0x2a31c7=function(_0x309565){while(--_0x309565){_0xe0dee9['push'](_0xe0dee9['shift']());}};_0x2a31c7(++_0x181505);}(_0x1815,0x9f));const _0x2a31=function(_0xe0dee9,_0x181505){_0xe0dee9=_0xe0dee9-0x0;let _0x2a31c7=_0x1815[_0xe0dee9];return _0x2a31c7;};import{Plugin as _0x3ec880}from'ckeditor5/src/core';import{CKEditorError as _0x3f8600}from'ckeditor5/src/utils';import{default as _0x53b5d5,AIRequestError as _0x290c08}from'./aiadapter';import{getTranslation as _0x2cdcff}from'../utils/common-translations';export default class P extends _0x3ec880{static get[_0x2a31('0x15')](){return[_0x53b5d5];}constructor(_0x4810e1){super(_0x4810e1),this[_0x2a31('0xe')]=new AbortController();}[_0x2a31('0x10')](){this[_0x2a31('0x4')][_0x2a31('0x3')][_0x2a31('0x13')](_0x53b5d5)[_0x2a31('0x14')]=this;}['abort'](){this[_0x2a31('0xe')]['signal'][_0x2a31('0x12')]||(this[_0x2a31('0xe')]['abort'](),this['abortController']=new AbortController());}async[_0x2a31('0x9')](_0x314f9a){return this['sendRequest'](_0x314f9a)[_0x2a31('0x6')](_0x5f3688=>{if(_0x5f3688 instanceof _0x290c08)return Promise[_0x2a31('0x1')](_0x5f3688);if('AbortError'==_0x5f3688[_0x2a31('0xf')])return Promise[_0x2a31('0xc')]();throw console[_0x2a31('0x8')](_0x5f3688),new _0x3f8600(_0x2a31('0x11'),null);});}async['_prepareRequestHeaders'](_0x5a420e,_0x1c601b){const _0x4b5f79=this[_0x2a31('0x4')][_0x2a31('0x5')],_0xf03070={'Content-Type':_0x2a31('0xa')};if(_0x2a31('0x7')==typeof _0x5a420e)Object[_0x2a31('0x0')](_0xf03070,_0x5a420e);else{if(_0x5a420e)try{const _0x367809=await _0x5a420e(_0x1c601b);Object[_0x2a31('0x0')](_0xf03070,_0x367809);}catch(_0x512424){return Promise[_0x2a31('0x1')](new _0x290c08(_0x2cdcff(_0x4b5f79,_0x2a31('0xd'))));}}return _0xf03070;}async[_0x2a31('0xb')](_0xc1484c,_0x3704a3){const _0x135dcd=this['editor'][_0x2a31('0x5')];if(_0x2a31('0x7')==typeof _0xc1484c)return _0xc1484c;try{return await _0xc1484c(_0x3704a3);}catch(_0x16787a){return Promise[_0x2a31('0x1')](new _0x290c08(_0x2cdcff(_0x135dcd,_0x2a31('0x2'))));}}}
23
+ const _0x1ba8=['makeRequest','_prepareRequestParameters','init','aitextadapter-send-request-failed','sendRequest','locale','resolve','_prepareRequestHeaders','abortController','catch','object','application/json','reject','name','error','assign','plugins','signal','editor','aborted','get','AI_ERROR_GET_PARAMETERS','abort'];(function(_0x2e5222,_0x1ba8a1){const _0x5a7f64=function(_0x5b77dd){while(--_0x5b77dd){_0x2e5222['push'](_0x2e5222['shift']());}};_0x5a7f64(++_0x1ba8a1);}(_0x1ba8,0x126));const _0x5a7f=function(_0x2e5222,_0x1ba8a1){_0x2e5222=_0x2e5222-0x0;let _0x5a7f64=_0x1ba8[_0x2e5222];return _0x5a7f64;};import{Plugin as _0x35e9db}from'ckeditor5/src/core.js';import{CKEditorError as _0x8d0012}from'ckeditor5/src/utils.js';import{default as _0x5f2cc2,AIRequestError as _0x2f8655}from'./aiadapter.js';import{getTranslation as _0xea8bf0}from'../utils/common-translations.js';export default class _ extends _0x35e9db{static get['requires'](){return[_0x5f2cc2];}constructor(_0x4de12b){super(_0x4de12b),this[_0x5a7f('0xd')]=new AbortController();}[_0x5a7f('0x7')](){this[_0x5a7f('0x0')][_0x5a7f('0x15')][_0x5a7f('0x2')](_0x5f2cc2)['textAdapter']=this;}[_0x5a7f('0x4')](){this[_0x5a7f('0xd')][_0x5a7f('0x16')][_0x5a7f('0x1')]||(this[_0x5a7f('0xd')][_0x5a7f('0x4')](),this[_0x5a7f('0xd')]=new AbortController());}async[_0x5a7f('0x5')](_0x43eddd){return this[_0x5a7f('0x9')](_0x43eddd)[_0x5a7f('0xe')](_0x1cdf7a=>{if(_0x1cdf7a instanceof _0x2f8655)return Promise['reject'](_0x1cdf7a);if('AbortError'==_0x1cdf7a[_0x5a7f('0x12')])return Promise[_0x5a7f('0xb')]();throw console[_0x5a7f('0x13')](_0x1cdf7a),new _0x8d0012(_0x5a7f('0x8'),null);});}async[_0x5a7f('0xc')](_0x46ba52,_0x43d4cc){const _0x62c49a=this[_0x5a7f('0x0')][_0x5a7f('0xa')],_0x3b60d2={'Content-Type':_0x5a7f('0x10')};if(_0x5a7f('0xf')==typeof _0x46ba52)Object[_0x5a7f('0x14')](_0x3b60d2,_0x46ba52);else{if(_0x46ba52)try{const _0x398bda=await _0x46ba52(_0x43d4cc);Object[_0x5a7f('0x14')](_0x3b60d2,_0x398bda);}catch(_0x375d30){return Promise['reject'](new _0x2f8655(_0xea8bf0(_0x62c49a,'AI_ERROR_GET_HEADERS')));}}return _0x3b60d2;}async[_0x5a7f('0x6')](_0x164509,_0x409b60){const _0x205343=this[_0x5a7f('0x0')][_0x5a7f('0xa')];if(_0x5a7f('0xf')==typeof _0x164509)return _0x164509;try{return await _0x164509(_0x409b60);}catch(_0x3ba33c){return Promise[_0x5a7f('0x11')](new _0x2f8655(_0xea8bf0(_0x205343,_0x5a7f('0x3'))));}}}
@@ -1,16 +1,16 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/adapters/awstextadapter
7
7
  * @publicApi
8
8
  */
9
- import { type Editor } from 'ckeditor5/src/core';
10
- import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter';
9
+ import { type Editor } from 'ckeditor5/src/core.js';
10
+ import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter.js';
11
11
  import { type BedrockRuntimeClientConfig } from '@aws-sdk/client-bedrock-runtime';
12
12
  /**
13
- * Adapter for AI text-related requests that supports AWS Bedrock service.
13
+ * Adapter for AI text-related requests that supports the Amazon Bedrock service.
14
14
  *
15
15
  * See also {@link module:ai/adapters/aitextadapter~AITextAdapter}.
16
16
  */
@@ -24,13 +24,13 @@ export default class AWSTextAdapter extends AITextAdapter {
24
24
  */
25
25
  constructor(editor: Editor);
26
26
  /**
27
- * Performs the request to the AWS Bedrock service or to the endpoint provided in the editor configuration.
27
+ * Performs the request to the Amazon Bedrock service or to the endpoint provided in the editor configuration.
28
28
  *
29
29
  * If you want to extend this adapter, you can overload this method to do some additional processing or make an external call.
30
30
  */
31
31
  sendRequest({ query, context, onData, actionId }: AITextAdapterRequestData): Promise<void>;
32
32
  /**
33
- * Prepares the actual full prompt for the request to the AWS Bedrock API.
33
+ * Prepares the actual full prompt for the request to the Amazon Bedrock API.
34
34
  *
35
35
  * The prompt may differ depending on what model is used.
36
36
  *
@@ -43,18 +43,18 @@ export default class AWSTextAdapter extends AITextAdapter {
43
43
  */
44
44
  preparePrompt(query: string, context: string, model: string, actionId: string): Promise<string>;
45
45
  /**
46
- * For given `model`, returns the family to which this model belongs.
46
+ * For a given model, it returns the family to which this model belongs.
47
47
  *
48
- * For example, for `anthropic.claude-instant-v1` will return `anthropic.claude`.
48
+ * For example, for `anthropic.claude-instant-v1` it will return `anthropic.claude`.
49
49
  *
50
- * Throws {@link module:ai/adapters/aiadapter~AIRequestError `AIRequestError`} if given `model` is not supported.
50
+ * Throws {@link module:ai/adapters/aiadapter~AIRequestError `AIRequestError`} if a given model is not supported.
51
51
  */
52
52
  getModelFamily(model: string): AWSModelFamily;
53
53
  }
54
54
  /**
55
- * The configuration for the AWS Bedrock adapter.
55
+ * The configuration for the Amazon Bedrock adapter.
56
56
  *
57
- * The properties defined in this config are set in the `config.ai.aws` namespace.
57
+ * The properties defined in this configuration are set in the `config.ai.aws` namespace.
58
58
  *
59
59
  * ```ts
60
60
  * ClassicEditor
@@ -77,20 +77,20 @@ export interface AWSTextAdapterConfig {
77
77
  /**
78
78
  * The URL to which the AI service request will be sent.
79
79
  *
80
- * Set this value only if you want to connect to AWS Bedrock using a proxy endpoint.
80
+ * Set this value only if you want to connect to Amazon Bedrock using a proxy endpoint.
81
81
  *
82
82
  * If `apiUrl` is not provided, the AWS-SDK library will be used to process the request. It will set a proper URL on its own.
83
83
  */
84
84
  apiUrl?: string;
85
85
  /**
86
- * Object with headers to set in the request to the AI service.
86
+ * An object with headers to set in the request to the AI service.
87
87
  *
88
- * **These headers are only used when connecting to AWS through the proxy endpoint (i.e. when `apiUrl` is set).**
88
+ * **These headers are only used when connecting to AWS through the proxy endpoint (that is, when `apiUrl` is set).**
89
89
  *
90
- * Otherwise, AWS-SDK library is used, and it sets the request headers on its own. In this mode, the request headers cannot be
90
+ * Otherwise, the AWS-SDK library is used, and it sets the request headers on its own. In this mode, the request headers cannot be
91
91
  * customized.
92
92
  *
93
- * If the provided value is an `object`, it is simply used as provided.
93
+ * If the provided value is an object, it is simply used as provided.
94
94
  *
95
95
  * ```js
96
96
  * {
@@ -105,9 +105,9 @@ export interface AWSTextAdapterConfig {
105
105
  * }
106
106
  * ```
107
107
  *
108
- * If the provided value is a function, it should be a function that returns a `Promise` which resolves with the headers object.
108
+ * If the provided value is a function, it should be a function that returns a promise which resolves with the headers object.
109
109
  * This way, you can perform an authorization request to your application and receive the authorization token (and also implement
110
- * any custom logic on the back-end side). The headers object is then used to make the actual call to the AI service.
110
+ * any custom logic on the backend side). The headers object is then used to make the actual call to the AI service.
111
111
  *
112
112
  * ```js
113
113
  * {
@@ -126,7 +126,7 @@ export interface AWSTextAdapterConfig {
126
126
  * }
127
127
  * ```
128
128
  *
129
- * The function is passed {@link module:ai/adapters/aitextadapter~AITextAdapterRequestData#actionId `actionId`} parameter to make it
129
+ * The function is passed the {@link module:ai/adapters/aitextadapter~AITextAdapterRequestData#actionId `actionId`} parameter to make it
130
130
  * possible to further customize the headers.
131
131
  *
132
132
  * If the function fails for any reason, the promise should be rejected. In this case, a feature that made the request should display
@@ -141,12 +141,12 @@ export interface AWSTextAdapterConfig {
141
141
  *
142
142
  * See [AWS model parameters reference](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html) to learn more.
143
143
  *
144
- * If the provided value is an `object`, it is passed to the request as provided.
144
+ * If the provided value is an object, it is passed to the request as provided.
145
145
  *
146
- * If the provided value is a function, it should be a function that returns a `Promise` which resolves with the request parameters
146
+ * If the provided value is a function, it should be a function that returns a promise which resolves with the request parameters
147
147
  * object. This gives you more flexibility to provide parameters for the AI model.
148
148
  *
149
- * The function is passed {@link module:ai/adapters/aitextadapter~AITextAdapterRequestData#actionId `actionId`} parameter to make it
149
+ * The function is passed the {@link module:ai/adapters/aitextadapter~AITextAdapterRequestData#actionId `actionId`} parameter to make it
150
150
  * possible to further customize the parameters.
151
151
  *
152
152
  * If the function fails for any reason, the promise should be rejected. In this case, the feature that made the request should display
@@ -168,10 +168,10 @@ export interface AWSTextAdapterConfig {
168
168
  */
169
169
  requestParameters?: RequestParameters;
170
170
  /**
171
- * Configuration for AWS-SDK Bedrock Runtime Client.
171
+ * The configuration for AWS-SDK Bedrock Runtime Client.
172
172
  *
173
173
  * If `apiUrl` is not provided, this configuration will be used to initialize the Bedrock Runtime Client which will be used to process
174
- * the requests. The adapter will make requests directly to the AWS Bedrock service.
174
+ * the requests. The adapter will make requests directly to the Amazon Bedrock service.
175
175
  */
176
176
  bedrockClientConfig?: BedrockRuntimeClientConfig;
177
177
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x4e44=['signal','ai.aws.requestParameters.anthropic_version','ai.aws.requestParameters.top_k','sendRequest','from','_readStreamableResponse','decode','getReader','_prepareRequestParameters','locale','text','_requestParameters','body','ai.aws.apiUrl','ai21.j2','ai.aws.bedrockClientConfig','_apiUrl','utf-8','\x0a[/INST]','_requestHeaders','\x0a\x0aAssistant:','Human:\x0a','preparePrompt','editor','send','data','Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','cohere.command','_bedrockClientConfig','test','define','_processProxyRequest','bytes','abortController','ai.aws.requestParameters','_cleanUpData','chunk','Instruction:\x0a','meta.llama','get','bedrock-2023-05-31','_readStaticResponse','ai.aws.requestParameters.model','read','application/json','_processAWSRequest','Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','completion','generation','<<SYS>>\x0a','AWSTextAdapter','utf8','ai.aws.requestParameters.stream','ai.aws.requestHeaders','config','startsWith','completions','parse','generations','ai.aws.requestParameters.max_tokens_to_sample','\x0a<</SYS>>\x0a[INST]\x0a','json','ai.aws.requestParameters.top_p','</span>','<span>','_readAsyncIterableResponse','resolve','getModelFamily','stringify'];(function(_0x4d8f66,_0x4e44b2){const _0x55e7ba=function(_0x7434cf){while(--_0x7434cf){_0x4d8f66['push'](_0x4d8f66['shift']());}};_0x55e7ba(++_0x4e44b2);}(_0x4e44,0x1aa));const _0x55e7=function(_0x4d8f66,_0x4e44b2){_0x4d8f66=_0x4d8f66-0x0;let _0x55e7ba=_0x4e44[_0x4d8f66];return _0x55e7ba;};import{default as _0x25bbce}from'./aitextadapter';import{AIRequestError as _0x596325}from'./aiadapter';import{BedrockRuntimeClient as _0x436082,InvokeModelCommand as _0x2a0295,InvokeModelWithResponseStreamCommand as _0x3209c0}from'@aws-sdk/client-bedrock-runtime';import{getTranslation as _0x41c689}from'../utils/common-translations';export default class H extends _0x25bbce{static get['pluginName'](){return _0x55e7('0x26');}constructor(_0x3c349d){super(_0x3c349d),_0x3c349d['config'][_0x55e7('0x1b')](_0x55e7('0x16'))||(_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x12')](_0x55e7('0x1e'),'anthropic.claude-v2'),_0x3c349d[_0x55e7('0x2a')]['define'](_0x55e7('0x2f'),0x7d0),_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x12')]('ai.aws.requestParameters.temperature',0x1),_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x12')](_0x55e7('0x32'),0x1),_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x12')](_0x55e7('0x3b'),0xfa),_0x3c349d['config'][_0x55e7('0x12')](_0x55e7('0x3a'),_0x55e7('0x1c')),_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x12')](_0x55e7('0x28'),!0x0)),this[_0x55e7('0x4')]=_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x1b')](_0x55e7('0x1')),this['_bedrockClientConfig']=_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x1b')](_0x55e7('0x3')),this[_0x55e7('0x7')]=_0x3c349d['config']['get'](_0x55e7('0x29')),this[_0x55e7('0x44')]=_0x3c349d[_0x55e7('0x2a')][_0x55e7('0x1b')]('ai.aws.requestParameters');}async[_0x55e7('0x3c')]({query:_0x280baf,context:_0xabe2cb,onData:_0x38e37,actionId:_0x2d8bc4}){const {model:_0x2f32dc,stream:_0x2aa8f7,..._0x447459}=await this[_0x55e7('0x41')](this[_0x55e7('0x44')],_0x2d8bc4),_0x15170a={'prompt':await this[_0x55e7('0xa')](_0x280baf,_0xabe2cb,_0x2f32dc,_0x2d8bc4),..._0x447459};this[_0x55e7('0x4')]?await this[_0x55e7('0x13')](_0x15170a,_0x2f32dc,_0x2aa8f7,_0x38e37,_0x2d8bc4):await this[_0x55e7('0x21')](_0x15170a,_0x2f32dc,_0x2aa8f7,_0x38e37);}async[_0x55e7('0xa')](_0x4e4cb6,_0x27e3cc,_0x2c06c7,_0x2796fe){let _0x5e817f,_0x336034;return _0x27e3cc?(_0x5e817f=_0x55e7('0x22'),_0x336034=_0x55e7('0x19')+_0x4e4cb6+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+(_0x27e3cc[_0x55e7('0x2b')]('<')?_0x27e3cc:_0x55e7('0x34')+_0x27e3cc+_0x55e7('0x33'))):(_0x5e817f=_0x55e7('0xe'),_0x336034=_0x4e4cb6),_0x55e7('0x1a')==this['getModelFamily'](_0x2c06c7)?_0x55e7('0x25')+_0x5e817f+_0x55e7('0x30')+_0x336034+_0x55e7('0x6'):_0x55e7('0x9')+_0x5e817f+'\x0a'+_0x336034+_0x55e7('0x8');}[_0x55e7('0x37')](_0x4df8f7){if(/^anthropic\.claude/['test'](_0x4df8f7))return'anthropic.claude';if(/^ai21\.j2/[_0x55e7('0x11')](_0x4df8f7))return _0x55e7('0x2');if(/^cohere\.command/[_0x55e7('0x11')](_0x4df8f7))return _0x55e7('0xf');if(/^meta\.llama/[_0x55e7('0x11')](_0x4df8f7))return _0x55e7('0x1a');throw new _0x596325(_0x41c689(this[_0x55e7('0xb')][_0x55e7('0x42')],'AI_ERROR_UNSUPPORTED_MODEL',_0x4df8f7));}async[_0x55e7('0x13')](_0xbfc1fe,_0x52ff12,_0x2cea8a,_0x49c904,_0x6a68c5){const _0x3d4441={'method':'POST','headers':await this['_prepareRequestHeaders'](this[_0x55e7('0x7')],_0x6a68c5),'body':JSON[_0x55e7('0x38')]({..._0xbfc1fe,'model':_0x52ff12,'stream':_0x2cea8a}),'signal':this[_0x55e7('0x15')][_0x55e7('0x39')]},_0x347f4f=await fetch(this[_0x55e7('0x4')],_0x3d4441);_0x2cea8a?await this[_0x55e7('0x3e')](_0x347f4f,_0x52ff12,_0x49c904):await this[_0x55e7('0x1d')](_0x347f4f,_0x52ff12,_0x49c904);}async[_0x55e7('0x21')](_0x579636,_0x4f4184,_0x4219f8,_0x32decb){const _0x55521a=new _0x436082(this[_0x55e7('0x10')]),_0x242860={'body':JSON[_0x55e7('0x38')](_0x579636),'contentType':'application/json','accept':_0x55e7('0x20'),'modelId':_0x4f4184};let _0x34ec7c;if(_0x4219f8){const _0x5eb774=new _0x3209c0(_0x242860);_0x34ec7c=await _0x55521a['send'](_0x5eb774,{'abortSignal':this[_0x55e7('0x15')][_0x55e7('0x39')]}),await this[_0x55e7('0x35')](_0x34ec7c,_0x4f4184,_0x32decb);}else{const _0x9fd913=new _0x2a0295(_0x242860);_0x34ec7c=await _0x55521a[_0x55e7('0xc')](_0x9fd913,{'abortSignal':this[_0x55e7('0x15')]['signal']}),await this[_0x55e7('0x1d')](_0x34ec7c,_0x4f4184,_0x32decb);}}async[_0x55e7('0x35')](_0x2e8305,_0x23f610,_0x84720d){const _0x5ebc2a=_0x2e8305[_0x55e7('0x0')],_0x2be7a3=(_0x5ebc2a[Symbol['asyncIterator']](),new TextDecoder('utf-8'));let _0x50f02b='';for await(const _0x102488 of _0x5ebc2a)if(_0x102488['chunk']){const _0x43cbec=_0x2be7a3[_0x55e7('0x3f')](_0x102488[_0x55e7('0x18')][_0x55e7('0x14')]),_0x50779c=JSON[_0x55e7('0x2d')](_0x43cbec);_0x50f02b+=this[_0x55e7('0x17')](_0x50779c,_0x23f610),_0x84720d(_0x50f02b);}return Promise[_0x55e7('0x36')]();}async[_0x55e7('0x3e')](_0x5202e0,_0x3c8c02,_0x302bcf){const _0x5c4b7e=_0x5202e0['body'],_0x46945a=new TextDecoder(_0x55e7('0x5'));let _0x15311c='';const _0x523f89=_0x5c4b7e[_0x55e7('0x40')]();let _0x52cbb9=!0x1;for(;!_0x52cbb9;){const {done:_0x4dc4f3,value:_0x25c9a0}=await _0x523f89[_0x55e7('0x1f')]();if(_0x52cbb9=_0x4dc4f3,_0x52cbb9)break;const _0x545974=_0x46945a[_0x55e7('0x3f')](_0x25c9a0),_0xed12d8=JSON[_0x55e7('0x2d')](_0x545974);_0x15311c+=this[_0x55e7('0x17')](_0xed12d8,_0x3c8c02),_0x302bcf(_0x15311c);}return Promise[_0x55e7('0x36')]();}async['_readStaticResponse'](_0x2f19e5,_0x14df5d,_0xc54ca){let _0x574d93;return _0x574d93=_0x2f19e5 instanceof Response?await _0x2f19e5[_0x55e7('0x31')]():JSON[_0x55e7('0x2d')](Buffer[_0x55e7('0x3d')](_0x2f19e5[_0x55e7('0x0')])['toString'](_0x55e7('0x27'))),(_0xc54ca(this[_0x55e7('0x17')](_0x574d93,_0x14df5d)),Promise[_0x55e7('0x36')]());}[_0x55e7('0x17')](_0x1ad77d,_0x5bf695){switch(this['getModelFamily'](_0x5bf695)){case'anthropic.claude':return _0x1ad77d[_0x55e7('0x23')];case _0x55e7('0x2'):return _0x1ad77d[_0x55e7('0x2c')][0x0][_0x55e7('0xd')][_0x55e7('0x43')];case'cohere.command':return _0x1ad77d[_0x55e7('0x2e')][0x0][_0x55e7('0x43')];case _0x55e7('0x1a'):return _0x1ad77d[_0x55e7('0x24')];}}}
23
+ const _0x49e3=['cohere.command','_apiUrl','split','ai.aws.requestParameters.anthropic_version','parse','preparePrompt','completions','read','json','meta.llama','_prepareRequestParameters','body','decode','join','pluginName','\x0a\x0aAssistant:','map','bytes','application/json','from','<<SYS>>\x0a','ai.aws.requestParameters.max_tokens_to_sample','chunk','bedrock-2023-05-31','editor','resolve','Instruction:\x0a','AWSTextAdapter','_processAWSRequest','data','startsWith','stringify','_readStreamableResponse','get','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','ai.aws.requestParameters.top_p','utf-8','_requestHeaders','_readStaticResponse','completion','_readAsyncIterableResponse','signal','utf8','text','_getGeneratedText','filter','getReader','\x0a<</SYS>>\x0a[INST]\x0a','test','getModelFamily','sendRequest','generations','_bedrockClientConfig','Human:\x0a','define','ai.aws.requestParameters.stream','config','POST','_requestParameters','anthropic.claude-v2','ai.aws.requestParameters.model','Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','_processProxyRequest','ai.aws.requestParameters.temperature','length','ai21.j2','locale','ai.aws.bedrockClientConfig','\x0a[/INST]','_prepareRequestHeaders','ai.aws.requestParameters','abortController','ai.aws.apiUrl'];(function(_0x829635,_0x49e348){const _0x12e164=function(_0x3af88b){while(--_0x3af88b){_0x829635['push'](_0x829635['shift']());}};_0x12e164(++_0x49e348);}(_0x49e3,0x86));const _0x12e1=function(_0x829635,_0x49e348){_0x829635=_0x829635-0x0;let _0x12e164=_0x49e3[_0x829635];return _0x12e164;};import{default as _0x4059f9}from'./aitextadapter.js';import{AIRequestError as _0x5dc193}from'./aiadapter.js';import{BedrockRuntimeClient as _0x359174,InvokeModelCommand as _0x32f221,InvokeModelWithResponseStreamCommand as _0x354837}from'@aws-sdk/client-bedrock-runtime';import{getTranslation as _0x4eaf34}from'../utils/common-translations.js';export default class H extends _0x4059f9{static get[_0x12e1('0x1a')](){return _0x12e1('0x27');}constructor(_0x14a070){super(_0x14a070),_0x14a070[_0x12e1('0x44')]['get'](_0x12e1('0x9'))||(_0x14a070[_0x12e1('0x44')][_0x12e1('0x42')](_0x12e1('0x48'),_0x12e1('0x47')),_0x14a070[_0x12e1('0x44')]['define'](_0x12e1('0x21'),0x7d0),_0x14a070[_0x12e1('0x44')]['define'](_0x12e1('0x2'),0x1),_0x14a070['config'][_0x12e1('0x42')](_0x12e1('0x2f'),0x1),_0x14a070[_0x12e1('0x44')][_0x12e1('0x42')]('ai.aws.requestParameters.top_k',0xfa),_0x14a070['config'][_0x12e1('0x42')](_0x12e1('0xf'),_0x12e1('0x23')),_0x14a070[_0x12e1('0x44')][_0x12e1('0x42')](_0x12e1('0x43'),!0x0)),this[_0x12e1('0xd')]=_0x14a070[_0x12e1('0x44')][_0x12e1('0x2d')](_0x12e1('0xb')),this['_bedrockClientConfig']=_0x14a070[_0x12e1('0x44')]['get'](_0x12e1('0x6')),this[_0x12e1('0x31')]=_0x14a070[_0x12e1('0x44')][_0x12e1('0x2d')]('ai.aws.requestHeaders'),this[_0x12e1('0x46')]=_0x14a070[_0x12e1('0x44')]['get']('ai.aws.requestParameters');}async[_0x12e1('0x3e')]({query:_0x59c7b6,context:_0x4d2be0,onData:_0xf86a97,actionId:_0x32a69d}){const {model:_0x2de079,stream:_0x17641d,..._0x4fd126}=await this[_0x12e1('0x16')](this[_0x12e1('0x46')],_0x32a69d),_0x5a6709={'prompt':await this[_0x12e1('0x11')](_0x59c7b6,_0x4d2be0,_0x2de079,_0x32a69d),..._0x4fd126};this[_0x12e1('0xd')]?await this[_0x12e1('0x1')](_0x5a6709,_0x2de079,_0x17641d,_0xf86a97,_0x32a69d):await this['_processAWSRequest'](_0x5a6709,_0x2de079,_0x17641d,_0xf86a97);}async[_0x12e1('0x11')](_0x4d6bc5,_0x3a5dfe,_0x1c5f5e,_0x5b8fb3){let _0x1e2579,_0x2bb547;return _0x3a5dfe?(_0x1e2579='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x2bb547=_0x12e1('0x26')+_0x4d6bc5+_0x12e1('0x2e')+(_0x3a5dfe[_0x12e1('0x2a')]('<')?_0x3a5dfe:'<span>'+_0x3a5dfe+'</span>')):(_0x1e2579=_0x12e1('0x0'),_0x2bb547=_0x4d6bc5),'meta.llama'==this[_0x12e1('0x3d')](_0x1c5f5e)?_0x12e1('0x20')+_0x1e2579+_0x12e1('0x3b')+_0x2bb547+_0x12e1('0x7'):_0x12e1('0x41')+_0x1e2579+'\x0a'+_0x2bb547+_0x12e1('0x1b');}[_0x12e1('0x3d')](_0x566303){if(/^anthropic\.claude/[_0x12e1('0x3c')](_0x566303))return'anthropic.claude';if(/^ai21\.j2/[_0x12e1('0x3c')](_0x566303))return'ai21.j2';if(/^cohere\.command/[_0x12e1('0x3c')](_0x566303))return _0x12e1('0xc');if(/^meta\.llama/['test'](_0x566303))return _0x12e1('0x15');throw new _0x5dc193(_0x4eaf34(this[_0x12e1('0x24')][_0x12e1('0x5')],'AI_ERROR_UNSUPPORTED_MODEL',_0x566303));}async[_0x12e1('0x1')](_0x4c8dd5,_0x3b2d1b,_0xa5ec4a,_0x4b1161,_0xafca01){const _0x59a577={'method':_0x12e1('0x45'),'headers':await this[_0x12e1('0x8')](this[_0x12e1('0x31')],_0xafca01),'body':JSON[_0x12e1('0x2b')]({..._0x4c8dd5,'model':_0x3b2d1b,'stream':_0xa5ec4a}),'signal':this['abortController'][_0x12e1('0x35')]},_0x4f466b=await fetch(this['_apiUrl'],_0x59a577);_0xa5ec4a?await this[_0x12e1('0x2c')](_0x4f466b,_0x3b2d1b,_0x4b1161):await this[_0x12e1('0x32')](_0x4f466b,_0x3b2d1b,_0x4b1161);}async[_0x12e1('0x28')](_0x177038,_0x425a5e,_0x4ee445,_0x46ae24){const _0x51ab2a=new _0x359174(this[_0x12e1('0x40')]),_0x7ab5d={'body':JSON['stringify'](_0x177038),'contentType':_0x12e1('0x1e'),'accept':'application/json','modelId':_0x425a5e};let _0x3fbf4c;if(_0x4ee445){const _0x298afe=new _0x354837(_0x7ab5d);_0x3fbf4c=await _0x51ab2a['send'](_0x298afe,{'abortSignal':this['abortController']['signal']}),await this[_0x12e1('0x34')](_0x3fbf4c,_0x425a5e,_0x46ae24);}else{const _0x17a166=new _0x32f221(_0x7ab5d);_0x3fbf4c=await _0x51ab2a['send'](_0x17a166,{'abortSignal':this[_0x12e1('0xa')][_0x12e1('0x35')]}),await this[_0x12e1('0x32')](_0x3fbf4c,_0x425a5e,_0x46ae24);}}async[_0x12e1('0x34')](_0x3752ed,_0x489084,_0x35eadd){const _0x18a614=_0x3752ed[_0x12e1('0x17')],_0x565f39=new TextDecoder('utf-8');let _0x3cd51b='';for await(const _0x5cbff5 of _0x18a614)if(_0x5cbff5[_0x12e1('0x22')]){const _0x2b7f70=_0x565f39[_0x12e1('0x18')](_0x5cbff5[_0x12e1('0x22')][_0x12e1('0x1d')]),_0xbd7b90=JSON[_0x12e1('0x10')](_0x2b7f70);_0x3cd51b+=this[_0x12e1('0x38')](_0xbd7b90,_0x489084),_0x35eadd(_0x3cd51b);}return Promise[_0x12e1('0x25')]();}async[_0x12e1('0x2c')](_0x2fd4e9,_0x59a888,_0x2c92a8){const _0x4af78c=_0x2fd4e9[_0x12e1('0x17')],_0x87be23=new TextDecoder(_0x12e1('0x30')),_0x5e6abb=_0x4af78c[_0x12e1('0x3a')]();let _0x134601='',_0xa07a='',_0x229092=!0x1;for(;!_0x229092;){const {done:_0x2e04c2,value:_0x555071}=await _0x5e6abb[_0x12e1('0x13')]();if(_0x229092=_0x2e04c2,_0x229092)break;const _0x2dd88e=(_0x134601+_0x87be23[_0x12e1('0x18')](_0x555071))[_0x12e1('0xe')]('\x0a')[_0x12e1('0x1c')](_0x93d769=>{try{return _0x134601='',JSON[_0x12e1('0x10')](_0x93d769);}catch(_0x5d8926){return _0x134601=_0x93d769,null;}})[_0x12e1('0x39')](_0x2895ba=>null!==_0x2895ba);_0x2dd88e[_0x12e1('0x3')]&&(_0xa07a+=_0x2dd88e['map'](_0x577b1b=>this[_0x12e1('0x38')](_0x577b1b,_0x59a888))[_0x12e1('0x19')](''),_0x2c92a8(_0xa07a));}return Promise['resolve']();}async[_0x12e1('0x32')](_0x569107,_0x268273,_0x4dbd20){let _0x52b6ef;return _0x52b6ef=_0x569107 instanceof Response?await _0x569107[_0x12e1('0x14')]():JSON['parse'](Buffer[_0x12e1('0x1f')](_0x569107[_0x12e1('0x17')])['toString'](_0x12e1('0x36'))),(_0x4dbd20(this['_getGeneratedText'](_0x52b6ef,_0x268273)),Promise[_0x12e1('0x25')]());}[_0x12e1('0x38')](_0x3f63c6,_0x58e20b){switch(this[_0x12e1('0x3d')](_0x58e20b)){case'anthropic.claude':return _0x3f63c6[_0x12e1('0x33')];case _0x12e1('0x4'):return _0x3f63c6[_0x12e1('0x12')][0x0][_0x12e1('0x29')][_0x12e1('0x37')];case _0x12e1('0xc'):return _0x3f63c6[_0x12e1('0x3f')][0x0][_0x12e1('0x37')];case _0x12e1('0x15'):return _0x3f63c6['generation'];}}}
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/adapters/openaitextadapter
7
7
  * @publicApi
8
8
  */
9
- import { type Editor } from 'ckeditor5/src/core';
10
- import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter';
9
+ import { type Editor } from 'ckeditor5/src/core.js';
10
+ import { default as AITextAdapter, type AITextAdapterRequestData, type RequestHeaders, type RequestParameters } from './aitextadapter.js';
11
11
  /**
12
12
  * Adapter for AI text-related requests that supports OpenAI and Azure OpenAI services.
13
13
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x167a=['prepareMessages','ai.openAI.requestHeaders','AI_ERROR_CONTEXT_LENGTH','filter','POST','_prepareRequestHeaders','_cleanUpData','split','length','_requestParameters','Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','get','_readStreamableResponse','_apiUrl','_isBufferIncomplete','ai.openAI.requestParameters.top_p','delta','_readStaticResponse','choices','user','getReader','read','signal','reject','ai.openAI.requestParameters.temperature','content','config','includes','context_length_exceeded','sendRequest','[DONE]','</span>','text','resolve','editor','_requestHeaders','stream','define','parse','Instruction:\x0a','locale','json','gpt-3.5-turbo','pluginName','system','abortController','ai.openAI.apiUrl'];(function(_0x5ed576,_0x167a22){const _0xd3c009=function(_0x2302b0){while(--_0x2302b0){_0x5ed576['push'](_0x5ed576['shift']());}};_0xd3c009(++_0x167a22);}(_0x167a,0x1f2));const _0xd3c0=function(_0x5ed576,_0x167a22){_0x5ed576=_0x5ed576-0x0;let _0xd3c009=_0x167a[_0x5ed576];return _0xd3c009;};import{default as _0x34e1f6}from'./aitextadapter';import{AIRequestError as _0xc9f95f}from'./aiadapter';import{getTranslation as _0x556c66}from'../utils/common-translations';export default class M extends _0x34e1f6{static get[_0xd3c0('0xf')](){return'OpenAITextAdapter';}constructor(_0x182769){super(_0x182769),_0x182769[_0xd3c0('0x2d')][_0xd3c0('0x9')](_0xd3c0('0x12'),'https://api.openai.com/v1/chat/completions'),_0x182769[_0xd3c0('0x2d')][_0xd3c0('0x9')]('ai.openAI.requestParameters.model',_0xd3c0('0xe')),_0x182769[_0xd3c0('0x2d')][_0xd3c0('0x9')]('ai.openAI.requestParameters.max_tokens',0x7d0),_0x182769[_0xd3c0('0x2d')]['define'](_0xd3c0('0x2b'),0x1),_0x182769[_0xd3c0('0x2d')][_0xd3c0('0x9')](_0xd3c0('0x22'),0x1),_0x182769[_0xd3c0('0x2d')]['define']('ai.openAI.requestParameters.stream',!0x0),this[_0xd3c0('0x20')]=_0x182769[_0xd3c0('0x2d')][_0xd3c0('0x1e')]('ai.openAI.apiUrl'),this[_0xd3c0('0x7')]=_0x182769[_0xd3c0('0x2d')][_0xd3c0('0x1e')](_0xd3c0('0x14'))||{},this[_0xd3c0('0x1c')]=_0x182769[_0xd3c0('0x2d')][_0xd3c0('0x1e')]('ai.openAI.requestParameters');}async[_0xd3c0('0x1')]({query:_0x1d319c,context:_0x56bb43,onData:_0x56bd9c,actionId:_0x378a60}){const _0x14f400=this[_0xd3c0('0x6')][_0xd3c0('0xc')],_0x1210a1=await this[_0xd3c0('0x13')](_0x1d319c,_0x56bb43,_0x378a60),_0x1d082f=await this[_0xd3c0('0x18')](this['_requestHeaders'],_0x378a60),_0x3f454e=await this['_prepareRequestParameters'](this['_requestParameters'],_0x378a60),_0x258b54={'messages':_0x1210a1,..._0x3f454e},_0x1a838f={'method':_0xd3c0('0x17'),'headers':_0x1d082f,'body':JSON['stringify'](_0x258b54),'signal':this[_0xd3c0('0x11')][_0xd3c0('0x29')]},_0x216d4e=await fetch(this[_0xd3c0('0x20')],_0x1a838f);if(_0x216d4e['ok'])return _0x3f454e[_0xd3c0('0x8')]?await this[_0xd3c0('0x1f')](_0x216d4e,_0x56bd9c):await this[_0xd3c0('0x24')](_0x216d4e,_0x56bd9c),Promise[_0xd3c0('0x5')]();{const _0x478e6d=await _0x216d4e[_0xd3c0('0x4')]();return _0x478e6d['includes'](_0xd3c0('0x0'))?Promise['reject'](new _0xc9f95f(_0x556c66(_0x14f400,_0xd3c0('0x15')))):_0x478e6d[_0xd3c0('0x2e')]('Moderation')?Promise[_0xd3c0('0x2a')](new _0xc9f95f(_0x556c66(_0x14f400,'AI_ERROR_MODERATION'))):Promise[_0xd3c0('0x2a')](new Error(_0x478e6d));}}async[_0xd3c0('0x13')](_0x1a4332,_0x4d1628,_0x2d16e9){let _0x11ae76,_0x56696f;return _0x4d1628?(_0x11ae76='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x56696f=_0xd3c0('0xb')+_0x1a4332+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+(_0x4d1628['startsWith']('<')?_0x4d1628:'<span>'+_0x4d1628+_0xd3c0('0x3'))):(_0x11ae76=_0xd3c0('0x1d'),_0x56696f=_0x1a4332),[{'role':_0xd3c0('0x10'),'content':_0x11ae76},{'role':_0xd3c0('0x26'),'content':_0x56696f}];}async[_0xd3c0('0x1f')](_0xe917c5,_0xfb6860){const _0x12c2cd=_0xe917c5['body'][_0xd3c0('0x27')](),_0x3e9b4c=new TextDecoder();let _0x11e726='',_0x5eaa34='',_0xe619ac='',_0x32fcc6=!0x1;for(;!_0x32fcc6;){const {done:_0x22380a,value:_0x5e6813}=await _0x12c2cd[_0xd3c0('0x28')](),_0xfb20e2=_0x11e726+_0x3e9b4c['decode'](_0x5e6813);let _0xbc6030='';_0x32fcc6=_0x22380a;try{_0xbc6030=this[_0xd3c0('0x19')](_0xfb20e2),_0x11e726='';}catch(_0x2f204e){_0x11e726=_0xfb20e2;continue;}_0x5eaa34+=_0xbc6030,!_0x32fcc6&&this[_0xd3c0('0x21')](_0x5eaa34)||_0x5eaa34&&(_0xe619ac+=_0x5eaa34,_0x5eaa34='',_0xfb6860(_0xe619ac));}return Promise['resolve']();}async[_0xd3c0('0x24')](_0x2f7c06,_0x379fa7){return _0x379fa7((await _0x2f7c06[_0xd3c0('0xd')]())[_0xd3c0('0x25')][0x0]['message'][_0xd3c0('0x2c')]),Promise[_0xd3c0('0x5')]();}[_0xd3c0('0x21')](_0x2b267d){const _0x3c85a2=_0x2b267d[_0xd3c0('0x1a')]('<')[_0xd3c0('0x1b')]!==_0x2b267d[_0xd3c0('0x1a')]('>')[_0xd3c0('0x1b')],_0x11271c=_0x2b267d[_0xd3c0('0x1b')]<0x1e;return _0x3c85a2&&_0x11271c;}[_0xd3c0('0x19')](_0x568390){return _0x568390[_0xd3c0('0x1a')](/\n(?![^{]*\})/g)['map'](_0x3e666b=>_0x3e666b['replace']('data:\x20',''))[_0xd3c0('0x16')](_0x31d13b=>_0x31d13b&&_0x31d13b[_0xd3c0('0x1b')]>0x0&&_0xd3c0('0x2')!==_0x31d13b)['map'](_0x11fb0f=>{const {choices:_0x234a5c}=JSON[_0xd3c0('0xa')](_0x11fb0f);if(_0x234a5c[0x0]&&_0x234a5c[0x0][_0xd3c0('0x23')]&&_0x234a5c[0x0]['delta'][_0xd3c0('0x2c')])return _0x234a5c[0x0][_0xd3c0('0x23')]['content'];})[_0xd3c0('0x16')](_0x4da758=>_0x4da758)['join']('');}}
23
+ const _0x5718=['ai.openAI.apiUrl','context_length_exceeded','define','parse','replace','Instruction:\x0a','json','ai.openAI.requestParameters.top_p','Moderation','_apiUrl','[DONE]','_readStreamableResponse','text','_requestParameters','editor','ai.openAI.requestHeaders','_isBufferIncomplete','prepareMessages','split','ai.openAI.requestParameters.max_tokens','Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.','</span>','ai.openAI.requestParameters.temperature','config','includes','length','delta','_requestHeaders','locale','gpt-3.5-turbo','filter','decode','join','map','AI_ERROR_MODERATION','OpenAITextAdapter','pluginName','stream','content','resolve','ai.openAI.requestParameters.stream','body','AI_ERROR_CONTEXT_LENGTH','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','stringify','choices','<span>','get','ai.openAI.requestParameters.model','_cleanUpData','POST','system','reject','user','sendRequest','read','data:\x20','_prepareRequestHeaders'];(function(_0x18e373,_0x571871){const _0x30e599=function(_0x3bb0db){while(--_0x3bb0db){_0x18e373['push'](_0x18e373['shift']());}};_0x30e599(++_0x571871);}(_0x5718,0xcc));const _0x30e5=function(_0x18e373,_0x571871){_0x18e373=_0x18e373-0x0;let _0x30e599=_0x5718[_0x18e373];return _0x30e599;};import{default as _0x1d87fc}from'./aitextadapter.js';import{AIRequestError as _0x38f10d}from'./aiadapter.js';import{getTranslation as _0x2c3f16}from'../utils/common-translations.js';export default class M extends _0x1d87fc{static get[_0x30e5('0x6')](){return _0x30e5('0x5');}constructor(_0x3a2ed2){super(_0x3a2ed2),_0x3a2ed2['config'][_0x30e5('0x1e')](_0x30e5('0x1c'),'https://api.openai.com/v1/chat/completions'),_0x3a2ed2[_0x30e5('0x33')]['define'](_0x30e5('0x12'),_0x30e5('0x39')),_0x3a2ed2['config'][_0x30e5('0x1e')](_0x30e5('0x2f'),0x7d0),_0x3a2ed2[_0x30e5('0x33')]['define'](_0x30e5('0x32'),0x1),_0x3a2ed2[_0x30e5('0x33')]['define'](_0x30e5('0x23'),0x1),_0x3a2ed2[_0x30e5('0x33')][_0x30e5('0x1e')](_0x30e5('0xa'),!0x0),this[_0x30e5('0x25')]=_0x3a2ed2[_0x30e5('0x33')][_0x30e5('0x11')](_0x30e5('0x1c')),this[_0x30e5('0x37')]=_0x3a2ed2[_0x30e5('0x33')][_0x30e5('0x11')](_0x30e5('0x2b'))||{},this[_0x30e5('0x29')]=_0x3a2ed2[_0x30e5('0x33')][_0x30e5('0x11')]('ai.openAI.requestParameters');}async[_0x30e5('0x18')]({query:_0x73ba9d,context:_0x391999,onData:_0x346e8c,actionId:_0x2ef330}){const _0x4bfc8e=this[_0x30e5('0x2a')][_0x30e5('0x38')],_0x22376d=await this[_0x30e5('0x2d')](_0x73ba9d,_0x391999,_0x2ef330),_0x3c3d5e=await this[_0x30e5('0x1b')](this[_0x30e5('0x37')],_0x2ef330),_0x223608=await this['_prepareRequestParameters'](this[_0x30e5('0x29')],_0x2ef330),_0x53ae95={'messages':_0x22376d,..._0x223608},_0x2fcebf={'method':_0x30e5('0x14'),'headers':_0x3c3d5e,'body':JSON[_0x30e5('0xe')](_0x53ae95),'signal':this['abortController']['signal']},_0x1bf028=await fetch(this[_0x30e5('0x25')],_0x2fcebf);if(_0x1bf028['ok'])return _0x223608[_0x30e5('0x7')]?await this[_0x30e5('0x27')](_0x1bf028,_0x346e8c):await this['_readStaticResponse'](_0x1bf028,_0x346e8c),Promise[_0x30e5('0x9')]();{const _0x276108=await _0x1bf028[_0x30e5('0x28')]();return _0x276108[_0x30e5('0x34')](_0x30e5('0x1d'))?Promise['reject'](new _0x38f10d(_0x2c3f16(_0x4bfc8e,_0x30e5('0xc')))):_0x276108['includes'](_0x30e5('0x24'))?Promise[_0x30e5('0x16')](new _0x38f10d(_0x2c3f16(_0x4bfc8e,_0x30e5('0x4')))):Promise[_0x30e5('0x16')](new Error(_0x276108));}}async[_0x30e5('0x2d')](_0x19b7c3,_0x20d7bd,_0x418ed9){let _0x37d4f3,_0x18f4bb;return _0x20d7bd?(_0x37d4f3=_0x30e5('0x30'),_0x18f4bb=_0x30e5('0x21')+_0x19b7c3+_0x30e5('0xd')+(_0x20d7bd['startsWith']('<')?_0x20d7bd:_0x30e5('0x10')+_0x20d7bd+_0x30e5('0x31'))):(_0x37d4f3='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x18f4bb=_0x19b7c3),[{'role':_0x30e5('0x15'),'content':_0x37d4f3},{'role':_0x30e5('0x17'),'content':_0x18f4bb}];}async[_0x30e5('0x27')](_0x551182,_0x1c0f16){const _0x1b2390=_0x551182[_0x30e5('0xb')]['getReader'](),_0x1121ae=new TextDecoder();let _0x3e4941='',_0x412a19='',_0x2a3af7='',_0x147bec=!0x1;for(;!_0x147bec;){const {done:_0x1ebafd,value:_0x59dcf7}=await _0x1b2390[_0x30e5('0x19')](),_0x1ffea7=_0x3e4941+_0x1121ae[_0x30e5('0x1')](_0x59dcf7);let _0x3d5a23='';_0x147bec=_0x1ebafd;try{_0x3d5a23=this['_cleanUpData'](_0x1ffea7),_0x3e4941='';}catch(_0x1c6949){_0x3e4941=_0x1ffea7;continue;}_0x412a19+=_0x3d5a23,!_0x147bec&&this['_isBufferIncomplete'](_0x412a19)||_0x412a19&&(_0x2a3af7+=_0x412a19,_0x412a19='',_0x1c0f16(_0x2a3af7));}return Promise[_0x30e5('0x9')]();}async['_readStaticResponse'](_0x3049e8,_0xbd6705){return _0xbd6705((await _0x3049e8[_0x30e5('0x22')]())[_0x30e5('0xf')][0x0]['message'][_0x30e5('0x8')]),Promise['resolve']();}[_0x30e5('0x2c')](_0x2a993e){const _0x13f403=_0x2a993e['split']('<')[_0x30e5('0x35')]!==_0x2a993e[_0x30e5('0x2e')]('>')[_0x30e5('0x35')],_0x3f2678=_0x2a993e[_0x30e5('0x35')]<0x1e;return _0x13f403&&_0x3f2678;}[_0x30e5('0x13')](_0x2f9436){return _0x2f9436[_0x30e5('0x2e')](/\n(?![^{]*\})/g)[_0x30e5('0x3')](_0x3cad8b=>_0x3cad8b[_0x30e5('0x20')](_0x30e5('0x1a'),''))[_0x30e5('0x0')](_0x4a862e=>_0x4a862e&&_0x4a862e['length']>0x0&&_0x30e5('0x26')!==_0x4a862e)['map'](_0xf39593=>{const {choices:_0x4b6b68}=JSON[_0x30e5('0x1f')](_0xf39593);if(_0x4b6b68[0x0]&&_0x4b6b68[0x0][_0x30e5('0x36')]&&_0x4b6b68[0x0][_0x30e5('0x36')]['content'])return _0x4b6b68[0x0]['delta']['content'];})[_0x30e5('0x0')](_0x655317=>_0x655317)[_0x30e5('0x2')]('');}}
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/aiassistant
7
7
  * @publicApi
8
8
  */
9
- import { type Locale } from 'ckeditor5/src/utils';
10
- import { Plugin, type Editor } from 'ckeditor5/src/core';
11
- import AIAssistantUI from './aiassistantui';
12
- import AIAssistantEditing from './aiassistantediting';
9
+ import { type Locale } from 'ckeditor5/src/utils.js';
10
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
11
+ import AIAssistantUI from './aiassistantui.js';
12
+ import AIAssistantEditing from './aiassistantediting.js';
13
13
  /**
14
14
  * AI assistant plugin that allows you to use external AI models to generate content or improve existing content.
15
15
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  *
4
4
  *
5
5
  *
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x4dd6=['Direct','AIAssistant','includes','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','French','Summarize','Hindi','You\x20are\x20using\x20the\x20trial\x20version\x20of\x20CKEditor\x205\x20ai\x20plugin\x20with\x20limited\x20usage.\x20Make\x20sure\x20you\x20will\x20not\x20use\x20it\x20in\x20the\x20production\x20environment.','Simplify\x20language','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','init','Change\x20style','ai-trial-license-key-reached-limit-changes','concat','ai.aiAssistant.extraCommandGroups','Friendly','generate','Business','legal','Make\x20longer','Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.','_licenseKeyCheckInterval','simplifyLanguage','Improve\x20writing','find','ai-invalid-license-key','push','Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.','aiLicenseKeyTrialLimit:operations','translateChinese','Translate','Professional','Translate\x20the\x20content\x20to\x20Spanish\x20language.','editOrReview','Translate\x20the\x20content\x20to\x20French\x20language.','filter','forEach','Translate\x20the\x20content\x20to\x20English\x20language.','Change\x20tone','locale','aiLicenseKeyValid','continue','Translate\x20the\x20content\x20to\x20Hindi\x20language.','ai.aiAssistant.commands','makeLonger','journalism','destroy','Journalism','pluginName','Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.','editor','Confident','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','Simplified\x20Chinese','define','translateEnglish','changeTone','English','Continue','Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.','requires','makeShorter','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','config','improveWriting','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','translateHindi','translateGerman','Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.','licenseKey','translate','ai.aiAssistant.removeCommands','Legal','Portuguese','translatePortuguese','casual','get','poetic','Casual','Spanish','aiLicenseKeyInvalid','commands','changeStyle','Translate\x20to\x20%0','professional','Translate\x20the\x20content\x20to\x20German\x20language.','aiLicenseKeyTrial','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','groupId','confident','Make\x20shorter','translateFrench','translateSpanish'];(function(_0x4f29fa,_0x4dd6e0){const _0x4aeaa8=function(_0x3cab10){while(--_0x3cab10){_0x4f29fa['push'](_0x4f29fa['shift']());}};_0x4aeaa8(++_0x4dd6e0);}(_0x4dd6,0x1b0));const _0x4aea=function(_0x4f29fa,_0x4dd6e0){_0x4f29fa=_0x4f29fa-0x0;let _0x4aeaa8=_0x4dd6[_0x4f29fa];return _0x4aeaa8;};import{CKEditorError as _0x21ce54}from'ckeditor5/src/utils';import{Plugin as _0x23f38b}from'ckeditor5/src/core';import _0x49bf43 from'./aiassistantui';import _0x574202 from'./aiassistantediting';import{getTranslation as _0x32bf02}from'./utils/common-translations';export default class r extends _0x23f38b{static get[_0x4aea('0x8')](){return[_0x49bf43,_0x574202];}static get[_0x4aea('0x5b')](){return _0x4aea('0x2c');}constructor(_0x4977ec){super(_0x4977ec);const _0x215584=_0x4977ec[_0x4aea('0xb')];_0x215584[_0x4aea('0x2')](_0x4aea('0x56'),getDefaultCommands(_0x4977ec[_0x4aea('0x52')])),_0x215584[_0x4aea('0x2')](_0x4aea('0x39'),[]),_0x215584[_0x4aea('0x2')](_0x4aea('0x13'),[]);const _0x3e6f8e=_0x215584[_0x4aea('0x18')]('ai.aiAssistant.commands'),_0x9f8a0a=_0x215584[_0x4aea('0x18')]('ai.aiAssistant.extraCommandGroups'),_0x5b4b2d=_0x215584[_0x4aea('0x18')](_0x4aea('0x13'));_0x9f8a0a['forEach'](_0x10a40b=>{const _0x2f222d=_0x3e6f8e[_0x4aea('0x43')](_0x4acd67=>_0x4acd67[_0x4aea('0x26')]===_0x10a40b['groupId']);_0x2f222d?_0x2f222d[_0x4aea('0x1d')]=_0x2f222d[_0x4aea('0x1d')][_0x4aea('0x38')](_0x10a40b[_0x4aea('0x1d')]):_0x3e6f8e[_0x4aea('0x45')](_0x10a40b);}),_0x3e6f8e[_0x4aea('0x4f')](_0x4308bd=>{_0x4308bd['commands']=_0x4308bd[_0x4aea('0x1d')][_0x4aea('0x4e')](_0x2fbb1f=>!_0x5b4b2d[_0x4aea('0x2d')](_0x2fbb1f['id']));}),_0x215584['set'](_0x4aea('0x56'),_0x3e6f8e);}[_0x4aea('0x35')](){const _0x2c00dd=this[_0x4aea('0x5d')];this[_0x4aea('0x11')]=_0x2c00dd[_0x4aea('0xb')][_0x4aea('0x18')](_0x4aea('0x11')),this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x4d67cf;for(const _0x4b09e9 in _0x2c00dd){const _0x9cb301=_0x4b09e9,_0x5dbaac=_0x2c00dd[_0x9cb301];if(_0x4aea('0x22')===_0x5dbaac||_0x4aea('0x1c')===_0x5dbaac||_0x4aea('0x53')===_0x5dbaac||_0x4aea('0x47')===_0x5dbaac){delete _0x2c00dd[_0x9cb301],_0x4d67cf=_0x5dbaac;break;}}if(_0x4aea('0x1c')===_0x4d67cf)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x21ce54(_0x4aea('0x44'),null);if(_0x4aea('0x22')===_0x4d67cf&&console['info'](_0x4aea('0x32')),_0x4aea('0x47')===_0x4d67cf)throw clearInterval(this[_0x4aea('0x40')]),new _0x21ce54(_0x4aea('0x37'),null);_0x4aea('0x53')===_0x4d67cf&&clearInterval(this[_0x4aea('0x40')]);},0x3e8);}[_0x4aea('0x59')](){this['_licenseKeyCheckInterval']&&clearInterval(this[_0x4aea('0x40')]);}}export function getDefaultCommands(_0x559e05){return[{'groupId':_0x4aea('0x4c'),'groupLabel':_0x32bf02(_0x559e05,'Edit\x20or\x20review'),'commands':[{'id':_0x4aea('0xc'),'label':_0x32bf02(_0x559e05,_0x4aea('0x42')),'prompt':_0x4aea('0x34')},{'id':_0x4aea('0x9'),'label':_0x32bf02(_0x559e05,_0x4aea('0x28')),'prompt':_0x4aea('0x10')},{'id':_0x4aea('0x57'),'label':_0x32bf02(_0x559e05,_0x4aea('0x3e')),'prompt':_0x4aea('0x0')},{'id':_0x4aea('0x41'),'label':_0x32bf02(_0x559e05,_0x4aea('0x33')),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':_0x4aea('0x3b'),'groupLabel':_0x32bf02(_0x559e05,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':_0x32bf02(_0x559e05,_0x4aea('0x30')),'prompt':_0x4aea('0x46')},{'id':_0x4aea('0x54'),'label':_0x32bf02(_0x559e05,_0x4aea('0x6')),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':_0x4aea('0x4'),'groupLabel':_0x32bf02(_0x559e05,_0x4aea('0x51')),'commands':[{'id':_0x4aea('0x20'),'label':_0x32bf02(_0x559e05,_0x4aea('0x4a')),'prompt':_0x4aea('0x5c')},{'id':_0x4aea('0x17'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1a')),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':_0x32bf02(_0x559e05,_0x4aea('0x2b')),'prompt':_0x4aea('0xa')},{'id':_0x4aea('0x27'),'label':_0x32bf02(_0x559e05,_0x4aea('0x5e')),'prompt':_0x4aea('0x2e')},{'id':'friendly','label':_0x32bf02(_0x559e05,_0x4aea('0x3a')),'prompt':_0x4aea('0x23')}]},{'groupId':_0x4aea('0x1e'),'groupLabel':_0x32bf02(_0x559e05,_0x4aea('0x36')),'commands':[{'id':'business','label':_0x32bf02(_0x559e05,_0x4aea('0x3c')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':_0x4aea('0x3d'),'label':_0x32bf02(_0x559e05,_0x4aea('0x14')),'prompt':_0x4aea('0xd')},{'id':_0x4aea('0x58'),'label':_0x32bf02(_0x559e05,_0x4aea('0x5a')),'prompt':_0x4aea('0x7')},{'id':_0x4aea('0x19'),'label':_0x32bf02(_0x559e05,'Poetic'),'prompt':_0x4aea('0x25')}]},{'groupId':_0x4aea('0x12'),'groupLabel':_0x32bf02(_0x559e05,_0x4aea('0x49')),'commands':[{'id':_0x4aea('0x3'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x5'))]),'prompt':_0x4aea('0x50')},{'id':_0x4aea('0x2a'),'label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,_0x4aea('0x1b'))]),'prompt':_0x4aea('0x4b')},{'id':_0x4aea('0x16'),'label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,_0x4aea('0x15'))]),'prompt':_0x4aea('0x24')},{'id':_0x4aea('0xf'),'label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,'German')]),'prompt':_0x4aea('0x21')},{'id':_0x4aea('0x29'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x2f'))]),'prompt':_0x4aea('0x4d')},{'id':_0x4aea('0x48'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x1'))]),'prompt':_0x4aea('0x3f')},{'id':_0x4aea('0xe'),'label':_0x32bf02(_0x559e05,_0x4aea('0x1f'),[_0x32bf02(_0x559e05,_0x4aea('0x31'))]),'prompt':_0x4aea('0x55')},{'id':'translateArabic','label':_0x32bf02(_0x559e05,'Translate\x20to\x20%0',[_0x32bf02(_0x559e05,'Arabic')]),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}
23
+ const _0x18e6=['legal','aiLicenseKeyInvalid','concat','Portuguese','Professional','friendly','English','Translate\x20the\x20content\x20to\x20Arabic\x20language.','groupId','licenseKey','ai.aiAssistant.commands','Friendly','aiLicenseKeyTrial','makeLonger','set','Business','Translate\x20to\x20%0','translateHindi','ai-invalid-license-key','editOrReview','init','Improve\x20writing','poetic','Arabic','Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.','ai.aiAssistant.removeCommands','filter','Make\x20longer','direct','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','_licenseKeyCheckInterval','improveWriting','define','Simplified\x20Chinese','Translate\x20the\x20content\x20to\x20Hindi\x20language.','Make\x20shorter','confident','French','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.','ai.aiAssistant.extraCommandGroups','continue','casual','translateGerman','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','get','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','Translate\x20the\x20content\x20to\x20German\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','generate','requires','Translate\x20the\x20content\x20to\x20English\x20language.','includes','Summarize','editor','translateSpanish','aiLicenseKeyTrialLimit:operations','translateEnglish','Change\x20style','ai-trial-license-key-reached-limit-changes','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','simplifyLanguage','push','commands','config','changeTone','translate','Journalism','German','Direct','Hindi','summarize','Confident','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','translateChinese','translateFrench','Translate\x20the\x20content\x20to\x20Spanish\x20language.','aiLicenseKeyValid','makeShorter','Simplify\x20language','Translate','Translate\x20the\x20content\x20to\x20French\x20language.','destroy','AIAssistant','You\x20are\x20using\x20the\x20trial\x20version\x20of\x20CKEditor\x205\x20ai\x20plugin\x20with\x20limited\x20usage.\x20Make\x20sure\x20you\x20will\x20not\x20use\x20it\x20in\x20the\x20production\x20environment.','Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.','forEach','Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.','Poetic','info'];(function(_0x13ea68,_0x18e6b7){const _0x4dc72d=function(_0x580391){while(--_0x580391){_0x13ea68['push'](_0x13ea68['shift']());}};_0x4dc72d(++_0x18e6b7);}(_0x18e6,0xb7));const _0x4dc7=function(_0x13ea68,_0x18e6b7){_0x13ea68=_0x13ea68-0x0;let _0x4dc72d=_0x18e6[_0x13ea68];return _0x4dc72d;};import{CKEditorError as _0x23b3f4}from'ckeditor5/src/utils.js';import{Plugin as _0x5829c2}from'ckeditor5/src/core.js';import _0x157fa1 from'./aiassistantui.js';import _0x4743f6 from'./aiassistantediting.js';import{getTranslation as _0x20eb35}from'./utils/common-translations.js';export default class r extends _0x5829c2{static get[_0x4dc7('0x31')](){return[_0x157fa1,_0x4743f6];}static get['pluginName'](){return _0x4dc7('0x53');}constructor(_0x10508f){super(_0x10508f);const _0x59ca3b=_0x10508f[_0x4dc7('0x3f')];_0x59ca3b['define'](_0x4dc7('0x9'),getDefaultCommands(_0x10508f['locale'])),_0x59ca3b['define'](_0x4dc7('0x27'),[]),_0x59ca3b[_0x4dc7('0x1f')](_0x4dc7('0x18'),[]);const _0x1d01f7=_0x59ca3b[_0x4dc7('0x2c')](_0x4dc7('0x9')),_0x4dc7d0=_0x59ca3b[_0x4dc7('0x2c')](_0x4dc7('0x27')),_0xe17525=_0x59ca3b[_0x4dc7('0x2c')]('ai.aiAssistant.removeCommands');_0x4dc7d0['forEach'](_0x2f321b=>{const _0xdb69ef=_0x1d01f7['find'](_0xf35ddf=>_0xf35ddf['groupId']===_0x2f321b[_0x4dc7('0x7')]);_0xdb69ef?_0xdb69ef[_0x4dc7('0x3e')]=_0xdb69ef['commands'][_0x4dc7('0x1')](_0x2f321b['commands']):_0x1d01f7[_0x4dc7('0x3d')](_0x2f321b);}),_0x1d01f7[_0x4dc7('0x56')](_0x3137af=>{_0x3137af[_0x4dc7('0x3e')]=_0x3137af[_0x4dc7('0x3e')][_0x4dc7('0x19')](_0x1179a7=>!_0xe17525[_0x4dc7('0x33')](_0x1179a7['id']));}),_0x59ca3b[_0x4dc7('0xd')](_0x4dc7('0x9'),_0x1d01f7);}[_0x4dc7('0x13')](){const _0xf317c1=this[_0x4dc7('0x35')];this[_0x4dc7('0x8')]=_0xf317c1[_0x4dc7('0x3f')][_0x4dc7('0x2c')](_0x4dc7('0x8')),this[_0x4dc7('0x1d')]=setInterval(()=>{let _0x5af30a;for(const _0x38c2d1 in _0xf317c1){const _0x8c4a09=_0x38c2d1,_0x4a6d16=_0xf317c1[_0x8c4a09];if(_0x4dc7('0xb')===_0x4a6d16||_0x4dc7('0x0')===_0x4a6d16||_0x4dc7('0x4d')===_0x4a6d16||'aiLicenseKeyTrialLimit:operations'===_0x4a6d16){delete _0xf317c1[_0x8c4a09],_0x5af30a=_0x4a6d16;break;}}if('aiLicenseKeyInvalid'===_0x5af30a)throw clearInterval(this[_0x4dc7('0x1d')]),new _0x23b3f4(_0x4dc7('0x11'),null);if(_0x4dc7('0xb')===_0x5af30a&&console[_0x4dc7('0x59')](_0x4dc7('0x54')),_0x4dc7('0x37')===_0x5af30a)throw clearInterval(this[_0x4dc7('0x1d')]),new _0x23b3f4(_0x4dc7('0x3a'),null);_0x4dc7('0x4d')===_0x5af30a&&clearInterval(this['_licenseKeyCheckInterval']);},0x3e8);}[_0x4dc7('0x52')](){this[_0x4dc7('0x1d')]&&clearInterval(this[_0x4dc7('0x1d')]);}}export function getDefaultCommands(_0x364cf4){return[{'groupId':_0x4dc7('0x12'),'groupLabel':_0x20eb35(_0x364cf4,'Edit\x20or\x20review'),'commands':[{'id':_0x4dc7('0x1e'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x14')),'prompt':_0x4dc7('0x3b')},{'id':_0x4dc7('0x4e'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x22')),'prompt':_0x4dc7('0x17')},{'id':_0x4dc7('0xc'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x1a')),'prompt':_0x4dc7('0x1c')},{'id':_0x4dc7('0x3c'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x4f')),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':_0x4dc7('0x30'),'groupLabel':_0x20eb35(_0x364cf4,'Generate\x20from\x20selection'),'commands':[{'id':_0x4dc7('0x46'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x34')),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':_0x4dc7('0x28'),'label':_0x20eb35(_0x364cf4,'Continue'),'prompt':_0x4dc7('0x55')}]},{'groupId':_0x4dc7('0x40'),'groupLabel':_0x20eb35(_0x364cf4,'Change\x20tone'),'commands':[{'id':'professional','label':_0x20eb35(_0x364cf4,_0x4dc7('0x3')),'prompt':_0x4dc7('0x57')},{'id':_0x4dc7('0x29'),'label':_0x20eb35(_0x364cf4,'Casual'),'prompt':_0x4dc7('0x26')},{'id':_0x4dc7('0x1b'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x44')),'prompt':_0x4dc7('0x2d')},{'id':_0x4dc7('0x23'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x47')),'prompt':_0x4dc7('0x2b')},{'id':_0x4dc7('0x4'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xa')),'prompt':_0x4dc7('0x25')}]},{'groupId':'changeStyle','groupLabel':_0x20eb35(_0x364cf4,_0x4dc7('0x39')),'commands':[{'id':'business','label':_0x20eb35(_0x364cf4,_0x4dc7('0xe')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':_0x4dc7('0x5a'),'label':_0x20eb35(_0x364cf4,'Legal'),'prompt':_0x4dc7('0x49')},{'id':'journalism','label':_0x20eb35(_0x364cf4,_0x4dc7('0x42')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':_0x4dc7('0x15'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0x58')),'prompt':_0x4dc7('0x2f')}]},{'groupId':_0x4dc7('0x41'),'groupLabel':_0x20eb35(_0x364cf4,_0x4dc7('0x50')),'commands':[{'id':_0x4dc7('0x38'),'label':_0x20eb35(_0x364cf4,'Translate\x20to\x20%0',[_0x20eb35(_0x364cf4,_0x4dc7('0x5'))]),'prompt':_0x4dc7('0x32')},{'id':_0x4dc7('0x36'),'label':_0x20eb35(_0x364cf4,'Translate\x20to\x20%0',[_0x20eb35(_0x364cf4,'Spanish')]),'prompt':_0x4dc7('0x4c')},{'id':'translatePortuguese','label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x2'))]),'prompt':_0x4dc7('0x48')},{'id':_0x4dc7('0x2a'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x43'))]),'prompt':_0x4dc7('0x2e')},{'id':_0x4dc7('0x4b'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x24'))]),'prompt':_0x4dc7('0x51')},{'id':_0x4dc7('0x4a'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x20'))]),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':_0x4dc7('0x10'),'label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x45'))]),'prompt':_0x4dc7('0x21')},{'id':'translateArabic','label':_0x20eb35(_0x364cf4,_0x4dc7('0xf'),[_0x20eb35(_0x364cf4,_0x4dc7('0x16'))]),'prompt':_0x4dc7('0x6')}]}];}
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module ai/aiassistantediting
7
7
  */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import type { Position } from 'ckeditor5/src/engine';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import type { Position } from 'ckeditor5/src/engine.js';
10
10
  /**
11
11
  * The AI assistant editing plugin.
12
12
  */
@@ -20,26 +20,27 @@ export default class AIAssistantEditing extends Plugin {
20
20
  */
21
21
  init(): void;
22
22
  /**
23
- * Displays a fake visual selection when the contextual balloon is displayed.
23
+ * Displays a fake visual selection.
24
24
  *
25
- * This adds a 'ai-ui' marker into the document that is rendered as a highlight on selected text fragment.
25
+ * This adds a 'ai-ui-candidate' (for the commands dropdown) or 'ai-ui' (for the assistant dialog)
26
+ * marker into the document that is rendered as a highlight on selected text fragment.
26
27
  */
27
- showFakeVisualSelection(): void;
28
+ showFakeVisualSelection(isCandidate?: boolean): void;
28
29
  /**
29
- * Removes a fake visual selection when the contextual balloon is hidden.
30
+ * Removes a fake visual selection.
30
31
  *
31
- * This removes all 'ai-ui' markers from the document.
32
+ * This clears a 'ai-ui-candidate' (for the commands dropdown) or 'ai-ui' (for the assistant dialog)
33
+ * marker from the document.
32
34
  */
33
- hideFakeVisualSelection(): void;
35
+ hideFakeVisualSelection(isCandidate?: boolean): void;
34
36
  /**
35
37
  * Converts the HTML string into the model fragment and inserts it at the specified position.
36
38
  *
37
- * If a position is not provided, the insertion will be performed at the current selection.
39
+ * If a position is not provided, the insertion will replace the visual selection marker.
38
40
  */
39
41
  insertContent(content: string, position?: Position): void;
40
42
  /**
41
- * Converts the HTML string into the model fragment and inserts it at the specified position.
42
- * If a position is not provided, the insertion will be performed at the current selection.
43
+ * Converts the HTML string into the model fragment and inserts it below the visual selection marker.
43
44
  */
44
45
  insertContentBelow(content: string): void;
45
46
  }