@platejs/ai 50.1.2 → 50.2.1
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/dist/{getEditorPrompt-FgyoD13L.d.mts → getEditorPrompt-C7EEuMw8.d.mts} +1 -5
- package/dist/{getEditorPrompt-FgyoD13L.d.ts → getEditorPrompt-C7EEuMw8.d.ts} +1 -5
- package/dist/index.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +42 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -37
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +28 -8
- package/dist/react/index.d.ts +28 -8
- package/dist/react/index.js +338 -110
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +277 -39
- package/dist/react/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/react/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as platejs_react from 'platejs/react';
|
|
2
2
|
import { PlateEditor, OverrideEditor, RenderNodeWrapperProps } from 'platejs/react';
|
|
3
3
|
import * as platejs from 'platejs';
|
|
4
|
-
import { ExtendConfig, SlateEditor, Range, NodeEntry, TElement, PluginConfig, Path, OmitFirst, EditorNodesOptions, TText, Descendant, RemoveNodesOptions } from 'platejs';
|
|
5
|
-
import { B as BaseAIPluginConfig, b as AIMode, E as EditorPrompt, A as AIToolName } from '../getEditorPrompt-
|
|
4
|
+
import { ExtendConfig, SlateEditor, Range, NodeEntry, TElement, PluginConfig, Path, TIdElement, TRange, OmitFirst, EditorNodesOptions, TText, Descendant, RemoveNodesOptions } from 'platejs';
|
|
5
|
+
import { B as BaseAIPluginConfig, b as AIMode, E as EditorPrompt, A as AIToolName } from '../getEditorPrompt-C7EEuMw8.js';
|
|
6
6
|
import { UIMessage, ChatRequestOptions } from 'ai';
|
|
7
7
|
import { Range as Range$1 } from 'slate';
|
|
8
8
|
import { UseChatHelpers } from '@ai-sdk/react';
|
|
@@ -45,10 +45,14 @@ declare function findTextRangeInBlock({ block, findText, }: {
|
|
|
45
45
|
}): Range$1 | null;
|
|
46
46
|
|
|
47
47
|
declare const acceptAIChat: (editor: PlateEditor) => void;
|
|
48
|
+
declare const acceptSuggestions: (editor: PlateEditor) => void;
|
|
48
49
|
|
|
49
50
|
declare const insertBelowAIChat: (editor: PlateEditor, sourceEditor: SlateEditor, { format }?: {
|
|
50
51
|
format?: "all" | "none" | "single";
|
|
51
52
|
}) => void;
|
|
53
|
+
declare const insertBelowGenerate: (editor: PlateEditor, sourceEditor: SlateEditor, { format }?: {
|
|
54
|
+
format?: "all" | "none" | "single";
|
|
55
|
+
}) => void;
|
|
52
56
|
|
|
53
57
|
declare const createFormattedBlocks: ({ blocks, format, sourceBlock, }: {
|
|
54
58
|
blocks: TElement[];
|
|
@@ -73,9 +77,12 @@ type AIChatPluginConfig = PluginConfig<'aiChat', {
|
|
|
73
77
|
_blockPath: Path | null;
|
|
74
78
|
/** @private Using For streamInsertChunk */
|
|
75
79
|
_mdxName: string | null;
|
|
80
|
+
_replaceIds: string[];
|
|
76
81
|
/** @private The Editor used to generate the AI response. */
|
|
77
82
|
aiEditor: SlateEditor | null;
|
|
78
83
|
chat: UseChatHelpers<ChatMessage>;
|
|
84
|
+
chatNodes: TIdElement[];
|
|
85
|
+
chatSelection: TRange | null;
|
|
79
86
|
/** @deprecated Use api.aiChat.node({streaming:true}) instead */
|
|
80
87
|
experimental_lastTextId: string | null;
|
|
81
88
|
/**
|
|
@@ -94,7 +101,9 @@ type AIChatPluginConfig = PluginConfig<'aiChat', {
|
|
|
94
101
|
aiChat: {
|
|
95
102
|
reset: OmitFirst<typeof resetAIChat>;
|
|
96
103
|
submit: OmitFirst<typeof submitAIChat>;
|
|
97
|
-
hide: (
|
|
104
|
+
hide: (options?: {
|
|
105
|
+
focus?: boolean;
|
|
106
|
+
}) => void;
|
|
98
107
|
node: (options?: EditorNodesOptions & {
|
|
99
108
|
anchor?: boolean;
|
|
100
109
|
streaming?: boolean;
|
|
@@ -116,9 +125,12 @@ declare const AIChatPlugin: platejs_react.PlatePlugin<PluginConfig<"aiChat", {
|
|
|
116
125
|
_blockPath: Path | null;
|
|
117
126
|
/** @private Using For streamInsertChunk */
|
|
118
127
|
_mdxName: string | null;
|
|
128
|
+
_replaceIds: string[];
|
|
119
129
|
/** @private The Editor used to generate the AI response. */
|
|
120
130
|
aiEditor: SlateEditor | null;
|
|
121
131
|
chat: UseChatHelpers<ChatMessage>;
|
|
132
|
+
chatNodes: TIdElement[];
|
|
133
|
+
chatSelection: TRange | null;
|
|
122
134
|
/** @deprecated Use api.aiChat.node({streaming:true}) instead */
|
|
123
135
|
experimental_lastTextId: string | null;
|
|
124
136
|
/**
|
|
@@ -137,7 +149,9 @@ declare const AIChatPlugin: platejs_react.PlatePlugin<PluginConfig<"aiChat", {
|
|
|
137
149
|
aiChat: {
|
|
138
150
|
reset: OmitFirst<typeof resetAIChat>;
|
|
139
151
|
submit: OmitFirst<typeof submitAIChat>;
|
|
140
|
-
hide: (
|
|
152
|
+
hide: (options?: {
|
|
153
|
+
focus?: boolean;
|
|
154
|
+
}) => void;
|
|
141
155
|
node: (options?: EditorNodesOptions & {
|
|
142
156
|
anchor?: boolean;
|
|
143
157
|
streaming?: boolean;
|
|
@@ -149,7 +163,9 @@ declare const AIChatPlugin: platejs_react.PlatePlugin<PluginConfig<"aiChat", {
|
|
|
149
163
|
} & Record<"aiChat", Pick<{
|
|
150
164
|
reset: OmitFirst<typeof resetAIChat>;
|
|
151
165
|
submit: OmitFirst<typeof submitAIChat>;
|
|
152
|
-
hide: (
|
|
166
|
+
hide: (options?: {
|
|
167
|
+
focus?: boolean;
|
|
168
|
+
}) => void;
|
|
153
169
|
node: (options?: EditorNodesOptions & {
|
|
154
170
|
anchor?: boolean;
|
|
155
171
|
streaming?: boolean;
|
|
@@ -157,8 +173,10 @@ declare const AIChatPlugin: platejs_react.PlatePlugin<PluginConfig<"aiChat", {
|
|
|
157
173
|
reload: () => void;
|
|
158
174
|
show: () => void;
|
|
159
175
|
stop: () => void;
|
|
160
|
-
}, "node" | "
|
|
161
|
-
hide: (
|
|
176
|
+
}, "node" | "stop" | "reset" | "submit">> & Record<"aiChat", {
|
|
177
|
+
hide: ({ focus }?: {
|
|
178
|
+
focus?: boolean;
|
|
179
|
+
}) => void;
|
|
162
180
|
show: () => void;
|
|
163
181
|
}>, {
|
|
164
182
|
aiChat: {
|
|
@@ -242,6 +260,8 @@ declare function isCompleteMath(str: string): boolean;
|
|
|
242
260
|
|
|
243
261
|
declare const removeAnchorAIChat: (editor: PlateEditor, options?: RemoveNodesOptions) => void;
|
|
244
262
|
|
|
263
|
+
declare const applyAISuggestions: (editor: SlateEditor, content: string) => void;
|
|
264
|
+
|
|
245
265
|
declare function getLastAssistantMessage(editor: PlateEditor): ChatMessage | undefined;
|
|
246
266
|
declare function useLastAssistantMessage(): ChatMessage | undefined;
|
|
247
267
|
|
|
@@ -440,4 +460,4 @@ declare const withCopilot: OverrideEditor<CopilotPluginConfig>;
|
|
|
440
460
|
|
|
441
461
|
declare const withoutAbort: (editor: PlateEditor, fn: () => void) => void;
|
|
442
462
|
|
|
443
|
-
export { AIChatPlugin, type AIChatPluginConfig, AIPlugin, type AIPluginConfig, type CallCompletionApiOptions, type CompleteOptions, CopilotPlugin, type CopilotPluginConfig, type GetNextWord, type SteamInsertChunkOptions, type UseEditorChatOptions, acceptAIChat, acceptCopilot, acceptCopilotNextWord, aiCommentToRange, callCompletionApi, createFormattedBlocks, escapeInput, findTextRangeInBlock, getChunkTrimmed, getCurrentBlockPath, getLastAssistantMessage, getListNode, getNextWord, insertBelowAIChat, isCompleteCodeBlock, isCompleteMath, isSameNode, nodesWithProps, removeAnchorAIChat, renderCopilotBelowNodes, replaceSelectionAIChat, resetAIChat, streamDeserializeInlineMd, streamDeserializeMd, streamInsertChunk, streamSerializeMd, submitAIChat, triggerCopilotSuggestion, useAIChatEditor, useChatChunk, useEditorChat, useLastAssistantMessage, withAIChat, withCopilot, withoutAbort };
|
|
463
|
+
export { AIChatPlugin, type AIChatPluginConfig, AIPlugin, type AIPluginConfig, type CallCompletionApiOptions, type CompleteOptions, CopilotPlugin, type CopilotPluginConfig, type GetNextWord, type SteamInsertChunkOptions, type UseEditorChatOptions, acceptAIChat, acceptCopilot, acceptCopilotNextWord, acceptSuggestions, aiCommentToRange, applyAISuggestions, callCompletionApi, createFormattedBlocks, escapeInput, findTextRangeInBlock, getChunkTrimmed, getCurrentBlockPath, getLastAssistantMessage, getListNode, getNextWord, insertBelowAIChat, insertBelowGenerate, isCompleteCodeBlock, isCompleteMath, isSameNode, nodesWithProps, removeAnchorAIChat, renderCopilotBelowNodes, replaceSelectionAIChat, resetAIChat, streamDeserializeInlineMd, streamDeserializeMd, streamInsertChunk, streamSerializeMd, submitAIChat, triggerCopilotSuggestion, useAIChatEditor, useChatChunk, useEditorChat, useLastAssistantMessage, withAIChat, withCopilot, withoutAbort };
|