@ckeditor/ckeditor5-ai 0.0.0-nightly-20240201.0 → 0.0.0-nightly-20240203.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.
- package/build/ai.js +6 -6
- package/package.json +4 -4
- package/src/adapters/aiadapter.js +1 -1
- package/src/adapters/aitextadapter.js +1 -1
- package/src/adapters/awstextadapter.js +1 -1
- package/src/adapters/openaitextadapter.js +1 -1
- package/src/aiassistant.js +1 -1
- package/src/aiassistantediting.js +1 -1
- package/src/aiassistantui.js +1 -1
- package/src/ui/aiassistantcontroller.js +1 -1
- package/src/ui/dropdown/aicommandslistview.js +1 -1
- package/src/ui/dropdown/buttonlabelwithhighlightview.js +1 -1
- package/src/ui/dropdown/labelwithhighlightview.js +1 -1
- package/src/ui/form/aiformcontentarea.js +1 -1
- package/src/ui/form/aiformerrorview.js +1 -1
- package/src/ui/form/aiformpromptview.js +1 -1
- package/src/ui/form/aiformtoolbarview.js +1 -1
- package/src/ui/form/aiformview.js +1 -1
- package/src/ui/form/aihistorylistitemview.js +1 -1
- package/src/ui/form/aihistorylistview.js +1 -1
- package/src/ui/form/prompthistory.js +1 -1
- package/src/ui/showaiassistantcommand.js +1 -1
- package/src/utils/common-translations.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-ai",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240203.0",
|
|
4
4
|
"description": "AI Assistant feature for CKEditor 5.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"framework"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"ckeditor5": "0.0.0-nightly-
|
|
27
|
-
"ckeditor5-collaboration": "0.0.0-nightly-
|
|
26
|
+
"ckeditor5": "0.0.0-nightly-20240203.0",
|
|
27
|
+
"ckeditor5-collaboration": "0.0.0-nightly-20240203.0",
|
|
28
28
|
"@aws-sdk/client-bedrock-runtime": "3.470.0",
|
|
29
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-
|
|
29
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20240203.0",
|
|
30
30
|
"lodash-es": "4.17.21"
|
|
31
31
|
},
|
|
32
32
|
"type": "module",
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
var
|
|
23
|
+
var _0x59c5=['AIAdapter','afterInit','textAdapter','pluginName','AIRequestError'];(function(_0x20cf3e,_0x59c5d2){var _0x4fd037=function(_0x6bba4e){while(--_0x6bba4e){_0x20cf3e['push'](_0x20cf3e['shift']());}};_0x4fd037(++_0x59c5d2);}(_0x59c5,0xed));var _0x4fd0=function(_0x20cf3e,_0x59c5d2){_0x20cf3e=_0x20cf3e-0x0;var _0x4fd037=_0x59c5[_0x20cf3e];return _0x4fd037;};import{Plugin as _0x479fd6}from'ckeditor5/src/core.js';import{CKEditorError as _0x15b6bc}from'ckeditor5/src/utils.js';export default class I extends _0x479fd6{static get[_0x4fd0('0x1')](){return _0x4fd0('0x3');}[_0x4fd0('0x4')](){if(!this[_0x4fd0('0x0')])throw new _0x15b6bc('aiadapter-text-adapter-not-set',null);}}export class AIRequestError extends Error{constructor(_0x2d461e){super(_0x2d461e),this['name']=_0x4fd0('0x2');}}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x3254=['get','init','error','reject','abortController','sendRequest','object','makeRequest','AbortError','assign','name','locale','AI_ERROR_GET_HEADERS','_prepareRequestHeaders','editor','aitextadapter-send-request-failed','AI_ERROR_GET_PARAMETERS','textAdapter','catch','signal','application/json'];(function(_0x203ec7,_0x3254a4){const _0x31f688=function(_0x55a954){while(--_0x55a954){_0x203ec7['push'](_0x203ec7['shift']());}};_0x31f688(++_0x3254a4);}(_0x3254,0xeb));const _0x31f6=function(_0x203ec7,_0x3254a4){_0x203ec7=_0x203ec7-0x0;let _0x31f688=_0x3254[_0x203ec7];return _0x31f688;};import{Plugin as _0x55a235}from'ckeditor5/src/core.js';import{CKEditorError as _0xfc5c9a}from'ckeditor5/src/utils.js';import{default as _0x54f998,AIRequestError as _0x1c3e90}from'./aiadapter.js';import{getTranslation as _0x593a51}from'../utils/common-translations.js';export default class _ extends _0x55a235{static get['requires'](){return[_0x54f998];}constructor(_0x3631a6){super(_0x3631a6),this['abortController']=new AbortController();}[_0x31f6('0x12')](){this[_0x31f6('0xa')]['plugins'][_0x31f6('0x11')](_0x54f998)[_0x31f6('0xd')]=this;}['abort'](){this[_0x31f6('0x0')][_0x31f6('0xf')]['aborted']||(this[_0x31f6('0x0')]['abort'](),this[_0x31f6('0x0')]=new AbortController());}async[_0x31f6('0x3')](_0x2f35ba){return this[_0x31f6('0x1')](_0x2f35ba)[_0x31f6('0xe')](_0x32d112=>{if(_0x32d112 instanceof _0x1c3e90)return Promise[_0x31f6('0x14')](_0x32d112);if(_0x31f6('0x4')==_0x32d112[_0x31f6('0x6')])return Promise['resolve']();throw console[_0x31f6('0x13')](_0x32d112),new _0xfc5c9a(_0x31f6('0xb'),null);});}async[_0x31f6('0x9')](_0x519099,_0x3eb0c9){const _0x790456=this[_0x31f6('0xa')][_0x31f6('0x7')],_0x3fa592={'Content-Type':_0x31f6('0x10')};if(_0x31f6('0x2')==typeof _0x519099)Object[_0x31f6('0x5')](_0x3fa592,_0x519099);else{if(_0x519099)try{const _0x4854ab=await _0x519099(_0x3eb0c9);Object[_0x31f6('0x5')](_0x3fa592,_0x4854ab);}catch(_0x396514){return Promise[_0x31f6('0x14')](new _0x1c3e90(_0x593a51(_0x790456,_0x31f6('0x8'))));}}return _0x3fa592;}async['_prepareRequestParameters'](_0x39da06,_0x2e68fa){const _0x22ffec=this[_0x31f6('0xa')][_0x31f6('0x7')];if(_0x31f6('0x2')==typeof _0x39da06)return _0x39da06;try{return await _0x39da06(_0x2e68fa);}catch(_0x590c5a){return Promise[_0x31f6('0x14')](new _0x1c3e90(_0x593a51(_0x22ffec,_0x31f6('0xc'))));}}}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x5a9a=['<span>','preparePrompt','send','config','\x0a[/INST]','_processAWSRequest','ai.aws.requestParameters','getModelFamily','bedrock-2023-05-31','ai.aws.apiUrl','body','ai.aws.requestParameters.max_tokens_to_sample','abortController','ai.aws.requestHeaders','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.','pluginName','stringify','chunk','ai.aws.requestParameters.model','_requestHeaders','data','editor','toString','utf8','anthropic.claude-v2','anthropic.claude','POST','_bedrockClientConfig','meta.llama','ai.aws.requestParameters.temperature','_readStreamableResponse','join','_readAsyncIterableResponse','sendRequest','signal','AI_ERROR_UNSUPPORTED_MODEL','ai.aws.requestParameters.anthropic_version','completion','length','read','cohere.command','split','startsWith','Human:\x0a','json','map','<<SYS>>\x0a','_requestParameters','ai.aws.requestParameters.stream','completions','AWSTextAdapter','ai21.j2','test','Instruction:\x0a','resolve','utf-8','\x0a\x0aAssistant:','_getGeneratedText','get','_apiUrl','bytes','\x0a<</SYS>>\x0a[INST]\x0a','parse','generations','filter','text','define','decode','_processProxyRequest','_readStaticResponse','_prepareRequestHeaders','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.','application/json','getReader'];(function(_0x3ca795,_0x5a9ab9){const _0x263e8e=function(_0x5ae60b){while(--_0x5ae60b){_0x3ca795['push'](_0x3ca795['shift']());}};_0x263e8e(++_0x5a9ab9);}(_0x5a9a,0x163));const _0x263e=function(_0x3ca795,_0x5a9ab9){_0x3ca795=_0x3ca795-0x0;let _0x263e8e=_0x5a9a[_0x3ca795];return _0x263e8e;};import{default as _0x14120d}from'./aitextadapter.js';import{AIRequestError as _0x51425f}from'./aiadapter.js';import{BedrockRuntimeClient as _0x4a6993,InvokeModelCommand as _0x1f32cd,InvokeModelWithResponseStreamCommand as _0x8f4f03}from'@aws-sdk/client-bedrock-runtime';import{getTranslation as _0x2b6880}from'../utils/common-translations.js';export default class H extends _0x14120d{static get[_0x263e('0x1e')](){return _0x263e('0x41');}constructor(_0x7250df){super(_0x7250df),_0x7250df[_0x263e('0x12')][_0x263e('0x49')](_0x263e('0x15'))||(_0x7250df['config'][_0x263e('0x7')](_0x263e('0x21'),_0x263e('0x27')),_0x7250df[_0x263e('0x12')][_0x263e('0x7')](_0x263e('0x1a'),0x7d0),_0x7250df[_0x263e('0x12')]['define'](_0x263e('0x2c'),0x1),_0x7250df[_0x263e('0x12')]['define']('ai.aws.requestParameters.top_p',0x1),_0x7250df[_0x263e('0x12')]['define']('ai.aws.requestParameters.top_k',0xfa),_0x7250df[_0x263e('0x12')][_0x263e('0x7')](_0x263e('0x33'),_0x263e('0x17')),_0x7250df[_0x263e('0x12')][_0x263e('0x7')](_0x263e('0x3f'),!0x0)),this['_apiUrl']=_0x7250df[_0x263e('0x12')][_0x263e('0x49')](_0x263e('0x18')),this[_0x263e('0x2a')]=_0x7250df[_0x263e('0x12')][_0x263e('0x49')]('ai.aws.bedrockClientConfig'),this[_0x263e('0x22')]=_0x7250df['config']['get'](_0x263e('0x1c')),this[_0x263e('0x3e')]=_0x7250df['config'][_0x263e('0x49')](_0x263e('0x15'));}async[_0x263e('0x30')]({query:_0x53c801,context:_0x4f8ded,onData:_0x55b4e7,actionId:_0x4fa701}){const {model:_0xe8b4c,stream:_0x509246,..._0x3e0740}=await this['_prepareRequestParameters'](this[_0x263e('0x3e')],_0x4fa701),_0x1412a7={'prompt':await this[_0x263e('0x10')](_0x53c801,_0x4f8ded,_0xe8b4c,_0x4fa701),..._0x3e0740};this[_0x263e('0x0')]?await this['_processProxyRequest'](_0x1412a7,_0xe8b4c,_0x509246,_0x55b4e7,_0x4fa701):await this['_processAWSRequest'](_0x1412a7,_0xe8b4c,_0x509246,_0x55b4e7);}async[_0x263e('0x10')](_0x260703,_0xce15de,_0x192a24,_0x4f9ffe){let _0x27d7fa,_0x2020f2;return _0xce15de?(_0x27d7fa=_0x263e('0x1d'),_0x2020f2=_0x263e('0x44')+_0x260703+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+(_0xce15de[_0x263e('0x39')]('<')?_0xce15de:_0x263e('0xf')+_0xce15de+'</span>')):(_0x27d7fa=_0x263e('0xc'),_0x2020f2=_0x260703),_0x263e('0x2b')==this[_0x263e('0x16')](_0x192a24)?_0x263e('0x3d')+_0x27d7fa+_0x263e('0x2')+_0x2020f2+_0x263e('0x13'):_0x263e('0x3a')+_0x27d7fa+'\x0a'+_0x2020f2+_0x263e('0x47');}[_0x263e('0x16')](_0x3f2e19){if(/^anthropic\.claude/[_0x263e('0x43')](_0x3f2e19))return _0x263e('0x28');if(/^ai21\.j2/['test'](_0x3f2e19))return _0x263e('0x42');if(/^cohere\.command/[_0x263e('0x43')](_0x3f2e19))return _0x263e('0x37');if(/^meta\.llama/[_0x263e('0x43')](_0x3f2e19))return _0x263e('0x2b');throw new _0x51425f(_0x2b6880(this[_0x263e('0x24')]['locale'],_0x263e('0x32'),_0x3f2e19));}async[_0x263e('0x9')](_0x49a98b,_0x90d1d0,_0x463c22,_0x5d843f,_0x25f22b){const _0x1fd79e={'method':_0x263e('0x29'),'headers':await this[_0x263e('0xb')](this[_0x263e('0x22')],_0x25f22b),'body':JSON[_0x263e('0x1f')]({..._0x49a98b,'model':_0x90d1d0,'stream':_0x463c22}),'signal':this[_0x263e('0x1b')]['signal']},_0x558bf5=await fetch(this[_0x263e('0x0')],_0x1fd79e);_0x463c22?await this[_0x263e('0x2d')](_0x558bf5,_0x90d1d0,_0x5d843f):await this[_0x263e('0xa')](_0x558bf5,_0x90d1d0,_0x5d843f);}async[_0x263e('0x14')](_0x4ddec7,_0x102d38,_0x4458a1,_0x2217c7){const _0x38eaa3=new _0x4a6993(this['_bedrockClientConfig']),_0x4b4a09={'body':JSON['stringify'](_0x4ddec7),'contentType':_0x263e('0xd'),'accept':_0x263e('0xd'),'modelId':_0x102d38};let _0x47f6af;if(_0x4458a1){const _0x4fd473=new _0x8f4f03(_0x4b4a09);_0x47f6af=await _0x38eaa3['send'](_0x4fd473,{'abortSignal':this[_0x263e('0x1b')][_0x263e('0x31')]}),await this['_readAsyncIterableResponse'](_0x47f6af,_0x102d38,_0x2217c7);}else{const _0x4ae043=new _0x1f32cd(_0x4b4a09);_0x47f6af=await _0x38eaa3[_0x263e('0x11')](_0x4ae043,{'abortSignal':this[_0x263e('0x1b')][_0x263e('0x31')]}),await this[_0x263e('0xa')](_0x47f6af,_0x102d38,_0x2217c7);}}async[_0x263e('0x2f')](_0x18af24,_0x3effa0,_0x367b0f){const _0x2b2ba7=_0x18af24['body'],_0x3a23d3=new TextDecoder(_0x263e('0x46'));let _0x9c3b86='';for await(const _0xdbc108 of _0x2b2ba7)if(_0xdbc108[_0x263e('0x20')]){const _0x52f20e=_0x3a23d3[_0x263e('0x8')](_0xdbc108['chunk'][_0x263e('0x1')]),_0x58caae=JSON['parse'](_0x52f20e);_0x9c3b86+=this['_getGeneratedText'](_0x58caae,_0x3effa0),_0x367b0f(_0x9c3b86);}return Promise[_0x263e('0x45')]();}async[_0x263e('0x2d')](_0x3fa5b0,_0x7dbc64,_0x4e1778){const _0x3570c8=_0x3fa5b0[_0x263e('0x19')],_0x1b14f2=new TextDecoder(_0x263e('0x46')),_0x5a38f3=_0x3570c8[_0x263e('0xe')]();let _0x3d1a37='',_0x18e8ba='',_0x181545=!0x1;for(;!_0x181545;){const {done:_0x5b1cfe,value:_0x2c9868}=await _0x5a38f3[_0x263e('0x36')]();if(_0x181545=_0x5b1cfe,_0x181545)break;const _0x33127d=(_0x3d1a37+_0x1b14f2['decode'](_0x2c9868))[_0x263e('0x38')]('\x0a')['map'](_0x96f3ce=>{try{return _0x3d1a37='',JSON[_0x263e('0x3')](_0x96f3ce);}catch(_0x3f5489){return _0x3d1a37=_0x96f3ce,null;}})[_0x263e('0x5')](_0x10d978=>null!==_0x10d978);_0x33127d[_0x263e('0x35')]&&(_0x18e8ba+=_0x33127d[_0x263e('0x3c')](_0x57e414=>this[_0x263e('0x48')](_0x57e414,_0x7dbc64))[_0x263e('0x2e')](''),_0x4e1778(_0x18e8ba));}return Promise[_0x263e('0x45')]();}async[_0x263e('0xa')](_0x531b95,_0x3dfbab,_0x473a44){let _0x5118d6;return _0x5118d6=_0x531b95 instanceof Response?await _0x531b95[_0x263e('0x3b')]():JSON['parse'](Buffer['from'](_0x531b95[_0x263e('0x19')])[_0x263e('0x25')](_0x263e('0x26'))),(_0x473a44(this[_0x263e('0x48')](_0x5118d6,_0x3dfbab)),Promise[_0x263e('0x45')]());}[_0x263e('0x48')](_0x38131b,_0x6f796d){switch(this[_0x263e('0x16')](_0x6f796d)){case _0x263e('0x28'):return _0x38131b[_0x263e('0x34')];case _0x263e('0x42'):return _0x38131b[_0x263e('0x40')][0x0][_0x263e('0x23')][_0x263e('0x6')];case _0x263e('0x37'):return _0x38131b[_0x263e('0x4')][0x0]['text'];case _0x263e('0x2b'):return _0x38131b['generation'];}}}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x22d1=['<span>','split','delta','_apiUrl','ai.openAI.apiUrl','_cleanUpData','define','_requestHeaders','_readStaticResponse','content','reject','gpt-3.5-turbo','ai.openAI.requestParameters.model','config','body','resolve','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.','_readStreamableResponse','ai.openAI.requestParameters.max_tokens','get','join','prepareMessages','replace','ai.openAI.requestParameters.temperature','length','Moderation','getReader','stream','OpenAITextAdapter','includes','</span>','_isBufferIncomplete','json','abortController','AI_ERROR_MODERATION','filter','_requestParameters','[DONE]','editor','locale','parse','_prepareRequestHeaders','POST','system','Instruction:\x0a','data:\x20','read','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.','ai.openAI.requestParameters'];(function(_0x4a0921,_0x22d1f9){const _0x536e42=function(_0x2f907f){while(--_0x2f907f){_0x4a0921['push'](_0x4a0921['shift']());}};_0x536e42(++_0x22d1f9);}(_0x22d1,0x19b));const _0x536e=function(_0x4a0921,_0x22d1f9){_0x4a0921=_0x4a0921-0x0;let _0x536e42=_0x22d1[_0x4a0921];return _0x536e42;};import{default as _0x2e108d}from'./aitextadapter.js';import{AIRequestError as _0x2a7a6c}from'./aiadapter.js';import{getTranslation as _0x4ac93b}from'../utils/common-translations.js';export default class M extends _0x2e108d{static get['pluginName'](){return _0x536e('0x9');}constructor(_0x24098b){super(_0x24098b),_0x24098b['config'][_0x536e('0x24')]('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x24098b[_0x536e('0x2b')][_0x536e('0x24')](_0x536e('0x2a'),_0x536e('0x29')),_0x24098b[_0x536e('0x2b')]['define'](_0x536e('0x30'),0x7d0),_0x24098b[_0x536e('0x2b')][_0x536e('0x24')](_0x536e('0x4'),0x1),_0x24098b[_0x536e('0x2b')][_0x536e('0x24')]('ai.openAI.requestParameters.top_p',0x1),_0x24098b[_0x536e('0x2b')]['define']('ai.openAI.requestParameters.stream',!0x0),this[_0x536e('0x21')]=_0x24098b[_0x536e('0x2b')][_0x536e('0x0')](_0x536e('0x22')),this[_0x536e('0x25')]=_0x24098b[_0x536e('0x2b')][_0x536e('0x0')]('ai.openAI.requestHeaders')||{},this[_0x536e('0x11')]=_0x24098b[_0x536e('0x2b')][_0x536e('0x0')](_0x536e('0x1d'));}async['sendRequest']({query:_0x537234,context:_0x42c2c7,onData:_0x5f373f,actionId:_0x373576}){const _0x58cf70=this[_0x536e('0x13')][_0x536e('0x14')],_0x51dc1a=await this[_0x536e('0x2')](_0x537234,_0x42c2c7,_0x373576),_0x3bd902=await this[_0x536e('0x16')](this[_0x536e('0x25')],_0x373576),_0x4efc2b=await this['_prepareRequestParameters'](this[_0x536e('0x11')],_0x373576),_0x9748da={'messages':_0x51dc1a,..._0x4efc2b},_0x2552b4={'method':_0x536e('0x17'),'headers':_0x3bd902,'body':JSON['stringify'](_0x9748da),'signal':this[_0x536e('0xe')]['signal']},_0x44f2ce=await fetch(this[_0x536e('0x21')],_0x2552b4);if(_0x44f2ce['ok'])return _0x4efc2b[_0x536e('0x8')]?await this[_0x536e('0x2f')](_0x44f2ce,_0x5f373f):await this[_0x536e('0x26')](_0x44f2ce,_0x5f373f),Promise[_0x536e('0x2d')]();{const _0x151adc=await _0x44f2ce['text']();return _0x151adc[_0x536e('0xa')]('context_length_exceeded')?Promise[_0x536e('0x28')](new _0x2a7a6c(_0x4ac93b(_0x58cf70,'AI_ERROR_CONTEXT_LENGTH'))):_0x151adc[_0x536e('0xa')](_0x536e('0x6'))?Promise[_0x536e('0x28')](new _0x2a7a6c(_0x4ac93b(_0x58cf70,_0x536e('0xf')))):Promise['reject'](new Error(_0x151adc));}}async[_0x536e('0x2')](_0x4a4657,_0x468878,_0xd288d){let _0x27eb31,_0xf7462;return _0x468878?(_0x27eb31=_0x536e('0x1c'),_0xf7462=_0x536e('0x19')+_0x4a4657+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+(_0x468878['startsWith']('<')?_0x468878:_0x536e('0x1e')+_0x468878+_0x536e('0xb'))):(_0x27eb31=_0x536e('0x2e'),_0xf7462=_0x4a4657),[{'role':_0x536e('0x18'),'content':_0x27eb31},{'role':'user','content':_0xf7462}];}async[_0x536e('0x2f')](_0xcf00bb,_0x228f83){const _0x5f0d6f=_0xcf00bb[_0x536e('0x2c')][_0x536e('0x7')](),_0x36024d=new TextDecoder();let _0x4f8943='',_0x274b69='',_0x17f0f3='',_0x10ec83=!0x1;for(;!_0x10ec83;){const {done:_0x456139,value:_0x32f9b2}=await _0x5f0d6f[_0x536e('0x1b')](),_0x5e5bc4=_0x4f8943+_0x36024d['decode'](_0x32f9b2);let _0x127212='';_0x10ec83=_0x456139;try{_0x127212=this[_0x536e('0x23')](_0x5e5bc4),_0x4f8943='';}catch(_0x24dad6){_0x4f8943=_0x5e5bc4;continue;}_0x274b69+=_0x127212,!_0x10ec83&&this[_0x536e('0xc')](_0x274b69)||_0x274b69&&(_0x17f0f3+=_0x274b69,_0x274b69='',_0x228f83(_0x17f0f3));}return Promise[_0x536e('0x2d')]();}async[_0x536e('0x26')](_0x476c9b,_0x54bbe5){return _0x54bbe5((await _0x476c9b[_0x536e('0xd')]())['choices'][0x0]['message'][_0x536e('0x27')]),Promise[_0x536e('0x2d')]();}[_0x536e('0xc')](_0x5e5384){const _0x4bf8c3=_0x5e5384['split']('<')['length']!==_0x5e5384[_0x536e('0x1f')]('>')[_0x536e('0x5')],_0x138ace=_0x5e5384[_0x536e('0x5')]<0x1e;return _0x4bf8c3&&_0x138ace;}['_cleanUpData'](_0x25728c){return _0x25728c[_0x536e('0x1f')](/\n(?![^{]*\})/g)['map'](_0x2d91b4=>_0x2d91b4[_0x536e('0x3')](_0x536e('0x1a'),''))[_0x536e('0x10')](_0x127ac5=>_0x127ac5&&_0x127ac5[_0x536e('0x5')]>0x0&&_0x536e('0x12')!==_0x127ac5)['map'](_0x27ea44=>{const {choices:_0x224c6b}=JSON[_0x536e('0x15')](_0x27ea44);if(_0x224c6b[0x0]&&_0x224c6b[0x0][_0x536e('0x20')]&&_0x224c6b[0x0][_0x536e('0x20')][_0x536e('0x27')])return _0x224c6b[0x0]['delta']['content'];})[_0x536e('0x10')](_0x2a48da=>_0x2a48da)[_0x536e('0x1')]('');}}
|
package/src/aiassistant.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0xd4eb=['editOrReview','define','Improve\x20writing','translateChinese','English','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','makeShorter','Translate','summarize','Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.','Continue','Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.','Legal','Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.','professional','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.','push','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.','Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.','Business','Translate\x20the\x20content\x20to\x20Hindi\x20language.','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','translateArabic','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.','licenseKey','AIAssistant','init','casual','Make\x20shorter','generate','config','groupId','continue','translateGerman','ai.aiAssistant.removeCommands','Spanish','translateEnglish','Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.','destroy','Translate\x20the\x20content\x20to\x20Spanish\x20language.','aiLicenseKeyTrialLimit:operations','set','translatePortuguese','forEach','Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.','changeStyle','Professional','ai-trial-license-key-reached-limit-changes','legal','Translate\x20the\x20content\x20to\x20English\x20language.','pluginName','changeTone','editor','get','locale','simplifyLanguage','aiLicenseKeyInvalid','business','journalism','Friendly','French','ai-invalid-license-key','ai.aiAssistant.commands','filter','commands','Generate\x20from\x20selection','Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.','Simplified\x20Chinese','Translate\x20the\x20content\x20to\x20German\x20language.','German','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','Translate\x20to\x20%0','direct','concat','info','Poetic','Portuguese','Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.','aiLicenseKeyValid','Translate\x20the\x20content\x20to\x20French\x20language.','Change\x20tone','_licenseKeyCheckInterval','poetic','translateFrench','aiLicenseKeyTrial','ai.aiAssistant.extraCommandGroups'];(function(_0x2c86a2,_0xd4eb08){const _0x291526=function(_0x7ed8cb){while(--_0x7ed8cb){_0x2c86a2['push'](_0x2c86a2['shift']());}};_0x291526(++_0xd4eb08);}(_0xd4eb,0x11f));const _0x2915=function(_0x2c86a2,_0xd4eb08){_0x2c86a2=_0x2c86a2-0x0;let _0x291526=_0xd4eb[_0x2c86a2];return _0x291526;};import{CKEditorError as _0x2e118c}from'ckeditor5/src/utils.js';import{Plugin as _0x2ae44a}from'ckeditor5/src/core.js';import _0x5546f1 from'./aiassistantui.js';import _0x58e24a from'./aiassistantediting.js';import{getTranslation as _0x2625ec}from'./utils/common-translations.js';export default class r extends _0x2ae44a{static get['requires'](){return[_0x5546f1,_0x58e24a];}static get[_0x2915('0x19')](){return _0x2915('0x0');}constructor(_0x3d9253){super(_0x3d9253);const _0x1d8ca6=_0x3d9253[_0x2915('0x5')];_0x1d8ca6[_0x2915('0x3e')](_0x2915('0x25'),getDefaultCommands(_0x3d9253[_0x2915('0x1d')])),_0x1d8ca6['define'](_0x2915('0x3c'),[]),_0x1d8ca6['define'](_0x2915('0x9'),[]);const _0x2721f2=_0x1d8ca6[_0x2915('0x1c')](_0x2915('0x25')),_0x550711=_0x1d8ca6[_0x2915('0x1c')]('ai.aiAssistant.extraCommandGroups'),_0x515d12=_0x1d8ca6[_0x2915('0x1c')](_0x2915('0x9'));_0x550711[_0x2915('0x12')](_0x208718=>{const _0x10f69e=_0x2721f2['find'](_0xfcf79c=>_0xfcf79c['groupId']===_0x208718[_0x2915('0x6')]);_0x10f69e?_0x10f69e[_0x2915('0x27')]=_0x10f69e[_0x2915('0x27')][_0x2915('0x30')](_0x208718[_0x2915('0x27')]):_0x2721f2[_0x2915('0x4d')](_0x208718);}),_0x2721f2['forEach'](_0x524ee1=>{_0x524ee1[_0x2915('0x27')]=_0x524ee1[_0x2915('0x27')][_0x2915('0x26')](_0x60d94d=>!_0x515d12['includes'](_0x60d94d['id']));}),_0x1d8ca6[_0x2915('0x10')](_0x2915('0x25'),_0x2721f2);}[_0x2915('0x1')](){const _0x58f18a=this[_0x2915('0x1b')];this[_0x2915('0x56')]=_0x58f18a['config'][_0x2915('0x1c')](_0x2915('0x56')),this[_0x2915('0x38')]=setInterval(()=>{let _0x456f26;for(const _0x489b0d in _0x58f18a){const _0x33f8fc=_0x489b0d,_0x3df4bc=_0x58f18a[_0x33f8fc];if(_0x2915('0x3b')===_0x3df4bc||_0x2915('0x1f')===_0x3df4bc||_0x2915('0x35')===_0x3df4bc||'aiLicenseKeyTrialLimit:operations'===_0x3df4bc){delete _0x58f18a[_0x33f8fc],_0x456f26=_0x3df4bc;break;}}if(_0x2915('0x1f')===_0x456f26)throw clearInterval(this[_0x2915('0x38')]),new _0x2e118c(_0x2915('0x24'),null);if(_0x2915('0x3b')===_0x456f26&&console[_0x2915('0x31')](_0x2915('0x4c')),_0x2915('0xf')===_0x456f26)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x2e118c(_0x2915('0x16'),null);'aiLicenseKeyValid'===_0x456f26&&clearInterval(this[_0x2915('0x38')]);},0x3e8);}[_0x2915('0xd')](){this[_0x2915('0x38')]&&clearInterval(this['_licenseKeyCheckInterval']);}}export function getDefaultCommands(_0x3a6f39){return[{'groupId':_0x2915('0x3d'),'groupLabel':_0x2625ec(_0x3a6f39,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':_0x2625ec(_0x3a6f39,_0x2915('0x3f')),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':_0x2915('0x43'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x3')),'prompt':_0x2915('0x4f')},{'id':'makeLonger','label':_0x2625ec(_0x3a6f39,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':_0x2915('0x1e'),'label':_0x2625ec(_0x3a6f39,'Simplify\x20language'),'prompt':_0x2915('0xc')}]},{'groupId':_0x2915('0x4'),'groupLabel':_0x2625ec(_0x3a6f39,_0x2915('0x28')),'commands':[{'id':_0x2915('0x45'),'label':_0x2625ec(_0x3a6f39,'Summarize'),'prompt':_0x2915('0x48')},{'id':_0x2915('0x7'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x47')),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':_0x2915('0x1a'),'groupLabel':_0x2625ec(_0x3a6f39,_0x2915('0x37')),'commands':[{'id':_0x2915('0x4b'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x15')),'prompt':_0x2915('0x46')},{'id':_0x2915('0x2'),'label':_0x2625ec(_0x3a6f39,'Casual'),'prompt':_0x2915('0x29')},{'id':_0x2915('0x2f'),'label':_0x2625ec(_0x3a6f39,'Direct'),'prompt':_0x2915('0x42')},{'id':'confident','label':_0x2625ec(_0x3a6f39,'Confident'),'prompt':_0x2915('0x55')},{'id':'friendly','label':_0x2625ec(_0x3a6f39,_0x2915('0x22')),'prompt':_0x2915('0x34')}]},{'groupId':_0x2915('0x14'),'groupLabel':_0x2625ec(_0x3a6f39,'Change\x20style'),'commands':[{'id':_0x2915('0x20'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x51')),'prompt':_0x2915('0x4a')},{'id':_0x2915('0x17'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x49')),'prompt':_0x2915('0x2d')},{'id':_0x2915('0x21'),'label':_0x2625ec(_0x3a6f39,'Journalism'),'prompt':_0x2915('0x13')},{'id':_0x2915('0x39'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x32')),'prompt':_0x2915('0x4e')}]},{'groupId':'translate','groupLabel':_0x2625ec(_0x3a6f39,_0x2915('0x44')),'commands':[{'id':_0x2915('0xb'),'label':_0x2625ec(_0x3a6f39,'Translate\x20to\x20%0',[_0x2625ec(_0x3a6f39,_0x2915('0x41'))]),'prompt':_0x2915('0x18')},{'id':'translateSpanish','label':_0x2625ec(_0x3a6f39,'Translate\x20to\x20%0',[_0x2625ec(_0x3a6f39,_0x2915('0xa'))]),'prompt':_0x2915('0xe')},{'id':_0x2915('0x11'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x2e'),[_0x2625ec(_0x3a6f39,_0x2915('0x33'))]),'prompt':_0x2915('0x53')},{'id':_0x2915('0x8'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x2e'),[_0x2625ec(_0x3a6f39,_0x2915('0x2c'))]),'prompt':_0x2915('0x2b')},{'id':_0x2915('0x3a'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x2e'),[_0x2625ec(_0x3a6f39,_0x2915('0x23'))]),'prompt':_0x2915('0x36')},{'id':_0x2915('0x40'),'label':_0x2625ec(_0x3a6f39,_0x2915('0x2e'),[_0x2625ec(_0x3a6f39,_0x2915('0x2a'))]),'prompt':_0x2915('0x50')},{'id':'translateHindi','label':_0x2625ec(_0x3a6f39,_0x2915('0x2e'),[_0x2625ec(_0x3a6f39,'Hindi')]),'prompt':_0x2915('0x52')},{'id':_0x2915('0x54'),'label':_0x2625ec(_0x3a6f39,'Translate\x20to\x20%0',[_0x2625ec(_0x3a6f39,'Arabic')]),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x4c29=['addMarker','from','isAtEnd','get','updateMarker','insertContent','ck-ai-assistant-ui_theme','has','length','ai-ui','editor','ck-fake-ai-selection-candidate','hideFakeVisualSelection','ck-fake-ai-selection_collapsed','markerToElement','setSelection','span','for','canEditAt','data','model','insertContentBelow','document','markerToHighlight','ck-fake-ai-selection','config','toModel','editingDowncast','getLastPosition','conversion','toView','processor','change','pluginName','createPositionAfter','selection','isContent','getRange','start','markers','ai-ui-candidate','getSelectedBlocks','init'];(function(_0x3b4be1,_0x4c29a1){const _0x167486=function(_0x5479bc){while(--_0x5479bc){_0x3b4be1['push'](_0x3b4be1['shift']());}};_0x167486(++_0x4c29a1);}(_0x4c29,0x15d));const _0x1674=function(_0x3b4be1,_0x4c29a1){_0x3b4be1=_0x3b4be1-0x0;let _0x167486=_0x4c29[_0x3b4be1];return _0x167486;};import{Plugin as _0x2b4e13}from'ckeditor5/src/core.js';const s=_0x1674('0x4'),c=_0x1674('0x23');export default class i extends _0x2b4e13{static get[_0x1674('0x1c')](){return'AIAssistantEditing';}[_0x1674('0x25')](){const {editor:_0x3c8ecd}=this,_0x38dc68=[_0x1674('0x13')];_0x3c8ecd[_0x1674('0x14')]['get']('ai.useTheme')&&_0x38dc68['push'](_0x1674('0x1')),_0x3c8ecd[_0x1674('0x18')][_0x1674('0xc')](_0x1674('0x16'))['markerToHighlight']({'model':s,'view':{'classes':_0x38dc68}}),_0x3c8ecd['conversion'][_0x1674('0xc')](_0x1674('0x16'))[_0x1674('0x9')]({'model':s,'view':{'name':_0x1674('0xb'),'classes':[_0x1674('0x13'),'ck-fake-ai-selection_collapsed']}}),_0x3c8ecd['conversion'][_0x1674('0xc')](_0x1674('0x16'))[_0x1674('0x12')]({'model':c,'view':{'classes':[_0x1674('0x6')]}}),_0x3c8ecd['conversion'][_0x1674('0xc')](_0x1674('0x16'))[_0x1674('0x9')]({'model':c,'view':{'name':_0x1674('0xb'),'classes':[_0x1674('0x6'),_0x1674('0x8')]}});}['showFakeVisualSelection'](_0x2f3920){const _0x126165=this['editor'][_0x1674('0xf')],_0x5dfe9b=_0x2f3920?c:s;_0x126165['change'](_0xfda711=>{const _0x39517d=_0x126165[_0x1674('0x11')][_0x1674('0x1e')]['getFirstRange']();if(_0x126165[_0x1674('0x22')][_0x1674('0x2')](_0x5dfe9b))_0xfda711[_0x1674('0x2a')](_0x5dfe9b,{'range':_0x39517d});else{if(_0x39517d[_0x1674('0x21')][_0x1674('0x28')]){const _0x2542fb=_0x39517d[_0x1674('0x21')]['getLastMatchingPosition'](({item:_0x583ed1})=>!_0x126165['schema'][_0x1674('0x1f')](_0x583ed1),{'boundaries':_0x39517d});_0xfda711[_0x1674('0x26')](_0x5dfe9b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xfda711['createRange'](_0x2542fb,_0x39517d['end'])});}else _0xfda711[_0x1674('0x26')](_0x5dfe9b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x39517d});}});}[_0x1674('0x7')](_0x56439d){const _0x32472e=this[_0x1674('0x5')][_0x1674('0xf')],_0x584554=_0x56439d?c:s;_0x32472e[_0x1674('0x22')][_0x1674('0x2')](_0x584554)&&_0x32472e[_0x1674('0x1b')](_0x3c4765=>{_0x3c4765['removeMarker'](_0x584554);});}[_0x1674('0x0')](_0x55a077,_0x3cc7c4){const _0x1b456a=_0x3cc7c4||this[_0x1674('0x5')]['model'][_0x1674('0x22')]['get'](s)[_0x1674('0x20')]();if(!this['editor']['model'][_0x1674('0xd')](_0x1b456a))return;const _0x4bc370=this[_0x1674('0x5')][_0x1674('0xe')][_0x1674('0x1a')][_0x1674('0x19')](_0x55a077),_0x32dc8b=this[_0x1674('0x5')][_0x1674('0xe')][_0x1674('0x15')](_0x4bc370);this[_0x1674('0x5')]['model']['change'](_0x3d9f0c=>{this[_0x1674('0x7')]();const _0x46d89f=this[_0x1674('0x5')]['model'][_0x1674('0x0')](_0x32dc8b,_0x1b456a);_0x46d89f&&_0x3d9f0c[_0x1674('0xa')](_0x46d89f);});}[_0x1674('0x10')](_0xf5018c){const {model:_0x5e2c2c}=this[_0x1674('0x5')],_0x4fe0e3=Array[_0x1674('0x27')](_0x5e2c2c['createSelection'](this[_0x1674('0x5')][_0x1674('0xf')][_0x1674('0x22')][_0x1674('0x29')](s)[_0x1674('0x20')]())[_0x1674('0x24')]()),_0x3f1cd8=_0x4fe0e3[_0x1674('0x3')]?_0x5e2c2c[_0x1674('0x1d')](_0x4fe0e3['pop']()):_0x5e2c2c[_0x1674('0x11')][_0x1674('0x1e')][_0x1674('0x17')]();this[_0x1674('0x0')](_0xf5018c,_0x3f1cd8);}}
|