@lofcz/platejs-ai 52.3.2
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 +24 -0
- package/README.md +7 -0
- package/dist/getEditorPrompt-BnVrgUl3.js +103 -0
- package/dist/getEditorPrompt-BnVrgUl3.js.map +1 -0
- package/dist/index-B_bqJoKL.d.ts +85 -0
- package/dist/index-B_bqJoKL.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +409 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +1409 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { c as AIMode, d as BaseAIPluginConfig, i as EditorPrompt, l as AIToolName } from "../index-B_bqJoKL";
|
|
2
|
+
import { Descendant, EditorNodesOptions, ExtendConfig, NodeEntry, OmitFirst, Path, PluginConfig, Range, RemoveNodesOptions, SlateEditor, TElement as TElement$1, TIdElement, TRange, TTableElement, TText } from "platejs";
|
|
3
|
+
import { DeserializeMdOptions, SerializeMdOptions } from "@platejs/markdown";
|
|
4
|
+
import { OverrideEditor, PlateEditor, RenderNodeWrapperProps } from "platejs/react";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { ChatRequestOptions, UIMessage } from "ai";
|
|
7
|
+
import { UseChatHelpers } from "@ai-sdk/react";
|
|
8
|
+
import { TriggerComboboxPluginOptions } from "@platejs/combobox";
|
|
9
|
+
|
|
10
|
+
//#region src/react/ai/AIPlugin.d.ts
|
|
11
|
+
type AIPluginConfig = ExtendConfig<BaseAIPluginConfig>;
|
|
12
|
+
declare const AIPlugin: any;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/react/ai-chat/internal/types.d.ts
|
|
15
|
+
type ToolName = 'comment' | 'edit' | 'generate';
|
|
16
|
+
type TComment = {
|
|
17
|
+
blockId: string;
|
|
18
|
+
comment: string;
|
|
19
|
+
content: string;
|
|
20
|
+
};
|
|
21
|
+
type MessageDataPart = {
|
|
22
|
+
toolName: ToolName;
|
|
23
|
+
comment?: TComment;
|
|
24
|
+
};
|
|
25
|
+
type ChatMessage = UIMessage<{}, MessageDataPart>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/react/ai/utils/aiCommentToRange.d.ts
|
|
28
|
+
declare const aiCommentToRange: (editor: SlateEditor, aiComment: TComment) => Range | undefined;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/react/ai/utils/findTextRangeInBlock.d.ts
|
|
31
|
+
/** Find text within a block, supporting fuzzy matching. */
|
|
32
|
+
declare function findTextRangeInBlock({
|
|
33
|
+
block,
|
|
34
|
+
findText
|
|
35
|
+
}: {
|
|
36
|
+
block: NodeEntry;
|
|
37
|
+
findText: string;
|
|
38
|
+
}): Range | null;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/react/ai-chat/transforms/acceptAIChat.d.ts
|
|
41
|
+
declare const acceptAIChat: (editor: PlateEditor) => void;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/react/ai-chat/transforms/insertBelowAIChat.d.ts
|
|
44
|
+
declare const insertBelowAIChat: (editor: PlateEditor, sourceEditor: SlateEditor, {
|
|
45
|
+
format
|
|
46
|
+
}?: {
|
|
47
|
+
format?: "all" | "none" | "single";
|
|
48
|
+
}) => void;
|
|
49
|
+
declare const insertBelowGenerate: (editor: PlateEditor, sourceEditor: SlateEditor, {
|
|
50
|
+
format
|
|
51
|
+
}?: {
|
|
52
|
+
format?: "all" | "none" | "single";
|
|
53
|
+
}) => void;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/react/ai-chat/transforms/replaceSelectionAIChat.d.ts
|
|
56
|
+
declare const createFormattedBlocks: ({
|
|
57
|
+
blocks,
|
|
58
|
+
format,
|
|
59
|
+
sourceBlock
|
|
60
|
+
}: {
|
|
61
|
+
blocks: TElement$1[];
|
|
62
|
+
format: "all" | "none" | "single";
|
|
63
|
+
sourceBlock: NodeEntry;
|
|
64
|
+
}) => TElement$1[] | null;
|
|
65
|
+
declare const replaceSelectionAIChat: (editor: PlateEditor, sourceEditor: SlateEditor, {
|
|
66
|
+
format
|
|
67
|
+
}?: {
|
|
68
|
+
format?: "all" | "none" | "single";
|
|
69
|
+
}) => void;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/react/ai-chat/utils/resetAIChat.d.ts
|
|
72
|
+
declare const resetAIChat: (editor: PlateEditor, {
|
|
73
|
+
undo
|
|
74
|
+
}?: {
|
|
75
|
+
undo?: boolean;
|
|
76
|
+
}) => void;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/react/ai-chat/utils/submitAIChat.d.ts
|
|
79
|
+
declare const submitAIChat: (editor: PlateEditor, input: string, {
|
|
80
|
+
mode,
|
|
81
|
+
options,
|
|
82
|
+
prompt,
|
|
83
|
+
toolName: toolNameProps
|
|
84
|
+
}?: {
|
|
85
|
+
mode?: AIMode;
|
|
86
|
+
options?: ChatRequestOptions;
|
|
87
|
+
prompt?: EditorPrompt;
|
|
88
|
+
toolName?: AIToolName;
|
|
89
|
+
}) => void;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/react/ai-chat/AIChatPlugin.d.ts
|
|
92
|
+
type AIChatPluginConfig = PluginConfig<'aiChat', {
|
|
93
|
+
_blockChunks: string;
|
|
94
|
+
_blockPath: Path | null;
|
|
95
|
+
/** @private Using For streamInsertChunk */
|
|
96
|
+
_mdxName: string | null;
|
|
97
|
+
_replaceIds: string[];
|
|
98
|
+
/** @private The Editor used to generate the AI response. */
|
|
99
|
+
aiEditor: SlateEditor | null;
|
|
100
|
+
chat: UseChatHelpers<ChatMessage>;
|
|
101
|
+
chatNodes: TIdElement[];
|
|
102
|
+
chatSelection: TRange | null;
|
|
103
|
+
/** @deprecated Use api.aiChat.node({streaming:true}) instead */
|
|
104
|
+
experimental_lastTextId: string | null;
|
|
105
|
+
/**
|
|
106
|
+
* Specifies how the assistant message is handled:
|
|
107
|
+
*
|
|
108
|
+
* - 'insert': Directly inserts content into the editor without preview.
|
|
109
|
+
* - 'chat': Initiates an interactive session to review and refine content
|
|
110
|
+
* before insertion.
|
|
111
|
+
*/
|
|
112
|
+
mode: AIMode;
|
|
113
|
+
open: boolean;
|
|
114
|
+
/** Whether the AI response is currently streaming. Cursor mode only. */
|
|
115
|
+
streaming: boolean;
|
|
116
|
+
toolName: AIToolName;
|
|
117
|
+
} & TriggerComboboxPluginOptions, {
|
|
118
|
+
aiChat: {
|
|
119
|
+
reset: OmitFirst<typeof resetAIChat>;
|
|
120
|
+
submit: OmitFirst<typeof submitAIChat>;
|
|
121
|
+
hide: (options?: {
|
|
122
|
+
focus?: boolean;
|
|
123
|
+
undo?: boolean;
|
|
124
|
+
}) => void;
|
|
125
|
+
node: (options?: EditorNodesOptions & {
|
|
126
|
+
anchor?: boolean;
|
|
127
|
+
streaming?: boolean;
|
|
128
|
+
}) => NodeEntry | undefined;
|
|
129
|
+
reload: () => void;
|
|
130
|
+
show: () => void;
|
|
131
|
+
stop: () => void;
|
|
132
|
+
};
|
|
133
|
+
}, {
|
|
134
|
+
aiChat: {
|
|
135
|
+
accept: OmitFirst<typeof acceptAIChat>;
|
|
136
|
+
insertBelow: OmitFirst<typeof insertBelowAIChat>;
|
|
137
|
+
replaceSelection: OmitFirst<typeof replaceSelectionAIChat>;
|
|
138
|
+
removeAnchor: (options?: EditorNodesOptions) => void;
|
|
139
|
+
};
|
|
140
|
+
}>;
|
|
141
|
+
declare const AIChatPlugin: any;
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/react/ai-chat/withAIChat.d.ts
|
|
144
|
+
declare const withAIChat: OverrideEditor<AIChatPluginConfig>;
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/react/ai-chat/hooks/useAIChatEditor.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* Register an editor in the AI chat plugin, and deserializes the content into
|
|
149
|
+
* `editor.children` with block-level memoization.
|
|
150
|
+
*
|
|
151
|
+
* @returns Deserialized children to pass as `value` prop to PlateStatic
|
|
152
|
+
*/
|
|
153
|
+
declare const useAIChatEditor: (editor: SlateEditor, content: string, {
|
|
154
|
+
parser
|
|
155
|
+
}?: DeserializeMdOptions) => any;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/react/ai-chat/hooks/useChatChunk.d.ts
|
|
158
|
+
declare const useChatChunk: ({
|
|
159
|
+
onChunk,
|
|
160
|
+
onFinish
|
|
161
|
+
}: {
|
|
162
|
+
onChunk: (chunk: {
|
|
163
|
+
chunk: string;
|
|
164
|
+
isFirst: boolean;
|
|
165
|
+
nodes: TText[];
|
|
166
|
+
text: string;
|
|
167
|
+
}) => void;
|
|
168
|
+
onFinish?: ({
|
|
169
|
+
content
|
|
170
|
+
}: {
|
|
171
|
+
content: string;
|
|
172
|
+
}) => void;
|
|
173
|
+
}) => void;
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/react/ai-chat/hooks/useEditorChat.d.ts
|
|
176
|
+
type UseEditorChatOptions = {
|
|
177
|
+
chat?: any;
|
|
178
|
+
onOpenBlockSelection?: (blocks: NodeEntry[]) => void;
|
|
179
|
+
onOpenChange?: (open: boolean) => void;
|
|
180
|
+
onOpenCursor?: () => void;
|
|
181
|
+
onOpenSelection?: () => void;
|
|
182
|
+
};
|
|
183
|
+
declare const useEditorChat: ({
|
|
184
|
+
onOpenBlockSelection,
|
|
185
|
+
onOpenChange,
|
|
186
|
+
onOpenCursor,
|
|
187
|
+
onOpenSelection
|
|
188
|
+
}: UseEditorChatOptions) => void;
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/react/ai-chat/streaming/streamDeserializeInlineMd.d.ts
|
|
191
|
+
declare const streamDeserializeInlineMd: (editor: PlateEditor, text: string, options?: DeserializeMdOptions) => any;
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/react/ai-chat/streaming/streamDeserializeMd.d.ts
|
|
194
|
+
declare const streamDeserializeMd: (editor: PlateEditor, data: string, options?: DeserializeMdOptions) => TElement[];
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/react/ai-chat/streaming/streamInsertChunk.d.ts
|
|
197
|
+
type SteamInsertChunkOptions = {
|
|
198
|
+
elementProps?: any;
|
|
199
|
+
textProps?: any;
|
|
200
|
+
};
|
|
201
|
+
/** @experimental */
|
|
202
|
+
declare function streamInsertChunk(editor: PlateEditor, chunk: string, options?: SteamInsertChunkOptions): void;
|
|
203
|
+
declare const getCurrentBlockPath: (editor: SlateEditor) => any;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/react/ai-chat/streaming/streamSerializeMd.d.ts
|
|
206
|
+
declare const streamSerializeMd: (editor: PlateEditor, options: SerializeMdOptions, chunk: string) => string;
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/react/ai-chat/streaming/utils/escapeInput.d.ts
|
|
209
|
+
declare const escapeInput: (data: string) => string;
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/react/ai-chat/streaming/utils/getListNode.d.ts
|
|
212
|
+
declare const getListNode: (editor: PlateEditor, node: TElement$1) => TElement$1;
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/react/ai-chat/streaming/utils/isSameNode.d.ts
|
|
215
|
+
declare const isSameNode: (editor: PlateEditor, node1: TElement$1 | TText, node2: TElement$1 | TText) => boolean;
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/react/ai-chat/streaming/utils/nodesWithProps.d.ts
|
|
218
|
+
declare const nodesWithProps: (editor: PlateEditor, nodes: Descendant[], options: SteamInsertChunkOptions) => Descendant[];
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/react/ai-chat/streaming/utils/utils.d.ts
|
|
221
|
+
declare const getChunkTrimmed: (chunk: string, {
|
|
222
|
+
direction
|
|
223
|
+
}?: {
|
|
224
|
+
direction?: "left" | "right";
|
|
225
|
+
}) => string;
|
|
226
|
+
declare function isCompleteCodeBlock(str: string): boolean;
|
|
227
|
+
declare function isCompleteMath(str: string): boolean;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/react/ai-chat/transforms/removeAnchorAIChat.d.ts
|
|
230
|
+
declare const removeAnchorAIChat: (editor: PlateEditor, options?: RemoveNodesOptions) => void;
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/react/ai-chat/utils/acceptAISuggestions.d.ts
|
|
233
|
+
declare const acceptAISuggestions: (editor: PlateEditor) => void;
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/react/ai-chat/utils/applyAISuggestions.d.ts
|
|
236
|
+
declare const applyAISuggestions: (editor: SlateEditor, content: string) => void;
|
|
237
|
+
declare const withTransient: (diffNodes: Descendant[]) => Descendant[];
|
|
238
|
+
declare const withoutSuggestionAndComments: (nodes: Descendant[]) => Descendant[];
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/react/ai-chat/utils/applyTableCellSuggestion.d.ts
|
|
241
|
+
type TableCellUpdate = {
|
|
242
|
+
content: string;
|
|
243
|
+
id: string;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Apply AI-generated content to a table cell as diff suggestions. Finds the
|
|
247
|
+
* cell by ID, deserializes the markdown content, computes diff, and replaces
|
|
248
|
+
* the cell's children with suggestion-marked nodes.
|
|
249
|
+
*/
|
|
250
|
+
declare const applyTableCellSuggestion: (editor: SlateEditor, cellUpdate: TableCellUpdate) => void;
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/react/ai-chat/utils/getLastAssistantMessage.d.ts
|
|
253
|
+
declare function getLastAssistantMessage(editor: PlateEditor): any;
|
|
254
|
+
declare function useLastAssistantMessage(): any;
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/react/ai-chat/utils/nestedContainerUtils.d.ts
|
|
257
|
+
/** Check if nodes is a single table with single cell */
|
|
258
|
+
declare const isSingleCellTable: (nodes: Descendant[]) => nodes is [TTableElement];
|
|
259
|
+
/** Extract td children from single-cell table */
|
|
260
|
+
declare const getTableCellChildren: (table: TTableElement) => Descendant[];
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/react/ai-chat/utils/rejectAISuggestions.d.ts
|
|
263
|
+
declare const rejectAISuggestions: (editor: PlateEditor) => void;
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/react/copilot/utils/callCompletionApi.d.ts
|
|
266
|
+
declare const getOriginalFetch: () => typeof fetch;
|
|
267
|
+
type CallCompletionApiOptions = {
|
|
268
|
+
prompt: string;
|
|
269
|
+
api?: string;
|
|
270
|
+
body?: Record<string, any>;
|
|
271
|
+
credentials?: RequestCredentials | undefined;
|
|
272
|
+
fetch?: ReturnType<typeof getOriginalFetch> | undefined;
|
|
273
|
+
headers?: HeadersInit | undefined;
|
|
274
|
+
setAbortController?: (abortController: AbortController | null) => void;
|
|
275
|
+
setCompletion?: (completion: string) => void;
|
|
276
|
+
setError?: (error: Error | null) => void;
|
|
277
|
+
setLoading?: (loading: boolean) => void;
|
|
278
|
+
onError?: ((error: Error) => void) | undefined;
|
|
279
|
+
onFinish?: ((prompt: string, completion: string) => void) | undefined;
|
|
280
|
+
onResponse?: ((response: Response) => Promise<void> | void) | undefined;
|
|
281
|
+
};
|
|
282
|
+
type CompleteOptions = Omit<CallCompletionApiOptions, 'setAbortController' | 'setCompletion' | 'setError' | 'setLoading'>;
|
|
283
|
+
declare function callCompletionApi({
|
|
284
|
+
api,
|
|
285
|
+
body,
|
|
286
|
+
credentials,
|
|
287
|
+
fetch,
|
|
288
|
+
headers,
|
|
289
|
+
prompt,
|
|
290
|
+
setAbortController,
|
|
291
|
+
setCompletion,
|
|
292
|
+
setError,
|
|
293
|
+
setLoading,
|
|
294
|
+
onError,
|
|
295
|
+
onFinish,
|
|
296
|
+
onResponse
|
|
297
|
+
}: CallCompletionApiOptions): Promise<string | null | undefined>;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/react/copilot/transforms/acceptCopilot.d.ts
|
|
300
|
+
declare const acceptCopilot: (editor: PlateEditor) => false | undefined;
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/react/copilot/transforms/acceptCopilotNextWord.d.ts
|
|
303
|
+
declare const acceptCopilotNextWord: (editor: PlateEditor) => false | undefined;
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/react/copilot/utils/getNextWord.d.ts
|
|
306
|
+
type GetNextWord = (options: {
|
|
307
|
+
text: string;
|
|
308
|
+
}) => {
|
|
309
|
+
firstWord: string;
|
|
310
|
+
remainingText: string;
|
|
311
|
+
};
|
|
312
|
+
declare const getNextWord: GetNextWord;
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/react/copilot/utils/triggerCopilotSuggestion.d.ts
|
|
315
|
+
declare const triggerCopilotSuggestion: (editor: PlateEditor) => Promise<false | undefined>;
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/react/copilot/CopilotPlugin.d.ts
|
|
318
|
+
type CopilotPluginConfig = PluginConfig<'copilot', CompletionState & {
|
|
319
|
+
/**
|
|
320
|
+
* AI completion options. See:
|
|
321
|
+
* {@link https://sdk.vercel.ai/docs/reference/ai-sdk-ui/use-completion#parameters | AI SDK UI useCompletion Parameters}
|
|
322
|
+
*/
|
|
323
|
+
completeOptions?: Partial<CompleteOptions>;
|
|
324
|
+
/**
|
|
325
|
+
* Debounce delay for auto triggering AI completion.
|
|
326
|
+
*
|
|
327
|
+
* @default 0
|
|
328
|
+
*/
|
|
329
|
+
debounceDelay?: number;
|
|
330
|
+
/** Get the next word to be inserted. */
|
|
331
|
+
getNextWord?: GetNextWord;
|
|
332
|
+
/** Render the ghost text. */
|
|
333
|
+
renderGhostText?: (() => React.ReactNode) | null;
|
|
334
|
+
shouldAbort?: boolean;
|
|
335
|
+
/** The node id where the suggestion is located. */
|
|
336
|
+
suggestionNodeId?: string | null;
|
|
337
|
+
/** The text of the suggestion. */
|
|
338
|
+
suggestionText?: string | null;
|
|
339
|
+
/**
|
|
340
|
+
* Conditions to auto trigger copilot, used in addition to triggerQuery.
|
|
341
|
+
* Disabling defaults to:
|
|
342
|
+
*
|
|
343
|
+
* - Block above is empty
|
|
344
|
+
* - Block above ends with a space
|
|
345
|
+
* - There is already a suggestion
|
|
346
|
+
*/
|
|
347
|
+
autoTriggerQuery?: (options: {
|
|
348
|
+
editor: PlateEditor;
|
|
349
|
+
}) => boolean;
|
|
350
|
+
/**
|
|
351
|
+
* Get the prompt for AI completion.
|
|
352
|
+
*
|
|
353
|
+
* @default serializeMdNodes(editor.api.block({ highest: true }))
|
|
354
|
+
*/
|
|
355
|
+
getPrompt?: (options: {
|
|
356
|
+
editor: PlateEditor;
|
|
357
|
+
}) => string;
|
|
358
|
+
/**
|
|
359
|
+
* Conditions to trigger copilot. Disabling defaults to:
|
|
360
|
+
*
|
|
361
|
+
* - Selection is expanded
|
|
362
|
+
* - Selection is not at the end of block
|
|
363
|
+
*/
|
|
364
|
+
triggerQuery?: (options: {
|
|
365
|
+
editor: PlateEditor;
|
|
366
|
+
}) => boolean;
|
|
367
|
+
}, {
|
|
368
|
+
copilot: {
|
|
369
|
+
triggerSuggestion: OmitFirst<typeof triggerCopilotSuggestion>;
|
|
370
|
+
reject: () => false | undefined;
|
|
371
|
+
setBlockSuggestion: (options: {
|
|
372
|
+
text: string;
|
|
373
|
+
id?: string;
|
|
374
|
+
}) => void;
|
|
375
|
+
stop: () => void;
|
|
376
|
+
};
|
|
377
|
+
}, {
|
|
378
|
+
copilot: {
|
|
379
|
+
accept: OmitFirst<typeof acceptCopilot>;
|
|
380
|
+
acceptNextWord: OmitFirst<typeof acceptCopilotNextWord>;
|
|
381
|
+
};
|
|
382
|
+
}, {
|
|
383
|
+
isSuggested?: (id: string) => boolean;
|
|
384
|
+
}>;
|
|
385
|
+
type CompletionState = {
|
|
386
|
+
abortController?: AbortController | null;
|
|
387
|
+
completion?: string | null;
|
|
388
|
+
error?: Error | null;
|
|
389
|
+
isLoading?: boolean;
|
|
390
|
+
};
|
|
391
|
+
declare const CopilotPlugin: any;
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/react/copilot/renderCopilotBelowNodes.d.ts
|
|
394
|
+
declare const renderCopilotBelowNodes: ({
|
|
395
|
+
editor
|
|
396
|
+
}: RenderNodeWrapperProps<CopilotPluginConfig>) => (({
|
|
397
|
+
children
|
|
398
|
+
}: {
|
|
399
|
+
children: React.ReactNode;
|
|
400
|
+
}) => React.JSX.Element) | undefined;
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/react/copilot/withCopilot.d.ts
|
|
403
|
+
declare const withCopilot: OverrideEditor<CopilotPluginConfig>;
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/react/copilot/utils/withoutAbort.d.ts
|
|
406
|
+
declare const withoutAbort: (editor: PlateEditor, fn: () => void) => void;
|
|
407
|
+
//#endregion
|
|
408
|
+
export { AIChatPlugin, AIChatPluginConfig, AIPlugin, AIPluginConfig, CallCompletionApiOptions, CompleteOptions, CopilotPlugin, CopilotPluginConfig, GetNextWord, SteamInsertChunkOptions, TableCellUpdate, UseEditorChatOptions, acceptAIChat, acceptAISuggestions, acceptCopilot, acceptCopilotNextWord, aiCommentToRange, applyAISuggestions, applyTableCellSuggestion, callCompletionApi, createFormattedBlocks, escapeInput, findTextRangeInBlock, getChunkTrimmed, getCurrentBlockPath, getLastAssistantMessage, getListNode, getNextWord, getTableCellChildren, insertBelowAIChat, insertBelowGenerate, isCompleteCodeBlock, isCompleteMath, isSameNode, isSingleCellTable, nodesWithProps, rejectAISuggestions, removeAnchorAIChat, renderCopilotBelowNodes, replaceSelectionAIChat, resetAIChat, streamDeserializeInlineMd, streamDeserializeMd, streamInsertChunk, streamSerializeMd, submitAIChat, triggerCopilotSuggestion, useAIChatEditor, useChatChunk, useEditorChat, useLastAssistantMessage, withAIChat, withCopilot, withTransient, withoutAbort, withoutSuggestionAndComments };
|
|
409
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/react/ai/AIPlugin.ts","../../src/react/ai-chat/internal/types.ts","../../src/react/ai/utils/aiCommentToRange.ts","../../src/react/ai/utils/findTextRangeInBlock.tsx","../../src/react/ai-chat/transforms/acceptAIChat.ts","../../src/react/ai-chat/transforms/insertBelowAIChat.ts","../../src/react/ai-chat/transforms/replaceSelectionAIChat.ts","../../src/react/ai-chat/utils/resetAIChat.ts","../../src/react/ai-chat/utils/submitAIChat.ts","../../src/react/ai-chat/AIChatPlugin.ts","../../src/react/ai-chat/withAIChat.ts","../../src/react/ai-chat/hooks/useAIChatEditor.ts","../../src/react/ai-chat/hooks/useChatChunk.ts","../../src/react/ai-chat/hooks/useEditorChat.ts","../../src/react/ai-chat/streaming/streamDeserializeInlineMd.ts","../../src/react/ai-chat/streaming/streamDeserializeMd.ts","../../src/react/ai-chat/streaming/streamInsertChunk.ts","../../src/react/ai-chat/streaming/streamSerializeMd.ts","../../src/react/ai-chat/streaming/utils/escapeInput.ts","../../src/react/ai-chat/streaming/utils/getListNode.ts","../../src/react/ai-chat/streaming/utils/isSameNode.ts","../../src/react/ai-chat/streaming/utils/nodesWithProps.ts","../../src/react/ai-chat/streaming/utils/utils.ts","../../src/react/ai-chat/transforms/removeAnchorAIChat.ts","../../src/react/ai-chat/utils/acceptAISuggestions.ts","../../src/react/ai-chat/utils/applyAISuggestions.ts","../../src/react/ai-chat/utils/applyTableCellSuggestion.ts","../../src/react/ai-chat/utils/getLastAssistantMessage.ts","../../src/react/ai-chat/utils/nestedContainerUtils.ts","../../src/react/ai-chat/utils/rejectAISuggestions.ts","../../src/react/copilot/utils/callCompletionApi.ts","../../src/react/copilot/transforms/acceptCopilot.ts","../../src/react/copilot/transforms/acceptCopilotNextWord.ts","../../src/react/copilot/utils/getNextWord.ts","../../src/react/copilot/utils/triggerCopilotSuggestion.ts","../../src/react/copilot/CopilotPlugin.tsx","../../src/react/copilot/renderCopilotBelowNodes.tsx","../../src/react/copilot/withCopilot.ts","../../src/react/copilot/utils/withoutAbort.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAM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