@ckeditor/ckeditor5-ai 0.0.0-nightly-20240129.0 → 0.0.0-nightly-20240131.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-20240131.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-20240131.0",
|
|
27
|
+
"ckeditor5-collaboration": "0.0.0-nightly-20240131.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-20240131.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 _0x1307=['name','AIRequestError','pluginName','textAdapter','afterInit','aiadapter-text-adapter-not-set'];(function(_0x5a1ed6,_0x13076c){var _0x2c9924=function(_0x1a43a4){while(--_0x1a43a4){_0x5a1ed6['push'](_0x5a1ed6['shift']());}};_0x2c9924(++_0x13076c);}(_0x1307,0x1de));var _0x2c99=function(_0x5a1ed6,_0x13076c){_0x5a1ed6=_0x5a1ed6-0x0;var _0x2c9924=_0x1307[_0x5a1ed6];return _0x2c9924;};import{Plugin as _0x199714}from'ckeditor5/src/core.js';import{CKEditorError as _0x24f4c4}from'ckeditor5/src/utils.js';export default class I extends _0x199714{static get[_0x2c99('0x4')](){return'AIAdapter';}[_0x2c99('0x0')](){if(!this[_0x2c99('0x5')])throw new _0x24f4c4(_0x2c99('0x1'),null);}}export class AIRequestError extends Error{constructor(_0x477216){super(_0x477216),this[_0x2c99('0x2')]=_0x2c99('0x3');}}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2c88=['editor','aitextadapter-send-request-failed','requires','signal','assign','_prepareRequestHeaders','_prepareRequestParameters','object','name','makeRequest','abort','textAdapter','AbortError','aborted','application/json','AI_ERROR_GET_HEADERS','reject','plugins','abortController'];(function(_0x18149e,_0x2c88fa){const _0x5a40f3=function(_0x567af1){while(--_0x567af1){_0x18149e['push'](_0x18149e['shift']());}};_0x5a40f3(++_0x2c88fa);}(_0x2c88,0xc9));const _0x5a40=function(_0x18149e,_0x2c88fa){_0x18149e=_0x18149e-0x0;let _0x5a40f3=_0x2c88[_0x18149e];return _0x5a40f3;};import{Plugin as _0x37fcfc}from'ckeditor5/src/core.js';import{CKEditorError as _0xf38bfb}from'ckeditor5/src/utils.js';import{default as _0x474532,AIRequestError as _0x3cbe96}from'./aiadapter.js';import{getTranslation as _0x2c2cd7}from'../utils/common-translations.js';export default class _ extends _0x37fcfc{static get[_0x5a40('0xa')](){return[_0x474532];}constructor(_0x35c018){super(_0x35c018),this[_0x5a40('0x7')]=new AbortController();}['init'](){this['editor'][_0x5a40('0x6')]['get'](_0x474532)[_0x5a40('0x0')]=this;}[_0x5a40('0x12')](){this[_0x5a40('0x7')][_0x5a40('0xb')][_0x5a40('0x2')]||(this[_0x5a40('0x7')][_0x5a40('0x12')](),this[_0x5a40('0x7')]=new AbortController());}async[_0x5a40('0x11')](_0x51472c){return this['sendRequest'](_0x51472c)['catch'](_0x37167f=>{if(_0x37167f instanceof _0x3cbe96)return Promise['reject'](_0x37167f);if(_0x5a40('0x1')==_0x37167f[_0x5a40('0x10')])return Promise['resolve']();throw console['error'](_0x37167f),new _0xf38bfb(_0x5a40('0x9'),null);});}async[_0x5a40('0xd')](_0x7bc64b,_0x1d3c9a){const _0x439a44=this[_0x5a40('0x8')]['locale'],_0x1b0978={'Content-Type':_0x5a40('0x3')};if(_0x5a40('0xf')==typeof _0x7bc64b)Object[_0x5a40('0xc')](_0x1b0978,_0x7bc64b);else{if(_0x7bc64b)try{const _0x323be2=await _0x7bc64b(_0x1d3c9a);Object[_0x5a40('0xc')](_0x1b0978,_0x323be2);}catch(_0x19e2d2){return Promise[_0x5a40('0x5')](new _0x3cbe96(_0x2c2cd7(_0x439a44,_0x5a40('0x4'))));}}return _0x1b0978;}async[_0x5a40('0xe')](_0x53d3aa,_0x128906){const _0x5023f5=this[_0x5a40('0x8')]['locale'];if(_0x5a40('0xf')==typeof _0x53d3aa)return _0x53d3aa;try{return await _0x53d3aa(_0x128906);}catch(_0x5e2468){return Promise[_0x5a40('0x5')](new _0x3cbe96(_0x2c2cd7(_0x5023f5,'AI_ERROR_GET_PARAMETERS')));}}}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x1c79=['</span>','_processProxyRequest','AI_ERROR_UNSUPPORTED_MODEL','getReader','_requestHeaders','ai.aws.requestHeaders','chunk','AWSTextAdapter','_readStreamableResponse','from','test','resolve','text','locale','ai.aws.requestParameters.top_p','startsWith','send','ai.aws.apiUrl','signal','json','_bedrockClientConfig','map','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.','application/json','_processAWSRequest','\x0a<</SYS>>\x0a[INST]\x0a','_apiUrl','config','\x0a[/INST]','getModelFamily','preparePrompt','utf8','data','generation','decode','meta.llama','body','bedrock-2023-05-31','_readStaticResponse','completion','bytes','Instruction:\x0a','_getGeneratedText','<span>','ai.aws.requestParameters.temperature','pluginName','ai.aws.requestParameters.anthropic_version','ai.aws.requestParameters.max_tokens_to_sample','define','_readAsyncIterableResponse','\x0a\x0aAssistant:','generations','read','parse','abortController','anthropic.claude','split','ai.aws.requestParameters.stream','utf-8','ai.aws.requestParameters.model','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','_requestParameters','<<SYS>>\x0a','cohere.command','stringify','ai21.j2','ai.aws.requestParameters','get','_prepareRequestHeaders'];(function(_0x5437c9,_0x1c7923){const _0x2b8950=function(_0x1ac802){while(--_0x1ac802){_0x5437c9['push'](_0x5437c9['shift']());}};_0x2b8950(++_0x1c7923);}(_0x1c79,0x7a));const _0x2b89=function(_0x5437c9,_0x1c7923){_0x5437c9=_0x5437c9-0x0;let _0x2b8950=_0x1c79[_0x5437c9];return _0x2b8950;};import{default as _0xd1e99d}from'./aitextadapter.js';import{AIRequestError as _0x927d50}from'./aiadapter.js';import{BedrockRuntimeClient as _0x82585f,InvokeModelCommand as _0x5626e9,InvokeModelWithResponseStreamCommand as _0xc2040}from'@aws-sdk/client-bedrock-runtime';import{getTranslation as _0x258bbc}from'../utils/common-translations.js';export default class H extends _0xd1e99d{static get[_0x2b89('0x3d')](){return _0x2b89('0x17');}constructor(_0x423092){super(_0x423092),_0x423092[_0x2b89('0x2b')][_0x2b89('0xe')]('ai.aws.requestParameters')||(_0x423092[_0x2b89('0x2b')][_0x2b89('0x40')](_0x2b89('0x6'),'anthropic.claude-v2'),_0x423092[_0x2b89('0x2b')][_0x2b89('0x40')](_0x2b89('0x3f'),0x7d0),_0x423092[_0x2b89('0x2b')]['define'](_0x2b89('0x3c'),0x1),_0x423092[_0x2b89('0x2b')][_0x2b89('0x40')](_0x2b89('0x1e'),0x1),_0x423092['config'][_0x2b89('0x40')]('ai.aws.requestParameters.top_k',0xfa),_0x423092[_0x2b89('0x2b')][_0x2b89('0x40')](_0x2b89('0x3e'),_0x2b89('0x35')),_0x423092[_0x2b89('0x2b')]['define'](_0x2b89('0x4'),!0x0)),this[_0x2b89('0x2a')]=_0x423092[_0x2b89('0x2b')][_0x2b89('0xe')](_0x2b89('0x21')),this[_0x2b89('0x24')]=_0x423092[_0x2b89('0x2b')][_0x2b89('0xe')]('ai.aws.bedrockClientConfig'),this[_0x2b89('0x14')]=_0x423092[_0x2b89('0x2b')][_0x2b89('0xe')](_0x2b89('0x15')),this[_0x2b89('0x8')]=_0x423092[_0x2b89('0x2b')][_0x2b89('0xe')](_0x2b89('0xd'));}async['sendRequest']({query:_0xa7bc5,context:_0x29c2ea,onData:_0x50588a,actionId:_0xee51f9}){const {model:_0x1369f5,stream:_0x6d4dc0,..._0x505112}=await this['_prepareRequestParameters'](this[_0x2b89('0x8')],_0xee51f9),_0xbfcfc0={'prompt':await this[_0x2b89('0x2e')](_0xa7bc5,_0x29c2ea,_0x1369f5,_0xee51f9),..._0x505112};this[_0x2b89('0x2a')]?await this[_0x2b89('0x11')](_0xbfcfc0,_0x1369f5,_0x6d4dc0,_0x50588a,_0xee51f9):await this[_0x2b89('0x28')](_0xbfcfc0,_0x1369f5,_0x6d4dc0,_0x50588a);}async[_0x2b89('0x2e')](_0x2b3596,_0x318336,_0x581f59,_0x86a15a){let _0x3d8dea,_0x4a4ffb;return _0x318336?(_0x3d8dea=_0x2b89('0x26'),_0x4a4ffb=_0x2b89('0x39')+_0x2b3596+_0x2b89('0x7')+(_0x318336[_0x2b89('0x1f')]('<')?_0x318336:_0x2b89('0x3b')+_0x318336+_0x2b89('0x10'))):(_0x3d8dea='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.',_0x4a4ffb=_0x2b3596),'meta.llama'==this[_0x2b89('0x2d')](_0x581f59)?_0x2b89('0x9')+_0x3d8dea+_0x2b89('0x29')+_0x4a4ffb+_0x2b89('0x2c'):'Human:\x0a'+_0x3d8dea+'\x0a'+_0x4a4ffb+_0x2b89('0x42');}[_0x2b89('0x2d')](_0x407f18){if(/^anthropic\.claude/[_0x2b89('0x1a')](_0x407f18))return _0x2b89('0x2');if(/^ai21\.j2/[_0x2b89('0x1a')](_0x407f18))return _0x2b89('0xc');if(/^cohere\.command/[_0x2b89('0x1a')](_0x407f18))return _0x2b89('0xa');if(/^meta\.llama/[_0x2b89('0x1a')](_0x407f18))return _0x2b89('0x33');throw new _0x927d50(_0x258bbc(this['editor'][_0x2b89('0x1d')],_0x2b89('0x12'),_0x407f18));}async[_0x2b89('0x11')](_0x4fb066,_0x20ad82,_0x11b106,_0x41ab3d,_0x46d111){const _0x34aa74={'method':'POST','headers':await this[_0x2b89('0xf')](this[_0x2b89('0x14')],_0x46d111),'body':JSON['stringify']({..._0x4fb066,'model':_0x20ad82,'stream':_0x11b106}),'signal':this['abortController']['signal']},_0x5dbd2d=await fetch(this[_0x2b89('0x2a')],_0x34aa74);_0x11b106?await this[_0x2b89('0x18')](_0x5dbd2d,_0x20ad82,_0x41ab3d):await this[_0x2b89('0x36')](_0x5dbd2d,_0x20ad82,_0x41ab3d);}async['_processAWSRequest'](_0x874219,_0x1910d6,_0x4d0598,_0x3f08c1){const _0x47c9dd=new _0x82585f(this[_0x2b89('0x24')]),_0x4976af={'body':JSON[_0x2b89('0xb')](_0x874219),'contentType':'application/json','accept':_0x2b89('0x27'),'modelId':_0x1910d6};let _0x284844;if(_0x4d0598){const _0x560484=new _0xc2040(_0x4976af);_0x284844=await _0x47c9dd['send'](_0x560484,{'abortSignal':this['abortController'][_0x2b89('0x22')]}),await this[_0x2b89('0x41')](_0x284844,_0x1910d6,_0x3f08c1);}else{const _0x1381f9=new _0x5626e9(_0x4976af);_0x284844=await _0x47c9dd[_0x2b89('0x20')](_0x1381f9,{'abortSignal':this[_0x2b89('0x1')][_0x2b89('0x22')]}),await this[_0x2b89('0x36')](_0x284844,_0x1910d6,_0x3f08c1);}}async[_0x2b89('0x41')](_0x4cf72a,_0x4eb235,_0x33afa0){const _0x47fb6f=_0x4cf72a[_0x2b89('0x34')],_0x1b0837=new TextDecoder(_0x2b89('0x5'));let _0x37e0a3='';for await(const _0x3d36cd of _0x47fb6f)if(_0x3d36cd['chunk']){const _0x448af3=_0x1b0837[_0x2b89('0x32')](_0x3d36cd[_0x2b89('0x16')][_0x2b89('0x38')]),_0x577023=JSON[_0x2b89('0x0')](_0x448af3);_0x37e0a3+=this['_getGeneratedText'](_0x577023,_0x4eb235),_0x33afa0(_0x37e0a3);}return Promise['resolve']();}async[_0x2b89('0x18')](_0x556023,_0x4a7912,_0x17dd30){const _0x1d0720=_0x556023[_0x2b89('0x34')],_0x1f396d=new TextDecoder(_0x2b89('0x5')),_0x1ccb20=_0x1d0720[_0x2b89('0x13')]();let _0x19eb71='',_0x5884e3='',_0x31d0cd=!0x1;for(;!_0x31d0cd;){const {done:_0x8ea72e,value:_0x5da3ae}=await _0x1ccb20[_0x2b89('0x44')]();if(_0x31d0cd=_0x8ea72e,_0x31d0cd)break;const _0x40896b=(_0x19eb71+_0x1f396d[_0x2b89('0x32')](_0x5da3ae))[_0x2b89('0x3')]('\x0a')['map'](_0x168563=>{try{return _0x19eb71='',JSON['parse'](_0x168563);}catch(_0x54a6a2){return _0x19eb71=_0x168563,null;}})['filter'](_0x225e26=>null!==_0x225e26);_0x40896b['length']&&(_0x5884e3+=_0x40896b[_0x2b89('0x25')](_0x4d36c5=>this['_getGeneratedText'](_0x4d36c5,_0x4a7912))['join'](''),_0x17dd30(_0x5884e3));}return Promise[_0x2b89('0x1b')]();}async['_readStaticResponse'](_0x510b2c,_0x2fd5e2,_0x49488c){let _0x1e80e0;return _0x1e80e0=_0x510b2c instanceof Response?await _0x510b2c[_0x2b89('0x23')]():JSON[_0x2b89('0x0')](Buffer[_0x2b89('0x19')](_0x510b2c[_0x2b89('0x34')])['toString'](_0x2b89('0x2f'))),(_0x49488c(this[_0x2b89('0x3a')](_0x1e80e0,_0x2fd5e2)),Promise[_0x2b89('0x1b')]());}[_0x2b89('0x3a')](_0x537ed7,_0x2beaec){switch(this[_0x2b89('0x2d')](_0x2beaec)){case _0x2b89('0x2'):return _0x537ed7[_0x2b89('0x37')];case _0x2b89('0xc'):return _0x537ed7['completions'][0x0][_0x2b89('0x30')][_0x2b89('0x1c')];case _0x2b89('0xa'):return _0x537ed7[_0x2b89('0x43')][0x0][_0x2b89('0x1c')];case _0x2b89('0x33'):return _0x537ed7[_0x2b89('0x31')];}}}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x1419=['ai.openAI.requestParameters.top_p','OpenAITextAdapter','ai.openAI.requestParameters.model','ai.openAI.requestParameters.stream','Instruction:\x0a','Moderation','replace','ai.openAI.requestParameters.temperature','content','sendRequest','_prepareRequestHeaders','length','https://api.openai.com/v1/chat/completions','AI_ERROR_MODERATION','config','_requestParameters','ai.openAI.apiUrl','_readStaticResponse','editor','<span>','POST','system','ai.openAI.requestHeaders','delta','ai.openAI.requestParameters','read','user','prepareMessages','_apiUrl','text','stream','get','define','filter','split','_prepareRequestParameters','_cleanUpData','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.','join','_requestHeaders','signal','includes','</span>','reject','resolve','startsWith','parse','ai.openAI.requestParameters.max_tokens','abortController','getReader','\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a','_isBufferIncomplete','gpt-3.5-turbo','AI_ERROR_CONTEXT_LENGTH'];(function(_0x968fac,_0x1419c7){const _0x17aec5=function(_0x510356){while(--_0x510356){_0x968fac['push'](_0x968fac['shift']());}};_0x17aec5(++_0x1419c7);}(_0x1419,0x8b));const _0x17ae=function(_0x968fac,_0x1419c7){_0x968fac=_0x968fac-0x0;let _0x17aec5=_0x1419[_0x968fac];return _0x17aec5;};import{default as _0xed35fb}from'./aitextadapter.js';import{AIRequestError as _0x3f9be8}from'./aiadapter.js';import{getTranslation as _0x1076d1}from'../utils/common-translations.js';export default class M extends _0xed35fb{static get['pluginName'](){return _0x17ae('0x18');}constructor(_0x374ba1){super(_0x374ba1),_0x374ba1['config'][_0x17ae('0x1')](_0x17ae('0x27'),_0x17ae('0x23')),_0x374ba1['config'][_0x17ae('0x1')](_0x17ae('0x19'),_0x17ae('0x15')),_0x374ba1[_0x17ae('0x25')]['define'](_0x17ae('0x10'),0x7d0),_0x374ba1[_0x17ae('0x25')][_0x17ae('0x1')](_0x17ae('0x1e'),0x1),_0x374ba1[_0x17ae('0x25')]['define'](_0x17ae('0x17'),0x1),_0x374ba1[_0x17ae('0x25')]['define'](_0x17ae('0x1a'),!0x0),this[_0x17ae('0x33')]=_0x374ba1[_0x17ae('0x25')][_0x17ae('0x0')](_0x17ae('0x27')),this[_0x17ae('0x8')]=_0x374ba1[_0x17ae('0x25')][_0x17ae('0x0')](_0x17ae('0x2d'))||{},this['_requestParameters']=_0x374ba1[_0x17ae('0x25')][_0x17ae('0x0')](_0x17ae('0x2f'));}async[_0x17ae('0x20')]({query:_0x762b21,context:_0x3282b1,onData:_0x507914,actionId:_0x4bd73f}){const _0x1f5393=this[_0x17ae('0x29')]['locale'],_0x38a20c=await this['prepareMessages'](_0x762b21,_0x3282b1,_0x4bd73f),_0x452a11=await this[_0x17ae('0x21')](this[_0x17ae('0x8')],_0x4bd73f),_0x2e45af=await this[_0x17ae('0x4')](this[_0x17ae('0x26')],_0x4bd73f),_0x54a939={'messages':_0x38a20c,..._0x2e45af},_0x4406ec={'method':_0x17ae('0x2b'),'headers':_0x452a11,'body':JSON['stringify'](_0x54a939),'signal':this[_0x17ae('0x11')][_0x17ae('0x9')]},_0x252b7a=await fetch(this[_0x17ae('0x33')],_0x4406ec);if(_0x252b7a['ok'])return _0x2e45af[_0x17ae('0x35')]?await this['_readStreamableResponse'](_0x252b7a,_0x507914):await this[_0x17ae('0x28')](_0x252b7a,_0x507914),Promise['resolve']();{const _0x336a20=await _0x252b7a[_0x17ae('0x34')]();return _0x336a20['includes']('context_length_exceeded')?Promise['reject'](new _0x3f9be8(_0x1076d1(_0x1f5393,_0x17ae('0x16')))):_0x336a20[_0x17ae('0xa')](_0x17ae('0x1c'))?Promise[_0x17ae('0xc')](new _0x3f9be8(_0x1076d1(_0x1f5393,_0x17ae('0x24')))):Promise[_0x17ae('0xc')](new Error(_0x336a20));}}async[_0x17ae('0x32')](_0xaf7a07,_0x15f5a6,_0x3ddbd8){let _0x15ae76,_0x21f62d;return _0x15f5a6?(_0x15ae76='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.',_0x21f62d=_0x17ae('0x1b')+_0xaf7a07+_0x17ae('0x13')+(_0x15f5a6[_0x17ae('0xe')]('<')?_0x15f5a6:_0x17ae('0x2a')+_0x15f5a6+_0x17ae('0xb'))):(_0x15ae76=_0x17ae('0x6'),_0x21f62d=_0xaf7a07),[{'role':_0x17ae('0x2c'),'content':_0x15ae76},{'role':_0x17ae('0x31'),'content':_0x21f62d}];}async['_readStreamableResponse'](_0x5a2d22,_0x34af1e){const _0x250b7f=_0x5a2d22['body'][_0x17ae('0x12')](),_0x580dbe=new TextDecoder();let _0x1e954d='',_0x10f2e3='',_0x5e1411='',_0x11592c=!0x1;for(;!_0x11592c;){const {done:_0x2066f1,value:_0x14c245}=await _0x250b7f[_0x17ae('0x30')](),_0x4b5779=_0x1e954d+_0x580dbe['decode'](_0x14c245);let _0x77cf36='';_0x11592c=_0x2066f1;try{_0x77cf36=this['_cleanUpData'](_0x4b5779),_0x1e954d='';}catch(_0x2afa1c){_0x1e954d=_0x4b5779;continue;}_0x10f2e3+=_0x77cf36,!_0x11592c&&this[_0x17ae('0x14')](_0x10f2e3)||_0x10f2e3&&(_0x5e1411+=_0x10f2e3,_0x10f2e3='',_0x34af1e(_0x5e1411));}return Promise[_0x17ae('0xd')]();}async['_readStaticResponse'](_0x1fbb8a,_0x56009c){return _0x56009c((await _0x1fbb8a['json']())['choices'][0x0]['message'][_0x17ae('0x1f')]),Promise[_0x17ae('0xd')]();}['_isBufferIncomplete'](_0x33d832){const _0x5a5084=_0x33d832[_0x17ae('0x3')]('<')[_0x17ae('0x22')]!==_0x33d832[_0x17ae('0x3')]('>')['length'],_0xb9923f=_0x33d832[_0x17ae('0x22')]<0x1e;return _0x5a5084&&_0xb9923f;}[_0x17ae('0x5')](_0x41a978){return _0x41a978[_0x17ae('0x3')](/\n(?![^{]*\})/g)['map'](_0x2ef8b0=>_0x2ef8b0[_0x17ae('0x1d')]('data:\x20',''))['filter'](_0x1d80ed=>_0x1d80ed&&_0x1d80ed[_0x17ae('0x22')]>0x0&&'[DONE]'!==_0x1d80ed)['map'](_0x4c0bb0=>{const {choices:_0x2a51ce}=JSON[_0x17ae('0xf')](_0x4c0bb0);if(_0x2a51ce[0x0]&&_0x2a51ce[0x0][_0x17ae('0x2e')]&&_0x2a51ce[0x0][_0x17ae('0x2e')][_0x17ae('0x1f')])return _0x2a51ce[0x0][_0x17ae('0x2e')]['content'];})[_0x17ae('0x2')](_0x872d49=>_0x872d49)[_0x17ae('0x7')]('');}}
|
package/src/aiassistant.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x5175=['forEach','find','Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.','Legal','French','Arabic','makeLonger','editOrReview','get','summarize','Hindi','Business','direct','Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.','ai.aiAssistant.removeCommands','poetic','Translate\x20the\x20content\x20to\x20English\x20language.','Translate\x20the\x20content\x20to\x20Hindi\x20language.','translateArabic','licenseKey','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','Simplified\x20Chinese','translateFrench','Summarize','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.','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','translateChinese','continue','Change\x20style','ai-trial-license-key-reached-limit-changes','Friendly','changeStyle','info','Translate\x20the\x20content\x20to\x20French\x20language.','Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.','config','business','Translate\x20the\x20content\x20to\x20Arabic\x20language.','Improve\x20writing','improveWriting','AIAssistant','legal','translate','aiLicenseKeyValid','translateHindi','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','commands','aiLicenseKeyTrialLimit:operations','_licenseKeyCheckInterval','translateEnglish','makeShorter','Poetic','confident','requires','translateSpanish','Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.','Continue','translateGerman','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','journalism','generate','init','ai.aiAssistant.commands','Translate','Make\x20longer','define','Direct','Translate\x20the\x20content\x20to\x20German\x20language.','professional','Translate\x20to\x20%0','English','locale','Change\x20tone','Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.','aiLicenseKeyInvalid','groupId','Journalism','Spanish','simplifyLanguage','ai.aiAssistant.extraCommandGroups','Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.','changeTone','Edit\x20or\x20review','Confident','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'];(function(_0xc387b8,_0x51751e){const _0x10cd43=function(_0x54927e){while(--_0x54927e){_0xc387b8['push'](_0xc387b8['shift']());}};_0x10cd43(++_0x51751e);}(_0x5175,0x97));const _0x10cd=function(_0xc387b8,_0x51751e){_0xc387b8=_0xc387b8-0x0;let _0x10cd43=_0x5175[_0xc387b8];return _0x10cd43;};import{CKEditorError as _0x5b3bdd}from'ckeditor5/src/utils.js';import{Plugin as _0x305550}from'ckeditor5/src/core.js';import _0x2d328e from'./aiassistantui.js';import _0x3f3249 from'./aiassistantediting.js';import{getTranslation as _0x1c9070}from'./utils/common-translations.js';export default class r extends _0x305550{static get[_0x10cd('0x51')](){return[_0x2d328e,_0x3f3249];}static get['pluginName'](){return _0x10cd('0x43');}constructor(_0x57cb48){super(_0x57cb48);const _0x219027=_0x57cb48[_0x10cd('0x3e')];_0x219027[_0x10cd('0x5')](_0x10cd('0x2'),getDefaultCommands(_0x57cb48[_0x10cd('0xb')])),_0x219027[_0x10cd('0x5')](_0x10cd('0x13'),[]),_0x219027[_0x10cd('0x5')](_0x10cd('0x27'),[]);const _0x34049a=_0x219027[_0x10cd('0x21')](_0x10cd('0x2')),_0x47df33=_0x219027[_0x10cd('0x21')](_0x10cd('0x13')),_0x152837=_0x219027['get'](_0x10cd('0x27'));_0x47df33['forEach'](_0x1c56b=>{const _0x48d0d3=_0x34049a[_0x10cd('0x1a')](_0x102c06=>_0x102c06[_0x10cd('0xf')]===_0x1c56b[_0x10cd('0xf')]);_0x48d0d3?_0x48d0d3[_0x10cd('0x4a')]=_0x48d0d3[_0x10cd('0x4a')]['concat'](_0x1c56b['commands']):_0x34049a[_0x10cd('0x31')](_0x1c56b);}),_0x34049a[_0x10cd('0x19')](_0x2081d8=>{_0x2081d8['commands']=_0x2081d8[_0x10cd('0x4a')]['filter'](_0x3e0730=>!_0x152837['includes'](_0x3e0730['id']));}),_0x219027['set'](_0x10cd('0x2'),_0x34049a);}[_0x10cd('0x1')](){const _0x24505b=this['editor'];this[_0x10cd('0x2c')]=_0x24505b['config'][_0x10cd('0x21')](_0x10cd('0x2c')),this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x4f1233;for(const _0x2ea161 in _0x24505b){const _0x22f33b=_0x2ea161,_0x397d46=_0x24505b[_0x22f33b];if('aiLicenseKeyTrial'===_0x397d46||_0x10cd('0xe')===_0x397d46||_0x10cd('0x46')===_0x397d46||_0x10cd('0x4b')===_0x397d46){delete _0x24505b[_0x22f33b],_0x4f1233=_0x397d46;break;}}if(_0x10cd('0xe')===_0x4f1233)throw clearInterval(this[_0x10cd('0x4c')]),new _0x5b3bdd('ai-invalid-license-key',null);if('aiLicenseKeyTrial'===_0x4f1233&&console[_0x10cd('0x3b')](_0x10cd('0x48')),'aiLicenseKeyTrialLimit:operations'===_0x4f1233)throw clearInterval(this[_0x10cd('0x4c')]),new _0x5b3bdd(_0x10cd('0x38'),null);_0x10cd('0x46')===_0x4f1233&&clearInterval(this['_licenseKeyCheckInterval']);},0x3e8);}['destroy'](){this[_0x10cd('0x4c')]&&clearInterval(this[_0x10cd('0x4c')]);}}export function getDefaultCommands(_0x20b771){return[{'groupId':_0x10cd('0x20'),'groupLabel':_0x1c9070(_0x20b771,_0x10cd('0x16')),'commands':[{'id':_0x10cd('0x42'),'label':_0x1c9070(_0x20b771,_0x10cd('0x41')),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':_0x10cd('0x4e'),'label':_0x1c9070(_0x20b771,'Make\x20shorter'),'prompt':_0x10cd('0x33')},{'id':_0x10cd('0x1f'),'label':_0x1c9070(_0x20b771,_0x10cd('0x4')),'prompt':_0x10cd('0x56')},{'id':_0x10cd('0x12'),'label':_0x1c9070(_0x20b771,_0x10cd('0x49')),'prompt':_0x10cd('0xd')}]},{'groupId':_0x10cd('0x0'),'groupLabel':_0x1c9070(_0x20b771,'Generate\x20from\x20selection'),'commands':[{'id':_0x10cd('0x22'),'label':_0x1c9070(_0x20b771,_0x10cd('0x30')),'prompt':_0x10cd('0x3d')},{'id':_0x10cd('0x36'),'label':_0x1c9070(_0x20b771,_0x10cd('0x54')),'prompt':_0x10cd('0x26')}]},{'groupId':_0x10cd('0x15'),'groupLabel':_0x1c9070(_0x20b771,_0x10cd('0xc')),'commands':[{'id':_0x10cd('0x8'),'label':_0x1c9070(_0x20b771,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':_0x1c9070(_0x20b771,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':_0x10cd('0x25'),'label':_0x1c9070(_0x20b771,_0x10cd('0x6')),'prompt':_0x10cd('0x34')},{'id':_0x10cd('0x50'),'label':_0x1c9070(_0x20b771,_0x10cd('0x17')),'prompt':_0x10cd('0x18')},{'id':'friendly','label':_0x1c9070(_0x20b771,_0x10cd('0x39')),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':_0x10cd('0x3a'),'groupLabel':_0x1c9070(_0x20b771,_0x10cd('0x37')),'commands':[{'id':_0x10cd('0x3f'),'label':_0x1c9070(_0x20b771,_0x10cd('0x24')),'prompt':_0x10cd('0x53')},{'id':_0x10cd('0x44'),'label':_0x1c9070(_0x20b771,_0x10cd('0x1c')),'prompt':_0x10cd('0x2d')},{'id':_0x10cd('0x57'),'label':_0x1c9070(_0x20b771,_0x10cd('0x10')),'prompt':_0x10cd('0x14')},{'id':_0x10cd('0x28'),'label':_0x1c9070(_0x20b771,_0x10cd('0x4f')),'prompt':_0x10cd('0x32')}]},{'groupId':_0x10cd('0x45'),'groupLabel':_0x1c9070(_0x20b771,_0x10cd('0x3')),'commands':[{'id':_0x10cd('0x4d'),'label':_0x1c9070(_0x20b771,_0x10cd('0x9'),[_0x1c9070(_0x20b771,_0x10cd('0xa'))]),'prompt':_0x10cd('0x29')},{'id':_0x10cd('0x52'),'label':_0x1c9070(_0x20b771,_0x10cd('0x9'),[_0x1c9070(_0x20b771,_0x10cd('0x11'))]),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':_0x1c9070(_0x20b771,'Translate\x20to\x20%0',[_0x1c9070(_0x20b771,'Portuguese')]),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':_0x10cd('0x55'),'label':_0x1c9070(_0x20b771,_0x10cd('0x9'),[_0x1c9070(_0x20b771,'German')]),'prompt':_0x10cd('0x7')},{'id':_0x10cd('0x2f'),'label':_0x1c9070(_0x20b771,_0x10cd('0x9'),[_0x1c9070(_0x20b771,_0x10cd('0x1d'))]),'prompt':_0x10cd('0x3c')},{'id':_0x10cd('0x35'),'label':_0x1c9070(_0x20b771,'Translate\x20to\x20%0',[_0x1c9070(_0x20b771,_0x10cd('0x2e'))]),'prompt':_0x10cd('0x1b')},{'id':_0x10cd('0x47'),'label':_0x1c9070(_0x20b771,_0x10cd('0x9'),[_0x1c9070(_0x20b771,_0x10cd('0x23'))]),'prompt':_0x10cd('0x2a')},{'id':_0x10cd('0x2b'),'label':_0x1c9070(_0x20b771,_0x10cd('0x9'),[_0x1c9070(_0x20b771,_0x10cd('0x1e'))]),'prompt':_0x10cd('0x40')}]}];}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x1444=['toModel','markers','ck-fake-ai-selection','has','ck-fake-ai-selection-candidate','ck-fake-ai-selection_collapsed','get','getSelectedBlocks','processor','insertContent','isContent','setSelection','editingDowncast','canEditAt','toView','markerToElement','change','conversion','span','selection','updateMarker','insertContentBelow','hideFakeVisualSelection','pluginName','editor','getFirstRange','pop','for','document','schema','AIAssistantEditing','getLastPosition','createSelection','model','isAtEnd','createPositionAfter','length','config','markerToHighlight','from','showFakeVisualSelection','start','push','addMarker'];(function(_0xd36c00,_0x1444eb){const _0x36471c=function(_0x594945){while(--_0x594945){_0xd36c00['push'](_0xd36c00['shift']());}};_0x36471c(++_0x1444eb);}(_0x1444,0x9b));const _0x3647=function(_0xd36c00,_0x1444eb){_0xd36c00=_0xd36c00-0x0;let _0x36471c=_0x1444[_0xd36c00];return _0x36471c;};import{Plugin as _0x1a9463}from'ckeditor5/src/core.js';const s='ai-ui',c='ai-ui-candidate';export default class i extends _0x1a9463{static get[_0x3647('0x0')](){return _0x3647('0x7');}['init'](){const {editor:_0x2f51ec}=this,_0x2d9bd5=[_0x3647('0x17')];_0x2f51ec[_0x3647('0xe')][_0x3647('0x1b')]('ai.useTheme')&&_0x2d9bd5[_0x3647('0x13')]('ck-ai-assistant-ui_theme'),_0x2f51ec[_0x3647('0x26')][_0x3647('0x4')](_0x3647('0x21'))[_0x3647('0xf')]({'model':s,'view':{'classes':_0x2d9bd5}}),_0x2f51ec[_0x3647('0x26')][_0x3647('0x4')](_0x3647('0x21'))[_0x3647('0x24')]({'model':s,'view':{'name':_0x3647('0x27'),'classes':[_0x3647('0x17'),_0x3647('0x1a')]}}),_0x2f51ec['conversion']['for'](_0x3647('0x21'))[_0x3647('0xf')]({'model':c,'view':{'classes':[_0x3647('0x19')]}}),_0x2f51ec[_0x3647('0x26')]['for'](_0x3647('0x21'))[_0x3647('0x24')]({'model':c,'view':{'name':'span','classes':['ck-fake-ai-selection-candidate','ck-fake-ai-selection_collapsed']}});}[_0x3647('0x11')](_0x318d44){const _0x2a8270=this[_0x3647('0x1')][_0x3647('0xa')],_0x37b2f1=_0x318d44?c:s;_0x2a8270[_0x3647('0x25')](_0x4a6977=>{const _0x6ca256=_0x2a8270[_0x3647('0x5')][_0x3647('0x28')][_0x3647('0x2')]();if(_0x2a8270[_0x3647('0x16')][_0x3647('0x18')](_0x37b2f1))_0x4a6977[_0x3647('0x29')](_0x37b2f1,{'range':_0x6ca256});else{if(_0x6ca256[_0x3647('0x12')][_0x3647('0xb')]){const _0x33e9f5=_0x6ca256['start']['getLastMatchingPosition'](({item:_0x33b1c3})=>!_0x2a8270[_0x3647('0x6')][_0x3647('0x1f')](_0x33b1c3),{'boundaries':_0x6ca256});_0x4a6977[_0x3647('0x14')](_0x37b2f1,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4a6977['createRange'](_0x33e9f5,_0x6ca256['end'])});}else _0x4a6977[_0x3647('0x14')](_0x37b2f1,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x6ca256});}});}['hideFakeVisualSelection'](_0x1453a7){const _0x49ef6e=this[_0x3647('0x1')][_0x3647('0xa')],_0x2cb6b9=_0x1453a7?c:s;_0x49ef6e[_0x3647('0x16')][_0x3647('0x18')](_0x2cb6b9)&&_0x49ef6e[_0x3647('0x25')](_0x57b5da=>{_0x57b5da['removeMarker'](_0x2cb6b9);});}[_0x3647('0x1e')](_0x4e48b9,_0x23663d){const _0x4115fa=_0x23663d||this[_0x3647('0x1')]['model'][_0x3647('0x16')][_0x3647('0x1b')](s)['getRange']();if(!this[_0x3647('0x1')][_0x3647('0xa')][_0x3647('0x22')](_0x4115fa))return;const _0x5bd5df=this['editor']['data'][_0x3647('0x1d')][_0x3647('0x23')](_0x4e48b9),_0x187987=this[_0x3647('0x1')]['data'][_0x3647('0x15')](_0x5bd5df);this[_0x3647('0x1')][_0x3647('0xa')]['change'](_0x48baab=>{this[_0x3647('0x2b')]();const _0x3d8dfa=this[_0x3647('0x1')][_0x3647('0xa')][_0x3647('0x1e')](_0x187987,_0x4115fa);_0x3d8dfa&&_0x48baab[_0x3647('0x20')](_0x3d8dfa);});}[_0x3647('0x2a')](_0x1e1573){const {model:_0x2cd445}=this[_0x3647('0x1')],_0x4f2dd3=Array[_0x3647('0x10')](_0x2cd445[_0x3647('0x9')](this[_0x3647('0x1')]['model'][_0x3647('0x16')]['get'](s)['getRange']())[_0x3647('0x1c')]()),_0x221c96=_0x4f2dd3[_0x3647('0xd')]?_0x2cd445[_0x3647('0xc')](_0x4f2dd3[_0x3647('0x3')]()):_0x2cd445[_0x3647('0x5')]['selection'][_0x3647('0x8')]();this[_0x3647('0x1e')](_0x1e1573,_0x221c96);}}
|