@ckeditor/ckeditor5-ai 0.0.0-nightly-20231004.0 → 40.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.
- package/README.md +19 -1
- package/build/ai.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/lang/contexts.json +15 -5
- package/lang/translations/ar.po +39 -39
- package/lang/translations/bg.po +39 -39
- package/lang/translations/bn.po +39 -39
- package/lang/translations/ca.po +39 -39
- package/lang/translations/cs.po +39 -39
- package/lang/translations/da.po +39 -39
- package/lang/translations/de.po +39 -39
- package/lang/translations/el.po +39 -39
- package/lang/translations/es.po +39 -39
- package/lang/translations/et.po +39 -39
- package/lang/translations/fi.po +39 -39
- package/lang/translations/fr.po +39 -39
- package/lang/translations/he.po +39 -39
- package/lang/translations/hi.po +39 -39
- package/lang/translations/hu.po +39 -39
- package/lang/translations/id.po +39 -39
- package/lang/translations/it.po +39 -39
- package/lang/translations/ja.po +39 -39
- package/lang/translations/ko.po +39 -39
- package/lang/translations/lt.po +39 -39
- package/lang/translations/lv.po +39 -39
- package/lang/translations/ms.po +39 -39
- package/lang/translations/nl.po +40 -40
- package/lang/translations/no.po +39 -39
- package/lang/translations/pl.po +39 -39
- package/lang/translations/pt-br.po +39 -39
- package/lang/translations/pt.po +39 -39
- package/lang/translations/ro.po +39 -39
- package/lang/translations/ru.po +39 -39
- package/lang/translations/sk.po +39 -39
- package/lang/translations/sr.po +39 -39
- package/lang/translations/sv.po +39 -39
- package/lang/translations/th.po +39 -39
- package/lang/translations/tr.po +39 -39
- package/lang/translations/uk.po +39 -39
- package/lang/translations/vi.po +39 -39
- package/lang/translations/zh-cn.po +39 -39
- package/lang/translations/zh.po +39 -39
- package/package.json +5 -3
- package/src/aiassistant.d.ts +419 -128
- package/src/aiassistant.js +1 -1
- package/src/aiassistantediting.d.ts +45 -44
- package/src/aiassistantediting.js +1 -1
- package/src/aiassistantui.d.ts +46 -41
- package/src/aiassistantui.js +1 -1
- package/src/aiconnector.d.ts +44 -40
- package/src/aiconnector.js +1 -1
- package/src/augmentation.d.ts +26 -26
- package/src/index.d.ts +9 -9
- package/src/ui/aiassistantcontroller.d.ts +59 -59
- package/src/ui/aiassistantcontroller.js +1 -1
- package/src/ui/dropdown/aicommandslistview.d.ts +22 -22
- package/src/ui/dropdown/aicommandslistview.js +1 -1
- package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +29 -29
- package/src/ui/dropdown/buttonlabelwithhighlightview.js +1 -1
- package/src/ui/form/aiformcontentarea.d.ts +48 -70
- package/src/ui/form/aiformcontentarea.js +1 -1
- package/src/ui/form/aiformerrorview.d.ts +26 -26
- package/src/ui/form/aiformerrorview.js +1 -1
- package/src/ui/form/aiformpromptview.d.ts +46 -46
- package/src/ui/form/aiformpromptview.js +1 -1
- package/src/ui/form/aiformtoolbarview.d.ts +41 -41
- package/src/ui/form/aiformtoolbarview.js +1 -1
- package/src/ui/form/aiformview.d.ts +131 -125
- package/src/ui/form/aiformview.js +1 -1
- package/src/ui/form/aihistorylistitemview.d.ts +18 -18
- package/src/ui/form/aihistorylistitemview.js +1 -1
- package/src/ui/form/aihistorylistview.d.ts +35 -35
- package/src/ui/form/aihistorylistview.js +1 -1
- package/src/ui/form/prompthistory.d.ts +20 -20
- package/src/ui/form/prompthistory.js +1 -1
- package/src/ui/showaiassistantcommand.d.ts +26 -26
- package/src/ui/showaiassistantcommand.js +1 -1
- package/src/utils/common-translations.d.ts +9 -0
- package/src/utils/common-translations.js +23 -0
- package/theme/ai-dropdown.css +4 -4
- package/theme/ai-form.css +2 -0
- package/theme/ai.css +15 -13
- package/theme/icons/error.svg +1 -3
- package/theme/icons/magic-wand.svg +1 -7
- package/theme/icons/robot-pencil.svg +1 -9
- package/theme/icons/submit.svg +1 -3
- package/src/ui/form/aiformtextareaview.d.ts +0 -31
- package/src/ui/form/aiformtextareaview.js +0 -23
package/src/aiassistant.d.ts
CHANGED
|
@@ -1,128 +1,419 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/aiassistant
|
|
7
|
+
* @publicApi
|
|
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';
|
|
13
|
+
import AIConnector from './aiconnector';
|
|
14
|
+
/**
|
|
15
|
+
* A function that returns the list of default AI commands definitions in the given localization context.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getDefaultCommands: (locale: Locale) => Array<GroupDefinition>;
|
|
18
|
+
/**
|
|
19
|
+
* AI assistant plugin that allows you to use external AI models to generate content or improve existing content.
|
|
20
|
+
*/
|
|
21
|
+
export default class AIAssistant extends Plugin {
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get requires(): readonly [typeof AIAssistantUI, typeof AIAssistantEditing, typeof AIConnector];
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName(): "AIAssistant";
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
constructor(editor: Editor);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
init(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
destroy(): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The configuration of the AI assistant feature.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* ClassicEditor
|
|
48
|
+
* .create( editorElement, {
|
|
49
|
+
* aiAssistant: ... // AI assistant options.
|
|
50
|
+
* } )
|
|
51
|
+
* .then( ... )
|
|
52
|
+
* .catch( ... );
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
56
|
+
*/
|
|
57
|
+
export interface AIAssistantConfig {
|
|
58
|
+
/**
|
|
59
|
+
* The URL to which the API request will be sent.
|
|
60
|
+
*
|
|
61
|
+
* Defaults to `'https://api.openai.com/v1/chat/completions'`.
|
|
62
|
+
*/
|
|
63
|
+
apiUrl?: string;
|
|
64
|
+
/**
|
|
65
|
+
* A key used to authorize the request to the AI service.
|
|
66
|
+
*
|
|
67
|
+
* If you are connecting directly to the OpenAI API, use your OpenAI API key as `authKey`.
|
|
68
|
+
*
|
|
69
|
+
* **Important: use your API key ONLY in a development environment or for testing purposes!**
|
|
70
|
+
* In the production environment, {@glink features/ai-assistant#using-proxy-endpoint pass your request through a proxy}.
|
|
71
|
+
*
|
|
72
|
+
* If you are using a proxy service to send requests to the AI service, `authKey` can be used to implement authorization for your
|
|
73
|
+
* requests.
|
|
74
|
+
*
|
|
75
|
+
* If the key is provided, it is added to the `Authorization` header of the request call, using the bearer scheme:
|
|
76
|
+
*
|
|
77
|
+
* ```
|
|
78
|
+
* Authorization: Bearer <authKey>
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* If the provided value is a `string`, it is simply used as provided.
|
|
82
|
+
*
|
|
83
|
+
* If the provided value is a function, it should be a function that returns a `Promise` which resolves with the authorization token.
|
|
84
|
+
* This way, you can perform an authorization request to your application and receive the authorization token (and also implement
|
|
85
|
+
* any custom logic that you need). The authorization token is then used to make the actual call to the AI service.
|
|
86
|
+
*
|
|
87
|
+
* ```js
|
|
88
|
+
* {
|
|
89
|
+
* aiAssistant: {
|
|
90
|
+
* authKey: async () => {
|
|
91
|
+
* return await fetch( 'https://example.com/jwt-endpoint' );
|
|
92
|
+
* }
|
|
93
|
+
* // ...
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* If the authorization request fails, the promise should be rejected. In this case, the feature will display an error notification.
|
|
99
|
+
*/
|
|
100
|
+
authKey?: string | (() => Promise<string>);
|
|
101
|
+
/**
|
|
102
|
+
* A list of all AI commands groups definitions to be displayed in the `'aiCommands'` UI dropdown.
|
|
103
|
+
*
|
|
104
|
+
* Setting this property will overwrite the default list of predefined commands.
|
|
105
|
+
*
|
|
106
|
+
* The default configuration is as follows:
|
|
107
|
+
*
|
|
108
|
+
* ```json
|
|
109
|
+
* {
|
|
110
|
+
* groupId: 'editOrReview',
|
|
111
|
+
* groupLabel: 'Edit or review',
|
|
112
|
+
* commands: [
|
|
113
|
+
* {
|
|
114
|
+
* id: 'improveWriting',
|
|
115
|
+
* label: 'Improve writing',
|
|
116
|
+
* prompt: 'Rewrite this content with no spelling mistakes, proper grammar, ' +
|
|
117
|
+
* 'and with more descriptive language, using best writing practices without losing the original meaning.'
|
|
118
|
+
* },
|
|
119
|
+
* {
|
|
120
|
+
* id: 'makeShorter',
|
|
121
|
+
* label: 'Make shorter',
|
|
122
|
+
* prompt: 'Remove any repetitive, redundant, or non-essential writing in this content ' +
|
|
123
|
+
* 'without changing the meaning or losing any key information.'
|
|
124
|
+
* },
|
|
125
|
+
* {
|
|
126
|
+
* id: 'makeLonger',
|
|
127
|
+
* label: 'Make longer',
|
|
128
|
+
* prompt: 'Expand upon this content with descriptive language and more detailed explanations, ' +
|
|
129
|
+
* 'to make the writing easier to understand and increase the length of the content.'
|
|
130
|
+
* },
|
|
131
|
+
* {
|
|
132
|
+
* id: 'simplifyLanguage',
|
|
133
|
+
* label: 'Simplify language',
|
|
134
|
+
* prompt: 'Rewrite this content with simplified language ' +
|
|
135
|
+
* 'and reduce the complexity of the writing, so that the content is easier to understand.'
|
|
136
|
+
* }
|
|
137
|
+
* ]
|
|
138
|
+
* },
|
|
139
|
+
* {
|
|
140
|
+
* groupId: 'generate',
|
|
141
|
+
* groupLabel: 'Generate from selection',
|
|
142
|
+
* commands: [
|
|
143
|
+
* {
|
|
144
|
+
* id: 'summarize',
|
|
145
|
+
* label: 'Summarize',
|
|
146
|
+
* prompt: 'Provide the key points and concepts in this content in a succinct summary.'
|
|
147
|
+
* },
|
|
148
|
+
* {
|
|
149
|
+
* id: 'continue',
|
|
150
|
+
* label: 'Continue',
|
|
151
|
+
* prompt: 'Continue this text.'
|
|
152
|
+
* }
|
|
153
|
+
* ]
|
|
154
|
+
* },
|
|
155
|
+
* {
|
|
156
|
+
* groupId: 'changeTone',
|
|
157
|
+
* groupLabel: 'Change tone',
|
|
158
|
+
* commands: [
|
|
159
|
+
* {
|
|
160
|
+
* id: 'professional',
|
|
161
|
+
* label: 'Professional',
|
|
162
|
+
* prompt: 'Rewrite this content using polished, formal, and respectful language ' +
|
|
163
|
+
* 'to convey professional expertise and competence.'
|
|
164
|
+
* },
|
|
165
|
+
* {
|
|
166
|
+
* id: 'casual',
|
|
167
|
+
* label: 'Casual',
|
|
168
|
+
* prompt: 'Rewrite this content with casual, informal language to convey a casual conversation with a real person.'
|
|
169
|
+
* },
|
|
170
|
+
* {
|
|
171
|
+
* id: 'direct',
|
|
172
|
+
* label: 'Direct',
|
|
173
|
+
* prompt: 'Rewrite this content with direct language using only the essential information.'
|
|
174
|
+
* },
|
|
175
|
+
* {
|
|
176
|
+
* id: 'confident',
|
|
177
|
+
* label: 'Confident',
|
|
178
|
+
* prompt: 'Rewrite this content using compelling, optimistic language to convey confidence in the writing.'
|
|
179
|
+
* },
|
|
180
|
+
* {
|
|
181
|
+
* id: 'friendly',
|
|
182
|
+
* label: 'Friendly',
|
|
183
|
+
* prompt: 'Rewrite this content using friendly, comforting language, to convey understanding and empathy.'
|
|
184
|
+
* }
|
|
185
|
+
* ]
|
|
186
|
+
* },
|
|
187
|
+
* {
|
|
188
|
+
* groupId: 'changeStyle',
|
|
189
|
+
* groupLabel: 'Change style',
|
|
190
|
+
* commands: [
|
|
191
|
+
* {
|
|
192
|
+
* id: 'business',
|
|
193
|
+
* label: 'Business',
|
|
194
|
+
* prompt: 'Rewrite this content as a business professional with formal language.'
|
|
195
|
+
* },
|
|
196
|
+
* {
|
|
197
|
+
* id: 'legal',
|
|
198
|
+
* label: 'Legal',
|
|
199
|
+
* prompt: 'Rewrite this content as a legal professional using valid legal terminology.'
|
|
200
|
+
* },
|
|
201
|
+
* {
|
|
202
|
+
* id: 'journalism',
|
|
203
|
+
* label: 'Journalism',
|
|
204
|
+
* prompt: 'Rewrite this content as a journalist using engaging language to convey the importance of the information.'
|
|
205
|
+
* },
|
|
206
|
+
* {
|
|
207
|
+
* id: 'poetic',
|
|
208
|
+
* label: 'Poetic',
|
|
209
|
+
* prompt: 'Rewrite this content as a poem using poetic techniques without losing the original meaning.'
|
|
210
|
+
* }
|
|
211
|
+
* ]
|
|
212
|
+
* },
|
|
213
|
+
* {
|
|
214
|
+
* groupId: 'translate',
|
|
215
|
+
* groupLabel: 'Translate',
|
|
216
|
+
* commands: [
|
|
217
|
+
* {
|
|
218
|
+
* id: 'translateEnglish',
|
|
219
|
+
* label: 'Translate to English',
|
|
220
|
+
* prompt: 'Translate to English language.'
|
|
221
|
+
* },
|
|
222
|
+
* {
|
|
223
|
+
* id: 'translateSpanish',
|
|
224
|
+
* label: 'Translate to Spanish',
|
|
225
|
+
* prompt: 'Translate to Spanish language.'
|
|
226
|
+
* },
|
|
227
|
+
* {
|
|
228
|
+
* id: 'translatePortuguese',
|
|
229
|
+
* label: 'Translate to Portuguese',
|
|
230
|
+
* prompt: 'Translate to Portuguese language.'
|
|
231
|
+
* },
|
|
232
|
+
* {
|
|
233
|
+
* id: 'translateGerman',
|
|
234
|
+
* label: 'Translate to German',
|
|
235
|
+
* prompt: 'Translate to German language.'
|
|
236
|
+
* },
|
|
237
|
+
* {
|
|
238
|
+
* id: 'translateFrench',
|
|
239
|
+
* label: 'Translate to French',
|
|
240
|
+
* prompt: 'Translate to French language.'
|
|
241
|
+
* },
|
|
242
|
+
* {
|
|
243
|
+
* id: 'translateChinese',
|
|
244
|
+
* label: 'Translate to Simplified Chinese',
|
|
245
|
+
* prompt: 'Translate to Simplified Chinese language.'
|
|
246
|
+
* },
|
|
247
|
+
* {
|
|
248
|
+
* id: 'translateHindi',
|
|
249
|
+
* label: 'Translate to Hindi',
|
|
250
|
+
* prompt: 'Translate to Hindi language.'
|
|
251
|
+
* },
|
|
252
|
+
* {
|
|
253
|
+
* id: 'translateArabic',
|
|
254
|
+
* label: 'Translate to Arabic',
|
|
255
|
+
* prompt: 'Translate to Arabic language.'
|
|
256
|
+
* }
|
|
257
|
+
* ]
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
commands?: Array<GroupDefinition>;
|
|
262
|
+
/**
|
|
263
|
+
* A list of additional AI commands groups definitions that will extend
|
|
264
|
+
* {@link module:ai/aiassistant~AIAssistantConfig#commands default commands}.
|
|
265
|
+
*
|
|
266
|
+
* You can define new AI commands groups or add new AI commands to existing groups. If you add AI commands to an existing group,
|
|
267
|
+
* you do not need to specify `groupLabel` property.
|
|
268
|
+
*
|
|
269
|
+
* An example configuration:
|
|
270
|
+
*
|
|
271
|
+
* ```json
|
|
272
|
+
* {
|
|
273
|
+
* aiAssistant: {
|
|
274
|
+
* extraCommandGroups: [
|
|
275
|
+
* // Add an AI command to an existing group:
|
|
276
|
+
* {
|
|
277
|
+
* groupId: 'changeTone',
|
|
278
|
+
* commands: [
|
|
279
|
+
* {
|
|
280
|
+
* id: 'sad',
|
|
281
|
+
* label: 'Sad',
|
|
282
|
+
* prompt: 'Rewrite this text to make it sound sad and depressing.'
|
|
283
|
+
* }
|
|
284
|
+
* ]
|
|
285
|
+
* },
|
|
286
|
+
* // Create a new AI commands group:
|
|
287
|
+
* {
|
|
288
|
+
* groupId: 'transformations',
|
|
289
|
+
* groupLabel: 'Transformations',
|
|
290
|
+
* commands: [
|
|
291
|
+
* {
|
|
292
|
+
* id: 'addEmojis',
|
|
293
|
+
* label: 'Add emojis',
|
|
294
|
+
* prompt: 'Analyze each sentence of this text. After each sentence add an emoji that summarizes the sentence.'
|
|
295
|
+
* },
|
|
296
|
+
* // ...
|
|
297
|
+
* ]
|
|
298
|
+
* },
|
|
299
|
+
* ],
|
|
300
|
+
* // ...
|
|
301
|
+
* }
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
extraCommandGroups?: Array<GroupDefinition>;
|
|
305
|
+
/**
|
|
306
|
+
* A list of ids of AI commands to be removed.
|
|
307
|
+
*
|
|
308
|
+
* Learn more about {@link module:ai/aiassistant~CommandDefinition command definition and its id}.
|
|
309
|
+
*
|
|
310
|
+
* An example configuration:
|
|
311
|
+
*
|
|
312
|
+
* ```json
|
|
313
|
+
* {
|
|
314
|
+
* aiAssistant: {
|
|
315
|
+
* removeCommands: [
|
|
316
|
+
* 'improveWriting',
|
|
317
|
+
* // ...
|
|
318
|
+
* ],
|
|
319
|
+
* // ...
|
|
320
|
+
* }
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
removeCommands?: Array<string>;
|
|
324
|
+
/**
|
|
325
|
+
* Defines a CSS class name added to the AI assistant UI that allows for CSS customization.
|
|
326
|
+
*
|
|
327
|
+
* Setting this property to `false` disables the CSS class.
|
|
328
|
+
*
|
|
329
|
+
* @default 'ck-ai-assistant-ui'
|
|
330
|
+
*/
|
|
331
|
+
uiCssClass?: string | false;
|
|
332
|
+
/**
|
|
333
|
+
* An additional CSS class name (or names) added to the AI assistant content area (model response area).
|
|
334
|
+
*
|
|
335
|
+
* Because the content area is usually detached from the flow of the document, this configuration
|
|
336
|
+
* allows for better integration with application's stylesheets and improves the consistency of content
|
|
337
|
+
* styles.
|
|
338
|
+
*/
|
|
339
|
+
contentAreaCssClass?: string;
|
|
340
|
+
/**
|
|
341
|
+
* Additional configuration parameters for the AI request. Use it to customize how the AI service generates responses.
|
|
342
|
+
*
|
|
343
|
+
* See [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat/create) to learn more.
|
|
344
|
+
*
|
|
345
|
+
* Defaults to:
|
|
346
|
+
*
|
|
347
|
+
* ```json
|
|
348
|
+
* {
|
|
349
|
+
* model: 'gpt-3.5-turbo',
|
|
350
|
+
* max_tokens: 2000,
|
|
351
|
+
* temperature: 1,
|
|
352
|
+
* top_p: 1
|
|
353
|
+
* }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
requestParameters?: RequestParameters;
|
|
357
|
+
/**
|
|
358
|
+
* The AI assistant feature will be disabled if the document selection includes any of these elements.
|
|
359
|
+
*
|
|
360
|
+
* Use this property if AI assistant does not work properly with your custom features.
|
|
361
|
+
*
|
|
362
|
+
* Currently, by default, AI assistant is disabled for following model elements:
|
|
363
|
+
*
|
|
364
|
+
* * Media embed (`'media'`) -- does not display in response area,
|
|
365
|
+
* * HTML embed (`'rawHtml'`) -- sometimes does not display in response area, security uncertainty,
|
|
366
|
+
* * Table of contents (`'tableOfContents'`) -- does not display properly in response area, long processing time.
|
|
367
|
+
*
|
|
368
|
+
* You can set this list to include more model elements or clear it to enable the above features.
|
|
369
|
+
*
|
|
370
|
+
* Note, that all or some of these features may become enabled in the future.
|
|
371
|
+
*
|
|
372
|
+
* @default [ 'media', 'rawHtml', 'tableOfContents' ]
|
|
373
|
+
*/
|
|
374
|
+
disabledElements?: Array<string>;
|
|
375
|
+
}
|
|
376
|
+
export type GroupDefinition = {
|
|
377
|
+
/**
|
|
378
|
+
* The unique identifier of the group. It can be referenced while extending existing groups
|
|
379
|
+
* using {@link module:ai/aiassistant~AIAssistantConfig#extraCommandGroups}.
|
|
380
|
+
*/
|
|
381
|
+
groupId: string;
|
|
382
|
+
/**
|
|
383
|
+
* The human-readable label of the group.
|
|
384
|
+
*/
|
|
385
|
+
groupLabel?: string;
|
|
386
|
+
/**
|
|
387
|
+
* The array of command definitions that belong to the group.
|
|
388
|
+
*/
|
|
389
|
+
commands: Array<CommandDefinition>;
|
|
390
|
+
};
|
|
391
|
+
export type CommandDefinition = {
|
|
392
|
+
/**
|
|
393
|
+
* The unique identifier of the command. It can be referenced while removing commands. See
|
|
394
|
+
* {@link module:ai/aiassistant~AIAssistantConfig#removeCommands} to learn more.
|
|
395
|
+
*/
|
|
396
|
+
id: string;
|
|
397
|
+
/**
|
|
398
|
+
* The human-readable label of the command.
|
|
399
|
+
*/
|
|
400
|
+
label: string;
|
|
401
|
+
/**
|
|
402
|
+
* The instruction that will be passed to the AI model.
|
|
403
|
+
*
|
|
404
|
+
* It is wrapped in a "full prompt template" for better results.
|
|
405
|
+
*/
|
|
406
|
+
prompt: string;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* OpenAI request parameters that will influence how the response is generated.
|
|
410
|
+
*
|
|
411
|
+
* See OpenAI API reference to learn more.
|
|
412
|
+
*/
|
|
413
|
+
export type RequestParameters = {
|
|
414
|
+
model?: string;
|
|
415
|
+
max_tokens?: number;
|
|
416
|
+
temperature?: number;
|
|
417
|
+
top_p?: number;
|
|
418
|
+
user?: string;
|
|
419
|
+
};
|
package/src/aiassistant.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{CKEditorError as _0x32210c}from'ckeditor5/src/utils';import{Plugin as _0x314279}from'ckeditor5/src/core';import _0x4c39e1 from'./aiassistantui';import _0x4591f0 from'./aiassistantediting';import _0x125c00 from'./aiconnector';export default class s extends _0x314279{static get['requires'](){return[_0x4c39e1,_0x4591f0,_0x125c00];}static get['pluginName'](){return'AIAssistant';}constructor(_0x108e84){super(_0x108e84);const _0x21d9e0=_0x108e84['config'],_0x18dc3b=_0x108e84['locale']['t'];var t;_0x21d9e0['define']('aiAssistant.commands',[{'groupId':'editOrReview','groupLabel':(t=_0x18dc3b)('Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':t('Improve\x20writing'),'prompt':'Rewrite\x20this\x20content\x20with\x20no\x20spelling\x20mistakes,\x20proper\x20grammar,\x20and\x20with\x20more\x20descriptive\x20language,\x20using\x20best\x20writing\x20practices\x20without\x20losing\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':t('Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':t('Make\x20longer'),'prompt':'Expand\x20upon\x20this\x20content\x20with\x20descriptive\x20language\x20and\x20more\x20detailed\x20explanations,\x20to\x20make\x20the\x20writing\x20easier\x20to\x20understand\x20and\x20increase\x20the\x20length\x20of\x20the\x20content.'},{'id':'simplifyLanguage','label':t('Simplify\x20language'),'prompt':'Rewrite\x20this\x20content\x20with\x20simplified\x20language\x20and\x20reduce\x20the\x20complexity\x20of\x20the\x20writing,\x20so\x20that\x20the\x20content\x20is\x20easier\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':t('Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':t('Summarize'),'prompt':'Provide\x20the\x20key\x20points\x20and\x20concepts\x20in\x20this\x20content\x20in\x20a\x20succinct\x20summary.'},{'id':'explain','label':t('Explain'),'prompt':'Explain\x20this\x20text.'},{'id':'continue','label':t('Continue'),'prompt':'Continue\x20this\x20text.'}]},{'groupId':'changeTone','groupLabel':t('Change\x20tone'),'commands':[{'id':'professional','label':t('Professional'),'prompt':'Rewrite\x20this\x20content\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':t('Casual'),'prompt':'Rewrite\x20this\x20content\x20with\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':t('Direct'),'prompt':'Rewrite\x20this\x20content\x20with\x20direct\x20language\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':t('Confident'),'prompt':'Rewrite\x20this\x20content\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':t('Friendly'),'prompt':'Rewrite\x20this\x20content\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':t('Change\x20style'),'commands':[{'id':'business','label':t('Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':t('Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':t('Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'medical','label':t('Medical'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20medical\x20professional\x20using\x20valid\x20medical\x20terminology.'},{'id':'poetic','label':t('Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]}]),_0x21d9e0['define']('aiAssistant.extraCommandGroups',[]),_0x21d9e0['define']('aiAssistant.removeCommands',[]);const _0x15d32a=_0x21d9e0['get']('aiAssistant.commands'),_0x353008=_0x21d9e0['get']('aiAssistant.extraCommandGroups'),_0x1af423=_0x21d9e0['get']('aiAssistant.removeCommands');_0x353008['forEach'](_0x525412=>{const _0x491138=_0x15d32a['find'](_0x5621b5=>_0x5621b5['groupId']===_0x525412['groupId']);_0x491138?_0x491138['commands']['concat'](_0x525412['commands']):_0x15d32a['push'](_0x525412);}),_0x15d32a['forEach'](_0x33c60b=>{_0x33c60b['commands']=_0x33c60b['commands']['filter'](_0x20bfe4=>!_0x1af423['includes'](_0x20bfe4['id']));}),_0x21d9e0['set']('aiAssistant.commands',_0x15d32a);}['init'](){const _0x4d4b3d=this['editor'];this['licenseKey']=_0x4d4b3d['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x12ec61;for(const _0x143b02 in _0x4d4b3d){const _0xfc11ba=_0x143b02,_0x413741=_0x4d4b3d[_0xfc11ba];if('aiLicenseKeyTrial'===_0x413741||'aiLicenseKeyInvalid'===_0x413741||'aiLicenseKeyValid'===_0x413741||'aiLicenseKeyTrialLimit:operations'===_0x413741){delete _0x4d4b3d[_0xfc11ba],_0x12ec61=_0x413741;break;}}if('aiLicenseKeyInvalid'===_0x12ec61)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x32210c('ai-invalid-license-key',null);if('aiLicenseKeyTrial'===_0x12ec61&&console['info']('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.'),'aiLicenseKeyTrialLimit:operations'===_0x12ec61)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x32210c('ai-trial-license-key-reached-limit-changes',null);'aiLicenseKeyValid'===_0x12ec61&&clearInterval(this['_licenseKeyCheckInterval']);},0x3e8);}}
|
|
23
|
+
const _0x1c9f=['casual','aiAssistant.removeCommands','aiLicenseKeyTrial','journalism','translate','Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.','makeLonger','Professional','legal','translatePortuguese','Translate\x20the\x20content\x20to\x20English\x20language.','Direct','Confident','destroy','direct','translateHindi','_licenseKeyCheckInterval','Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.','ai-invalid-license-key','AIAssistant','summarize','aiAssistant.commands','Journalism','Simplified\x20Chinese','includes','German','Arabic','Translate\x20the\x20content\x20to\x20Arabic\x20language.','commands','Translate\x20to\x20%0','Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.','makeShorter','push','Summarize','translateGerman','Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.','aiLicenseKeyValid','Translate\x20the\x20content\x20to\x20German\x20language.','config','changeStyle','aiLicenseKeyTrialLimit:operations','changeTone','Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.','Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.','filter','Business','Legal','editOrReview','Make\x20longer','locale','info','Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.','find','forEach','translateEnglish','Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.','Continue','aiLicenseKeyInvalid','Make\x20shorter','Translate\x20the\x20content\x20to\x20Spanish\x20language.','poetic','Translate\x20the\x20content\x20to\x20Hindi\x20language.','init','define','generate','get','requires','translateChinese','English','translateFrench','Generate\x20from\x20selection','Portuguese','Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.','simplifyLanguage','Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.','friendly','Translate','groupId','Friendly','Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.','Change\x20style','Improve\x20writing','business','Change\x20tone','Simplify\x20language','Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.','set','Edit\x20or\x20review','Spanish','translateArabic','improveWriting','Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.','concat','French','licenseKey','continue','Translate\x20the\x20content\x20to\x20Portuguese\x20language.','professional','Hindi','translateSpanish','Casual','Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'];(function(_0x54f87b,_0x1c9f3b){const _0x2a897e=function(_0x468bcb){while(--_0x468bcb){_0x54f87b['push'](_0x54f87b['shift']());}};_0x2a897e(++_0x1c9f3b);}(_0x1c9f,0x1c9));const _0x2a89=function(_0x54f87b,_0x1c9f3b){_0x54f87b=_0x54f87b-0x0;let _0x2a897e=_0x1c9f[_0x54f87b];return _0x2a897e;};import{CKEditorError as _0x348d4c}from'ckeditor5/src/utils';import{Plugin as _0x2f20af}from'ckeditor5/src/core';import _0xa04d44 from'./aiassistantui';import _0x272b3c from'./aiassistantediting';import _0x462e05 from'./aiconnector';import{getTranslation as _0x2f5da4}from'./utils/common-translations';export const getDefaultCommands=_0x2f04a4=>[{'groupId':_0x2a89('0x64'),'groupLabel':_0x2f5da4(_0x2f04a4,_0x2a89('0x26')),'commands':[{'id':_0x2a89('0x29'),'label':_0x2f5da4(_0x2f04a4,'Improve\x20writing'),'prompt':_0x2a89('0x19')},{'id':'makeShorter','label':_0x2f5da4(_0x2f04a4,_0x2a89('0x9')),'prompt':_0x2a89('0x24')},{'id':_0x2a89('0x3b'),'label':_0x2f5da4(_0x2f04a4,'Make\x20longer'),'prompt':_0x2a89('0x17')},{'id':'simplifyLanguage','label':_0x2f5da4(_0x2f04a4,'Simplify\x20language'),'prompt':_0x2a89('0x53')}]},{'groupId':_0x2a89('0xf'),'groupLabel':_0x2f5da4(_0x2f04a4,_0x2a89('0x15')),'commands':[{'id':_0x2a89('0x49'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x56')),'prompt':_0x2a89('0x6')},{'id':_0x2a89('0x2e'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x7')),'prompt':_0x2a89('0x2a')}]},{'groupId':_0x2a89('0x5e'),'groupLabel':_0x2f5da4(_0x2f04a4,'Change\x20tone'),'commands':[{'id':_0x2a89('0x30'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x3c')),'prompt':_0x2a89('0x58')},{'id':_0x2a89('0x35'),'label':_0x2f5da4(_0x2f04a4,'Casual'),'prompt':_0x2a89('0x1e')},{'id':_0x2a89('0x43'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x40')),'prompt':_0x2a89('0x3a')},{'id':'confident','label':_0x2f5da4(_0x2f04a4,_0x2a89('0x41')),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':_0x2a89('0x1a'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x1d')),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':_0x2a89('0x5c'),'groupLabel':_0x2f5da4(_0x2f04a4,_0x2a89('0x1f')),'commands':[{'id':_0x2a89('0x21'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x62')),'prompt':_0x2a89('0x46')},{'id':_0x2a89('0x3d'),'label':_0x2f5da4(_0x2f04a4,'Legal'),'prompt':_0x2a89('0x5f')},{'id':'journalism','label':_0x2f5da4(_0x2f04a4,_0x2a89('0x4b')),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':_0x2a89('0xb'),'label':_0x2f5da4(_0x2f04a4,'Poetic'),'prompt':_0x2a89('0x2')}]},{'groupId':_0x2a89('0x39'),'groupLabel':_0x2f5da4(_0x2f04a4,_0x2a89('0x1b')),'commands':[{'id':_0x2a89('0x5'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x52'),[_0x2f5da4(_0x2f04a4,_0x2a89('0x13'))]),'prompt':_0x2a89('0x3f')},{'id':_0x2a89('0x32'),'label':_0x2f5da4(_0x2f04a4,'Translate\x20to\x20%0',[_0x2f5da4(_0x2f04a4,_0x2a89('0x27'))]),'prompt':_0x2a89('0xa')},{'id':_0x2a89('0x3e'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x52'),[_0x2f5da4(_0x2f04a4,_0x2a89('0x16'))]),'prompt':_0x2a89('0x2f')},{'id':_0x2a89('0x57'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x52'),[_0x2f5da4(_0x2f04a4,_0x2a89('0x4e'))]),'prompt':_0x2a89('0x5a')},{'id':_0x2a89('0x14'),'label':_0x2f5da4(_0x2f04a4,'Translate\x20to\x20%0',[_0x2f5da4(_0x2f04a4,_0x2a89('0x2c'))]),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':_0x2a89('0x12'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x52'),[_0x2f5da4(_0x2f04a4,'Simplified\x20Chinese')]),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':_0x2f5da4(_0x2f04a4,_0x2a89('0x52'),[_0x2f5da4(_0x2f04a4,_0x2a89('0x31'))]),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':_0x2a89('0x28'),'label':_0x2f5da4(_0x2f04a4,_0x2a89('0x52'),[_0x2f5da4(_0x2f04a4,'Arabic')]),'prompt':_0x2a89('0x50')}]}];export default class l extends _0x2f20af{static get[_0x2a89('0x11')](){return[_0xa04d44,_0x272b3c,_0x462e05];}static get['pluginName'](){return _0x2a89('0x48');}constructor(_0x2413dc){super(_0x2413dc);const _0x3b2219=_0x2413dc[_0x2a89('0x5b')];var _0x14f71f;_0x3b2219['define']('aiAssistant.commands',(_0x14f71f=_0x2413dc[_0x2a89('0x0')],[{'groupId':'editOrReview','groupLabel':_0x2f5da4(_0x14f71f,_0x2a89('0x26')),'commands':[{'id':_0x2a89('0x29'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x20')),'prompt':_0x2a89('0x19')},{'id':_0x2a89('0x54'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x9')),'prompt':_0x2a89('0x24')},{'id':_0x2a89('0x3b'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x65')),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':_0x2a89('0x18'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x23')),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':_0x2a89('0xf'),'groupLabel':_0x2f5da4(_0x14f71f,_0x2a89('0x15')),'commands':[{'id':'summarize','label':_0x2f5da4(_0x14f71f,'Summarize'),'prompt':_0x2a89('0x6')},{'id':_0x2a89('0x2e'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x7')),'prompt':_0x2a89('0x2a')}]},{'groupId':'changeTone','groupLabel':_0x2f5da4(_0x14f71f,_0x2a89('0x22')),'commands':[{'id':_0x2a89('0x30'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x3c')),'prompt':_0x2a89('0x58')},{'id':_0x2a89('0x35'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x33')),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':_0x2a89('0x43'),'label':_0x2f5da4(_0x14f71f,'Direct'),'prompt':_0x2a89('0x3a')},{'id':'confident','label':_0x2f5da4(_0x14f71f,_0x2a89('0x41')),'prompt':_0x2a89('0x34')},{'id':'friendly','label':_0x2f5da4(_0x14f71f,_0x2a89('0x1d')),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':_0x2f5da4(_0x14f71f,_0x2a89('0x1f')),'commands':[{'id':_0x2a89('0x21'),'label':_0x2f5da4(_0x14f71f,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':_0x2f5da4(_0x14f71f,_0x2a89('0x63')),'prompt':_0x2a89('0x5f')},{'id':_0x2a89('0x38'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x4b')),'prompt':_0x2a89('0x60')},{'id':_0x2a89('0xb'),'label':_0x2f5da4(_0x14f71f,'Poetic'),'prompt':_0x2a89('0x2')}]},{'groupId':_0x2a89('0x39'),'groupLabel':_0x2f5da4(_0x14f71f,_0x2a89('0x1b')),'commands':[{'id':_0x2a89('0x5'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x52'),[_0x2f5da4(_0x14f71f,_0x2a89('0x13'))]),'prompt':_0x2a89('0x3f')},{'id':'translateSpanish','label':_0x2f5da4(_0x14f71f,_0x2a89('0x52'),[_0x2f5da4(_0x14f71f,'Spanish')]),'prompt':_0x2a89('0xa')},{'id':_0x2a89('0x3e'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x52'),[_0x2f5da4(_0x14f71f,_0x2a89('0x16'))]),'prompt':_0x2a89('0x2f')},{'id':'translateGerman','label':_0x2f5da4(_0x14f71f,_0x2a89('0x52'),[_0x2f5da4(_0x14f71f,_0x2a89('0x4e'))]),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':_0x2a89('0x14'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x52'),[_0x2f5da4(_0x14f71f,'French')]),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':_0x2a89('0x12'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x52'),[_0x2f5da4(_0x14f71f,_0x2a89('0x4c'))]),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':_0x2a89('0x44'),'label':_0x2f5da4(_0x14f71f,_0x2a89('0x52'),[_0x2f5da4(_0x14f71f,_0x2a89('0x31'))]),'prompt':_0x2a89('0xc')},{'id':_0x2a89('0x28'),'label':_0x2f5da4(_0x14f71f,'Translate\x20to\x20%0',[_0x2f5da4(_0x14f71f,_0x2a89('0x4f'))]),'prompt':_0x2a89('0x50')}]}])),_0x3b2219[_0x2a89('0xe')]('aiAssistant.extraCommandGroups',[]),_0x3b2219[_0x2a89('0xe')](_0x2a89('0x36'),[]);const _0x1e3d46=_0x3b2219[_0x2a89('0x10')](_0x2a89('0x4a')),_0x200d3b=_0x3b2219[_0x2a89('0x10')]('aiAssistant.extraCommandGroups'),_0x21b886=_0x3b2219[_0x2a89('0x10')](_0x2a89('0x36'));_0x200d3b[_0x2a89('0x4')](_0x3ebdbc=>{const _0x35cc5c=_0x1e3d46[_0x2a89('0x3')](_0x4d1f35=>_0x4d1f35[_0x2a89('0x1c')]===_0x3ebdbc[_0x2a89('0x1c')]);_0x35cc5c?_0x35cc5c[_0x2a89('0x51')]=_0x35cc5c[_0x2a89('0x51')][_0x2a89('0x2b')](_0x3ebdbc['commands']):_0x1e3d46[_0x2a89('0x55')](_0x3ebdbc);}),_0x1e3d46[_0x2a89('0x4')](_0xcb2cee=>{_0xcb2cee[_0x2a89('0x51')]=_0xcb2cee[_0x2a89('0x51')][_0x2a89('0x61')](_0x36cf93=>!_0x21b886[_0x2a89('0x4d')](_0x36cf93['id']));}),_0x3b2219[_0x2a89('0x25')]('aiAssistant.commands',_0x1e3d46);}[_0x2a89('0xd')](){const _0x279788=this['editor'];this[_0x2a89('0x2d')]=_0x279788['config'][_0x2a89('0x10')](_0x2a89('0x2d')),this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x35e190;for(const _0x4dc2cf in _0x279788){const _0x8eeec7=_0x4dc2cf,_0x5a0aa9=_0x279788[_0x8eeec7];if(_0x2a89('0x37')===_0x5a0aa9||_0x2a89('0x8')===_0x5a0aa9||_0x2a89('0x59')===_0x5a0aa9||_0x2a89('0x5d')===_0x5a0aa9){delete _0x279788[_0x8eeec7],_0x35e190=_0x5a0aa9;break;}}if(_0x2a89('0x8')===_0x35e190)throw clearInterval(this[_0x2a89('0x45')]),new _0x348d4c(_0x2a89('0x47'),null);if(_0x2a89('0x37')===_0x35e190&&console[_0x2a89('0x1')]('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.'),_0x2a89('0x5d')===_0x35e190)throw clearInterval(this[_0x2a89('0x45')]),new _0x348d4c('ai-trial-license-key-reached-limit-changes',null);_0x2a89('0x59')===_0x35e190&&clearInterval(this['_licenseKeyCheckInterval']);},0x3e8);}[_0x2a89('0x42')](){this['_licenseKeyCheckInterval']&&clearInterval(this[_0x2a89('0x45')]);}}
|