@ckeditor/ckeditor5-ai 48.0.0-alpha.1 → 48.0.0-alpha.10
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/LICENSE.md +0 -4
- package/dist/aiactions/aiactions.d.ts +1 -10
- package/dist/aiactions/model/aiactionsinteraction.d.ts +4 -0
- package/dist/aiassistant/adapters/awstextadapter.d.ts +15 -156
- package/dist/aiassistant/aiassistant.d.ts +2 -0
- package/dist/aichat/model/aichatcontext.d.ts +5 -5
- package/dist/aichat/ui/controls/aichatcontextitembuttonview.d.ts +1 -1
- package/dist/aichatshortcuts/aichatshortcuts.d.ts +7 -19
- package/dist/aicore/aiconnector.d.ts +1 -1
- package/dist/aicore/model/aicontext.d.ts +15 -36
- package/dist/aiquickactions/aiquickactions.d.ts +6 -15
- package/dist/aiquickactions/aiquickactionsui.d.ts +1 -9
- package/dist/index-editor.css +27 -14
- package/dist/index.css +27 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -5
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +12 -13
package/LICENSE.md
CHANGED
|
@@ -12,10 +12,6 @@ Sources of Intellectual Property Included in CKEditor 5
|
|
|
12
12
|
|
|
13
13
|
Where not otherwise indicated, all CKEditor 5 content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
|
|
14
14
|
|
|
15
|
-
The following libraries are included in CKEditor 5 under the [Apache-2.0 license](https://opensource.org/licenses/Apache-2.0):
|
|
16
|
-
|
|
17
|
-
* @aws-sdk/client-bedrock-runtime - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
18
|
-
|
|
19
15
|
The following libraries are included in CKEditor 5 under the [BSD-2-Clause license](https://opensource.org/licenses/BSD-2-Clause):
|
|
20
16
|
|
|
21
17
|
* domhandler - Copyright (c) Felix Böhm.
|
|
@@ -66,16 +66,7 @@ export declare class AIActions extends Plugin {
|
|
|
66
66
|
destroy(): Promise<void>;
|
|
67
67
|
private _createInteraction;
|
|
68
68
|
}
|
|
69
|
-
export
|
|
70
|
-
CONTINUE = "continue",
|
|
71
|
-
FIX_GRAMMAR = "fix-grammar",
|
|
72
|
-
IMPROVE_WRITING = "improve-writing",
|
|
73
|
-
MAKE_LONGER = "make-longer",
|
|
74
|
-
MAKE_SHORTER = "make-shorter",
|
|
75
|
-
MAKE_TONE_CASUAL = "make-tone-casual",
|
|
76
|
-
MAKE_TONE_FORMAL = "make-tone-formal",
|
|
77
|
-
TRANSLATE = "translate"
|
|
78
|
-
}
|
|
69
|
+
export type AIActionsNames = 'continue' | 'fix-grammar' | 'improve-writing' | 'make-longer' | 'make-shorter' | 'make-tone-casual' | 'make-tone-formal' | 'translate';
|
|
79
70
|
/**
|
|
80
71
|
* Defines the parameters for an AI action executed via
|
|
81
72
|
* {@link module:ai/aiactions/aiactions~AIActions#executeAction `executeAction()`}.
|
|
@@ -36,6 +36,10 @@ export declare class AIActionsInteraction extends AIInteraction {
|
|
|
36
36
|
*/
|
|
37
37
|
readonly model?: string;
|
|
38
38
|
hasError: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Set when this interaction fires `interactionStopped` (see {@link module:ai/aicore/model/aiinteraction~AIInteraction#stop}).
|
|
41
|
+
*/
|
|
42
|
+
stoppedExplicitly: boolean;
|
|
39
43
|
constructor(options: AIActionsInteractionOptions);
|
|
40
44
|
sendRequest(): Promise<AIConnectorRequest>;
|
|
41
45
|
getDocumentContext(): AIContextItem | undefined;
|
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
* @module ai/aiassistant/adapters/awstextadapter
|
|
7
7
|
* @publicApi
|
|
8
8
|
*/
|
|
9
|
-
import { type Editor } from '@ckeditor/ckeditor5-core';
|
|
10
9
|
import { AITextAdapter, type AITextAdapterRequestData, type AIRequestHeaders, type AIRequestParameters } from './aitextadapter.js';
|
|
11
|
-
import { type BedrockRuntimeClientConfig } from '@aws-sdk/client-bedrock-runtime';
|
|
12
10
|
/**
|
|
13
11
|
* Adapter for AI text-related requests that supports the Amazon Bedrock service.
|
|
14
12
|
*
|
|
13
|
+
* **This adapter is no longer supported and will throw an error when used.**
|
|
14
|
+
* Please contact CKEditor support at https://support.ckeditor.com for more information about available AI adapters.
|
|
15
|
+
*
|
|
15
16
|
* See also {@link module:ai/aiassistant/adapters/aitextadapter~AITextAdapter}.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated
|
|
16
19
|
*/
|
|
17
20
|
export declare class AWSTextAdapter extends AITextAdapter {
|
|
18
21
|
/**
|
|
@@ -22,171 +25,27 @@ export declare class AWSTextAdapter extends AITextAdapter {
|
|
|
22
25
|
/**
|
|
23
26
|
* @inheritDoc
|
|
24
27
|
*/
|
|
25
|
-
|
|
28
|
+
init(): void;
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* If you want to extend this adapter, you can overload this method to do some additional processing or make an external call.
|
|
30
|
+
* Always throws an error as the AWS integration is no longer supported.
|
|
30
31
|
*/
|
|
31
|
-
sendRequest(
|
|
32
|
-
/**
|
|
33
|
-
* Prepares the actual full prompt for the request to the Amazon Bedrock API.
|
|
34
|
-
*
|
|
35
|
-
* The prompt may differ depending on what model is used.
|
|
36
|
-
*
|
|
37
|
-
* You can overload this method to customize the prompts that are sent to the AI service.
|
|
38
|
-
*
|
|
39
|
-
* @param query The user's query. The instruction which the model should perform.
|
|
40
|
-
* @param context The context for the instruction. Usually this will be a part of the editor content. Can be empty.
|
|
41
|
-
* @param model Model that is used to perform the request.
|
|
42
|
-
* @param actionId ID of the performed action.
|
|
43
|
-
* See {@link module:ai/aiassistant/adapters/aitextadapter~AITextAdapterRequestData#actionId}.
|
|
44
|
-
*/
|
|
45
|
-
preparePrompt(query: string, context: string, model: string, actionId: string): Promise<string>;
|
|
46
|
-
/**
|
|
47
|
-
* For a given model, it returns the family to which this model belongs.
|
|
48
|
-
*
|
|
49
|
-
* For example, for `anthropic.claude-instant-v1` it will return `anthropic.claude`.
|
|
50
|
-
*
|
|
51
|
-
* Throws {@link module:ai/aiassistant/adapters/aiadapter~AIRequestError `AIRequestError`} if a given model is not supported.
|
|
52
|
-
*/
|
|
53
|
-
getModelFamily(model: string): AIAWSModelFamily;
|
|
32
|
+
sendRequest(requestData: AITextAdapterRequestData): Promise<void>;
|
|
54
33
|
}
|
|
55
34
|
/**
|
|
56
35
|
* The configuration for the Amazon Bedrock adapter.
|
|
57
36
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* ```ts
|
|
61
|
-
* ClassicEditor
|
|
62
|
-
* .create( {
|
|
63
|
-
* ai: {
|
|
64
|
-
* assistant: {
|
|
65
|
-
* adapter: {
|
|
66
|
-
* aws: {
|
|
67
|
-
* apiUrl: 'https://url.to.your.application/ai'
|
|
68
|
-
* }
|
|
69
|
-
* }
|
|
70
|
-
* }
|
|
71
|
-
* }
|
|
72
|
-
* } )
|
|
73
|
-
* .then( ... )
|
|
74
|
-
* .catch( ... );
|
|
75
|
-
* ```
|
|
37
|
+
* **This adapter is no longer supported.**
|
|
38
|
+
* Please contact CKEditor support at https://support.ckeditor.com for more information about available AI adapters.
|
|
76
39
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
40
|
+
* @deprecated
|
|
80
41
|
*/
|
|
81
42
|
export interface AIAWSTextAdapterConfig {
|
|
82
|
-
/**
|
|
83
|
-
* The URL to which the AI service request will be sent.
|
|
84
|
-
*
|
|
85
|
-
* Set this value only if you want to connect to Amazon Bedrock using a proxy endpoint.
|
|
86
|
-
*
|
|
87
|
-
* If `apiUrl` is not provided, the AWS-SDK library will be used to process the request. It will set a proper URL on its own.
|
|
88
|
-
*/
|
|
89
43
|
apiUrl?: string;
|
|
90
|
-
/**
|
|
91
|
-
* An object with headers to set in the request to the AI service.
|
|
92
|
-
*
|
|
93
|
-
* **These headers are only used when connecting to AWS through the proxy endpoint (that is, when `apiUrl` is set).**
|
|
94
|
-
*
|
|
95
|
-
* Otherwise, the AWS-SDK library is used, and it sets the request headers on its own. In this mode, the request headers cannot be
|
|
96
|
-
* customized.
|
|
97
|
-
*
|
|
98
|
-
* If the provided value is an object, it is simply used as provided.
|
|
99
|
-
*
|
|
100
|
-
* ```js
|
|
101
|
-
* {
|
|
102
|
-
* ai: {
|
|
103
|
-
* assistant: {
|
|
104
|
-
* adapter: {
|
|
105
|
-
* aws: {
|
|
106
|
-
* requestHeaders: {
|
|
107
|
-
* 'Authorization': 'Bearer YOUR_API_KEY'
|
|
108
|
-
* }
|
|
109
|
-
* }
|
|
110
|
-
* // ...
|
|
111
|
-
* }
|
|
112
|
-
* }
|
|
113
|
-
* }
|
|
114
|
-
* }
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
|
-
* If the provided value is a function, it should be a function that returns a promise which resolves with the headers object.
|
|
118
|
-
* This way, you can perform an authorization request to your application and receive the authorization token (and also implement
|
|
119
|
-
* any custom logic on the backend side). The headers object is then used to make the actual call to the AI service.
|
|
120
|
-
*
|
|
121
|
-
* ```js
|
|
122
|
-
* {
|
|
123
|
-
* ai: {
|
|
124
|
-
* assistant: {
|
|
125
|
-
* adapter: {
|
|
126
|
-
* aws: {
|
|
127
|
-
* requestHeaders: async () => {
|
|
128
|
-
* const jwt = await fetch( 'https://example.com/jwt-endpoint' );
|
|
129
|
-
*
|
|
130
|
-
* return {
|
|
131
|
-
* 'Authorization': 'Bearer ' + jwt
|
|
132
|
-
* }
|
|
133
|
-
* }
|
|
134
|
-
* }
|
|
135
|
-
* // ...
|
|
136
|
-
* }
|
|
137
|
-
* }
|
|
138
|
-
* }
|
|
139
|
-
* }
|
|
140
|
-
* ```
|
|
141
|
-
*
|
|
142
|
-
* The function is passed the {@link module:ai/aiassistant/adapters/aitextadapter~AITextAdapterRequestData#actionId `actionId`}
|
|
143
|
-
* parameter to make it possible to further customize the headers.
|
|
144
|
-
*
|
|
145
|
-
* If the function fails for any reason, the promise should be rejected. In this case, a feature that made the request should display
|
|
146
|
-
* an error notification.
|
|
147
|
-
*/
|
|
148
44
|
requestHeaders?: AIRequestHeaders;
|
|
149
|
-
/**
|
|
150
|
-
* Additional configuration parameters for the AI service request. Use it to customize how the AI service generates responses.
|
|
151
|
-
* Note that the value you will set here will fully overwrite the default value.
|
|
152
|
-
*
|
|
153
|
-
* The exact configuration (available parameters) depends on the used model. Keep in mind that some properties are not supported by some
|
|
154
|
-
* models.
|
|
155
|
-
*
|
|
156
|
-
* See [AWS model parameters reference](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html) to learn more.
|
|
157
|
-
*
|
|
158
|
-
* If the provided value is an object, it is passed to the request as provided.
|
|
159
|
-
*
|
|
160
|
-
* If the provided value is a function, it should be a function that returns a promise which resolves with the request parameters
|
|
161
|
-
* object. This gives you more flexibility to provide parameters for the AI model.
|
|
162
|
-
*
|
|
163
|
-
* The function is passed the {@link module:ai/aiassistant/adapters/aitextadapter~AITextAdapterRequestData#actionId `actionId`}
|
|
164
|
-
* parameter to make it possible to further customize the parameters.
|
|
165
|
-
*
|
|
166
|
-
* If the function fails for any reason, the promise should be rejected. In this case, the feature that made the request should display
|
|
167
|
-
* an error notification.
|
|
168
|
-
*
|
|
169
|
-
* Defaults to:
|
|
170
|
-
*
|
|
171
|
-
* ```json
|
|
172
|
-
* {
|
|
173
|
-
* model: 'anthropic.claude-v2',
|
|
174
|
-
* max_tokens_to_sample: 500,
|
|
175
|
-
* temperature: 1,
|
|
176
|
-
* top_k: 250,
|
|
177
|
-
* top_p: 1,
|
|
178
|
-
* anthropic_version: 'bedrock-2023-05-31',
|
|
179
|
-
* stream: true
|
|
180
|
-
* }
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
45
|
requestParameters?: AIRequestParameters;
|
|
184
|
-
|
|
185
|
-
* The configuration for AWS-SDK Bedrock Runtime Client.
|
|
186
|
-
*
|
|
187
|
-
* If `apiUrl` is not provided, this configuration will be used to initialize the Bedrock Runtime Client which will be used to process
|
|
188
|
-
* the requests. The adapter will make requests directly to the Amazon Bedrock service.
|
|
189
|
-
*/
|
|
190
|
-
bedrockClientConfig?: BedrockRuntimeClientConfig;
|
|
46
|
+
bedrockClientConfig?: unknown;
|
|
191
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated
|
|
50
|
+
*/
|
|
192
51
|
export type AIAWSModelFamily = 'anthropic.claude' | 'ai21.j2' | 'cohere.command' | 'meta.llama';
|
|
@@ -379,6 +379,8 @@ export interface AIAssistantConfig {
|
|
|
379
379
|
* This is required only if you connect to Amazon Bedrock service.
|
|
380
380
|
*
|
|
381
381
|
* Read more in {@link module:ai/aiassistant/adapters/awstextadapter~AIAWSTextAdapterConfig}.
|
|
382
|
+
*
|
|
383
|
+
* @deprecated
|
|
382
384
|
*/
|
|
383
385
|
aws?: AIAWSTextAdapterConfig;
|
|
384
386
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { type AIConnector, type AIUserMessage } from '../../aicore/aiconnector.js';
|
|
6
|
-
import { AIContextItemType, AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIToolContextItem } from '../../aicore/model/aicontext.js';
|
|
6
|
+
import { type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIToolContextItem } from '../../aicore/model/aicontext.js';
|
|
7
7
|
export declare const AI_CONTEXT_MODEL_EVENT_NAMES: readonly ["contextItemAdded", "contextItemRemoved", "contextItemLoadingEnded", "contextSent", "error", "addContextOptionsChanged", "sourceResourcesLoaded", "resourceStateChanged", "uploadProgressChanged"];
|
|
8
8
|
declare const AIChatContext_base: {
|
|
9
9
|
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
@@ -118,13 +118,13 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
|
|
|
118
118
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
119
119
|
* @param files Array of File objects to upload and add to context
|
|
120
120
|
* @param [attributes] Optional attributes object containing resourceId and label for tracking purposes and context chips
|
|
121
|
-
* @param [type] Context item type, defaults to
|
|
121
|
+
* @param [type] Context item type, defaults to 'file' to indicate that the file is being added as a file or text
|
|
122
122
|
* @returns Promise that resolves when all files are processed
|
|
123
123
|
*/
|
|
124
124
|
addFilesToContext(files: Array<File>, attributes?: {
|
|
125
125
|
resourceId: string;
|
|
126
126
|
label: string;
|
|
127
|
-
}, type?:
|
|
127
|
+
}, type?: 'file' | 'text'): Promise<void>;
|
|
128
128
|
/**
|
|
129
129
|
* Adds the current document to the pending context.
|
|
130
130
|
* If the document is already in context, this method returns early without changes.
|
|
@@ -181,8 +181,8 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
|
|
|
181
181
|
* The object which is passed as a parameter can contain the following properties:
|
|
182
182
|
* ```ts
|
|
183
183
|
* {
|
|
184
|
-
* // Must be set to `
|
|
185
|
-
* type:
|
|
184
|
+
* // Must be set to `'mcp-tool-context'`.
|
|
185
|
+
* type: 'mcp-tool-context',
|
|
186
186
|
*
|
|
187
187
|
* // The name of the MCP server.
|
|
188
188
|
* mcpServerName: string;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ButtonView } from '@ckeditor/ckeditor5-ui';
|
|
9
9
|
import { type Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
-
import type
|
|
10
|
+
import { type AIContextItem } from '../../../aicore/model/aicontext.js';
|
|
11
11
|
/**
|
|
12
12
|
* A button view representing a context item in the AI chat interface.
|
|
13
13
|
*
|
|
@@ -11,21 +11,13 @@ import { ContextPlugin } from '@ckeditor/ckeditor5-core';
|
|
|
11
11
|
import '../../theme/aichatshortcuts/aichatshortcuts.css';
|
|
12
12
|
/**
|
|
13
13
|
* The type of the shortcut.
|
|
14
|
+
*
|
|
15
|
+
* Available types:
|
|
16
|
+
* * `'chat'`: a shortcut that interacts with AI Chat,
|
|
17
|
+
* * `'review'`: a shortcut that interacts with AI Review,
|
|
18
|
+
* * `'translate'`: a shortcut that interacts with AI Translate.
|
|
14
19
|
*/
|
|
15
|
-
export
|
|
16
|
-
/**
|
|
17
|
-
* A shortcut that interacts with the AI Chat.
|
|
18
|
-
*/
|
|
19
|
-
CHAT = "chat",
|
|
20
|
-
/**
|
|
21
|
-
* A shortcut that interacts with the AI Review.
|
|
22
|
-
*/
|
|
23
|
-
REVIEW = "review",
|
|
24
|
-
/**
|
|
25
|
-
* A shortcut that interacts with the AI Translate.
|
|
26
|
-
*/
|
|
27
|
-
TRANSLATE = "translate"
|
|
28
|
-
}
|
|
20
|
+
export type AIChatShortcutType = 'chat' | 'review' | 'translate';
|
|
29
21
|
/**
|
|
30
22
|
* The plugin that displays a list of handy, configurable shortcuts in the {@link module:ai/aichat/aichat~AIChat AI Chat} feed
|
|
31
23
|
* upon opening a new conversation.
|
|
@@ -85,10 +77,6 @@ declare module '../aichat/aichat.js' {
|
|
|
85
77
|
* * {@link module:ai/aichatshortcuts/aichatshortcuts~AIChatShortcutTranslateDefinition Translate shortcuts}.
|
|
86
78
|
*/
|
|
87
79
|
export type AIChatShortcutDefinition = AIChatShortcutChatDefinition | AIChatShortcutReviewDefinition | AIChatShortcutTranslateDefinition;
|
|
88
|
-
/**
|
|
89
|
-
* Values for all available shortcut types.
|
|
90
|
-
*/
|
|
91
|
-
export type AIChatShortcutTypeValue = `${AIChatShortcutType}`;
|
|
92
80
|
/**
|
|
93
81
|
* The base definition for all shortcut types.
|
|
94
82
|
*/
|
|
@@ -104,7 +92,7 @@ export interface AIChatShortcutBaseDefinition {
|
|
|
104
92
|
/**
|
|
105
93
|
* The type of the shortcut.
|
|
106
94
|
*/
|
|
107
|
-
readonly type:
|
|
95
|
+
readonly type: AIChatShortcutType;
|
|
108
96
|
/**
|
|
109
97
|
* The icon of the shortcut in SVG string format.
|
|
110
98
|
*
|
|
@@ -6,7 +6,7 @@ import { type Editor, type Context, ContextPlugin } from '@ckeditor/ckeditor5-co
|
|
|
6
6
|
import { CloudServices } from '@ckeditor/ckeditor5-cloud-services';
|
|
7
7
|
import { type AIContextItemRequestData, type AIContextItemType } from './model/aicontext.js';
|
|
8
8
|
import { type AICapabilitiesRequestData } from './model/aicapabilities.js';
|
|
9
|
-
import {
|
|
9
|
+
import type { AIActionsNames } from '../aiactions/aiactions.js';
|
|
10
10
|
/**
|
|
11
11
|
* A plugin that handles communication with the AI API.
|
|
12
12
|
*/
|
|
@@ -8,44 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* The type of context item.
|
|
11
|
+
*
|
|
12
|
+
* Available types:
|
|
13
|
+
* * `'mcp-tool-context'`: a tool-related context item,
|
|
14
|
+
* * `'file'`: a file (PDF, Word document, etc.),
|
|
15
|
+
* * `'document'`: a current editor document
|
|
16
|
+
* (used by {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document `config.ai.chat.context.document` option}),
|
|
17
|
+
* * `'web-resource'`: a URL (web page, blog post, etc.),
|
|
18
|
+
* * `'text'`: a text (plain text, Markdown, HTML, etc.),
|
|
19
|
+
* * `'selection'`: a selection of text in the editor
|
|
20
|
+
* (used by {@link module:ai/aiquickactions/aiquickactions~AIQuickActions AI Quick Actions} that pass the user selection
|
|
21
|
+
* to the {@link module:ai/aichat/aichat~AIChat AI Chat}).
|
|
11
22
|
*/
|
|
12
|
-
export
|
|
13
|
-
/**
|
|
14
|
-
* A tool-related context item.
|
|
15
|
-
*/
|
|
16
|
-
TOOL = "mcp-tool-context",
|
|
17
|
-
/**
|
|
18
|
-
* A file (PDF, Word document, etc.).
|
|
19
|
-
*/
|
|
20
|
-
FILE = "file",
|
|
21
|
-
/**
|
|
22
|
-
* The current editor document (used by
|
|
23
|
-
* {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document `config.ai.chat.context.document` option}).
|
|
24
|
-
*/
|
|
25
|
-
DOCUMENT = "document",
|
|
26
|
-
/**
|
|
27
|
-
* A URL (web page, blog post, etc.).
|
|
28
|
-
*/
|
|
29
|
-
URL = "web-resource",
|
|
30
|
-
/**
|
|
31
|
-
* A text (plain text, Markdown, HTML, etc.).
|
|
32
|
-
*/
|
|
33
|
-
TEXT = "text",
|
|
34
|
-
/**
|
|
35
|
-
* A selection of text in the editor (used by
|
|
36
|
-
* {@link module:ai/aiquickactions/aiquickactions~AIQuickActions AI Quick Actions} that pass the user selection
|
|
37
|
-
* to the {@link module:ai/aichat/aichat~AIChat AI Chat}).
|
|
38
|
-
*/
|
|
39
|
-
SELECTION = "selection"
|
|
40
|
-
}
|
|
23
|
+
export type AIContextItemType = 'mcp-tool-context' | 'file' | 'document' | 'web-resource' | 'text' | 'selection';
|
|
41
24
|
/**
|
|
42
25
|
* The type of text resource.
|
|
43
26
|
*/
|
|
44
|
-
export
|
|
45
|
-
TEXT = "text",
|
|
46
|
-
MARKDOWN = "markdown",
|
|
47
|
-
HTML = "html"
|
|
48
|
-
}
|
|
27
|
+
export type AIContextTextResourceType = 'text' | 'markdown' | 'html';
|
|
49
28
|
/**
|
|
50
29
|
* A context item.
|
|
51
30
|
*/
|
|
@@ -66,7 +45,7 @@ export type AIContextItem = AIContextItemRequestData & {
|
|
|
66
45
|
* A tool-related context item.
|
|
67
46
|
*/
|
|
68
47
|
export type AIToolContextItem = AIContextItem & {
|
|
69
|
-
type:
|
|
48
|
+
type: 'mcp-tool-context';
|
|
70
49
|
mcpServerName: string;
|
|
71
50
|
toolName?: string;
|
|
72
51
|
data: Record<string, any>;
|
|
@@ -88,7 +67,7 @@ export type AIContextItemRequestData = {
|
|
|
88
67
|
}>;
|
|
89
68
|
};
|
|
90
69
|
export type AIToolRequestData = {
|
|
91
|
-
type:
|
|
70
|
+
type: 'mcp-tool-context';
|
|
92
71
|
mcpServerName: string;
|
|
93
72
|
toolName?: string;
|
|
94
73
|
data: Record<string, any>;
|
|
@@ -193,21 +193,12 @@ export type AIQuickActionCustomDefinition = AIQuickActionCustomActionDefinition
|
|
|
193
193
|
/**
|
|
194
194
|
* Defines the different types of AI quick actions available in the editor.
|
|
195
195
|
* Each type determines how the action will be presented and executed.
|
|
196
|
+
*
|
|
197
|
+
* Available types:
|
|
198
|
+
* * `'action'`: display results in a balloon popup for quick inline operations,
|
|
199
|
+
* * `'chat'`: opens the AI Chat interface for interactive conversations.
|
|
196
200
|
*/
|
|
197
|
-
export
|
|
198
|
-
/**
|
|
199
|
-
* Actions that open the AI Chat interface for interactive conversations.
|
|
200
|
-
*/
|
|
201
|
-
CHAT = "chat",
|
|
202
|
-
/**
|
|
203
|
-
* Actions that display results in a balloon popup for quick inline operations.
|
|
204
|
-
*/
|
|
205
|
-
ACTION = "action"
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Values for all available action types.
|
|
209
|
-
*/
|
|
210
|
-
export type AIQuickActionTypeValue = `${AIQuickActionType}`;
|
|
201
|
+
export type AIQuickActionType = 'chat' | 'action';
|
|
211
202
|
/**
|
|
212
203
|
* The base definition for all action types.
|
|
213
204
|
*/
|
|
@@ -223,7 +214,7 @@ export interface AIQuickActionCustomBaseDefinition {
|
|
|
223
214
|
/**
|
|
224
215
|
* The type of the action.
|
|
225
216
|
*/
|
|
226
|
-
readonly type:
|
|
217
|
+
readonly type: AIQuickActionType;
|
|
227
218
|
/**
|
|
228
219
|
* The prompt to be sent to the AI model when the action is executed.
|
|
229
220
|
*/
|
|
@@ -9,15 +9,7 @@ import { AIConnector } from '../aicore/aiconnector.js';
|
|
|
9
9
|
import '../../theme/common/aibutton.css';
|
|
10
10
|
import '../../theme/common/aicolor.css';
|
|
11
11
|
import '../../theme/aiquickactions/aiquickactions.css';
|
|
12
|
-
import { AIQuickActionType } from './aiquickactions.js';
|
|
13
|
-
/**
|
|
14
|
-
* Maps AI quick action types to their corresponding CKEditor plugin names.
|
|
15
|
-
* Used for checking plugin availability and determining which actions to display.
|
|
16
|
-
*/
|
|
17
|
-
export declare enum AIQuickActionTypeToPluginName {
|
|
18
|
-
chat = "AIChat",
|
|
19
|
-
action = "AIActions"
|
|
20
|
-
}
|
|
12
|
+
import { type AIQuickActionType } from './aiquickactions.js';
|
|
21
13
|
/**
|
|
22
14
|
* UI plugin for AI Quick Actions that provides a set of predefined AI-powered tools.
|
|
23
15
|
*
|
package/dist/index-editor.css
CHANGED
|
@@ -831,7 +831,7 @@
|
|
|
831
831
|
}
|
|
832
832
|
|
|
833
833
|
.ck.ck-ai-chat__feed .ck.ck-ai-chat__feed__item.ck-ai-chat__feed__ai-suggestion .ck-ai-chat__feed__ai-suggestion__actions{
|
|
834
|
-
--ck-
|
|
834
|
+
--ck-rounded-corners-radius:2px;
|
|
835
835
|
gap:var(--ck-spacing-standard);
|
|
836
836
|
flex-direction:row;
|
|
837
837
|
width:fit-content;
|
|
@@ -845,7 +845,6 @@
|
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
.ck.ck-ai-chat__feed .ck.ck-ai-chat__feed__item.ck-ai-chat__feed__ai-suggestion .ck-ai-chat__feed__ai-suggestion__actions .ck-ai-chat__feed__suggestion__actions__info > p button{
|
|
848
|
-
padding-left:.5em;
|
|
849
848
|
font-size:.8em;
|
|
850
849
|
}
|
|
851
850
|
|
|
@@ -1390,7 +1389,7 @@
|
|
|
1390
1389
|
--ck-ui-component-min-height:1em;
|
|
1391
1390
|
max-width:var(--ck-ui-component-min-height);
|
|
1392
1391
|
max-height:var(--ck-ui-component-min-height);
|
|
1393
|
-
padding:
|
|
1392
|
+
padding:0;
|
|
1394
1393
|
}
|
|
1395
1394
|
|
|
1396
1395
|
:is(.ck.ck-balloon-panel, .ck.ck-ai-chat) .ck-ai-chat-context-chip .ck-button > .ck-icon{
|
|
@@ -1777,6 +1776,13 @@
|
|
|
1777
1776
|
display:flex;
|
|
1778
1777
|
}
|
|
1779
1778
|
|
|
1779
|
+
:root{
|
|
1780
|
+
--ck-color-ai-suggestion-content-part-toolbar-button-text-active:var(--ck-color-ai-button-secondary-text);
|
|
1781
|
+
--ck-color-ai-suggestion-content-part-toolbar-button-text-hover:var(--ck-color-ai-button-secondary-text);
|
|
1782
|
+
--ck-color-ai-suggestion-content-part-toolbar-button-background-active:var(--ck-color-ai-button-secondary-background-active);
|
|
1783
|
+
--ck-color-ai-suggestion-content-part-toolbar-button-background-hover:var(--ck-color-ai-button-secondary-background-hover);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1780
1786
|
.ck.ck-toolbar.ck-ai-suggestion-content-part-toolbar{
|
|
1781
1787
|
--ck-icon-size:1.477em;
|
|
1782
1788
|
border:0;
|
|
@@ -1793,9 +1799,21 @@
|
|
|
1793
1799
|
margin:0;
|
|
1794
1800
|
}
|
|
1795
1801
|
|
|
1802
|
+
.ck.ck-toolbar.ck-ai-suggestion-content-part-toolbar .ck-button:active{
|
|
1803
|
+
background-color:var(--ck-color-ai-suggestion-content-part-toolbar-button-background-active);
|
|
1804
|
+
color:var(--ck-color-ai-suggestion-content-part-toolbar-button-text-active);
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1796
1807
|
.ck.ck-toolbar.ck-ai-suggestion-content-part-toolbar .ck-button:hover{
|
|
1797
|
-
background-color:var(--ck-color-ai-button-
|
|
1798
|
-
color:var(--ck-color-ai-
|
|
1808
|
+
background-color:var(--ck-color-ai-suggestion-content-part-toolbar-button-background-hover);
|
|
1809
|
+
color:var(--ck-color-ai-suggestion-content-part-toolbar-button-text-hover);
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
.ck-ai-suggestion-content-part-disabled-actions-tooltip .ck-tooltip__text{
|
|
1813
|
+
white-space:break-spaces;
|
|
1814
|
+
width:250px;
|
|
1815
|
+
padding:var(--ck-tooltip-text-padding) 0;
|
|
1816
|
+
display:inline-block;
|
|
1799
1817
|
}
|
|
1800
1818
|
|
|
1801
1819
|
div.ck.ck-ai-suggestion__content-part-state .ck-ai-suggestion__content-part-state__label{
|
|
@@ -2363,7 +2381,6 @@ div.ck.ck-ai-suggestion__content-part-state.ck-ai-suggestion__content-part-state
|
|
|
2363
2381
|
}
|
|
2364
2382
|
|
|
2365
2383
|
.ck.ck-ai-mini-toolbar .ck.ck-button{
|
|
2366
|
-
color:var(--ck-color-ai-chat-icon);
|
|
2367
2384
|
font-size:.9em;
|
|
2368
2385
|
}
|
|
2369
2386
|
|
|
@@ -2505,6 +2522,7 @@ div.ck.ck-ai-suggestion__content-part-state.ck-ai-suggestion__content-part-state
|
|
|
2505
2522
|
word-break:normal;
|
|
2506
2523
|
text-wrap:auto;
|
|
2507
2524
|
padding:var(--ck-spacing-large);
|
|
2525
|
+
box-sizing:border-box;
|
|
2508
2526
|
height:100%;
|
|
2509
2527
|
overflow-y:auto;
|
|
2510
2528
|
}
|
|
@@ -2801,6 +2819,9 @@ div.ck.ck-ai-suggestion__content-part-state.ck-ai-suggestion__content-part-state
|
|
|
2801
2819
|
.ck.ck-button.ck-ai-button-secondary:disabled, .ck.ck-button.ck-ai-button-secondary.ck-disabled{
|
|
2802
2820
|
color:var(--ck-color-ai-button-secondary-text-disabled);
|
|
2803
2821
|
background-color:var(--ck-color-ai-button-secondary-background-disabled);
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
:is(.ck.ck-button.ck-ai-button-secondary:disabled, .ck.ck-button.ck-ai-button-secondary.ck-disabled):not(:focus){
|
|
2804
2825
|
border:1px solid var(--ck-color-ai-button-secondary-border-disabled);
|
|
2805
2826
|
}
|
|
2806
2827
|
|
|
@@ -3216,10 +3237,6 @@ div.ck.ck-ai-suggestion__content-part-state.ck-ai-suggestion__content-part-state
|
|
|
3216
3237
|
display:flex;
|
|
3217
3238
|
}
|
|
3218
3239
|
|
|
3219
|
-
.ck.ck-ai-review .ck-ai_review__check-run .ck-ai_review__check-run-results-header .ck-ai_review__check-run-results-header-buttons .ck-ai_review__check-run-accept-all-button{
|
|
3220
|
-
border:none;
|
|
3221
|
-
}
|
|
3222
|
-
|
|
3223
3240
|
.ck.ck-ai-review .ck-ai_review__check-run .ck-ai_review__check-run-results-wrapper{
|
|
3224
3241
|
height:100%;
|
|
3225
3242
|
position:relative;
|
|
@@ -3686,10 +3703,6 @@ div.ck.ck-ai-suggestion__content-part-state.ck-ai-suggestion__content-part-state
|
|
|
3686
3703
|
height:auto;
|
|
3687
3704
|
}
|
|
3688
3705
|
|
|
3689
|
-
.ck .ck-ai-review.ck-ai-translate-mode .ck-ai_review__check-run .ck-ai_review__check-run-results-header .ck-ai_review__check-run-results-header-buttons .ck-ai_review__check-run-accept-all-button{
|
|
3690
|
-
border:none;
|
|
3691
|
-
}
|
|
3692
|
-
|
|
3693
3706
|
.ck .ck-ai-review.ck-ai-translate-mode .ck-ai_review__check-run .ck-ai_review__check-run-results-header .ck-ai_review__check-run-results-header-buttons .ck-ai_review__check-run-toggle-diff-button{
|
|
3694
3707
|
visibility:hidden;
|
|
3695
3708
|
display:none;
|