@platejs/ai 52.0.0 → 52.0.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/react/index.js +12 -1
- package/package.json +6 -6
package/dist/react/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { distance } from "fastest-levenshtein";
|
|
|
8
8
|
import { BlockSelectionPlugin, removeBlockSelectionNodes } from "@platejs/selection/react";
|
|
9
9
|
import { SuggestionPlugin } from "@platejs/suggestion/react";
|
|
10
10
|
import cloneDeep from "lodash/cloneDeep.js";
|
|
11
|
+
import { c } from "react/compiler-runtime";
|
|
11
12
|
import React, { useEffect, useMemo, useRef } from "react";
|
|
12
13
|
import debounce from "lodash/debounce.js";
|
|
13
14
|
|
|
@@ -292,10 +293,20 @@ function getLastAssistantMessage(editor) {
|
|
|
292
293
|
return editor.getOptions(AIChatPlugin).chat.messages?.findLast((message) => message.role === "assistant");
|
|
293
294
|
}
|
|
294
295
|
function useLastAssistantMessage() {
|
|
296
|
+
const $ = c(2);
|
|
295
297
|
const toolName = usePluginOption(AIChatPlugin, "toolName");
|
|
296
298
|
const chat = usePluginOption(AIChatPlugin, "chat");
|
|
297
299
|
if (toolName === "comment") return;
|
|
298
|
-
|
|
300
|
+
let t0;
|
|
301
|
+
if ($[0] !== chat.messages) {
|
|
302
|
+
t0 = chat.messages?.findLast(_temp);
|
|
303
|
+
$[0] = chat.messages;
|
|
304
|
+
$[1] = t0;
|
|
305
|
+
} else t0 = $[1];
|
|
306
|
+
return t0;
|
|
307
|
+
}
|
|
308
|
+
function _temp(message) {
|
|
309
|
+
return message.role === "assistant";
|
|
299
310
|
}
|
|
300
311
|
|
|
301
312
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platejs/ai",
|
|
3
|
-
"version": "52.0.
|
|
3
|
+
"version": "52.0.1",
|
|
4
4
|
"description": "Text AI plugin for Plate",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plate",
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"typecheck": "yarn p:typecheck"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@platejs/markdown": "52.0.
|
|
44
|
-
"@platejs/selection": "52.0.
|
|
45
|
-
"@platejs/suggestion": "52.0.
|
|
43
|
+
"@platejs/markdown": "52.0.1",
|
|
44
|
+
"@platejs/selection": "52.0.1",
|
|
45
|
+
"@platejs/suggestion": "52.0.1",
|
|
46
46
|
"fastest-levenshtein": "1.0.16",
|
|
47
47
|
"lodash": "^4.17.21"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@ai-sdk/react": "2.0.28",
|
|
51
|
-
"@platejs/combobox": "52.0.
|
|
51
|
+
"@platejs/combobox": "52.0.1",
|
|
52
52
|
"ai": "5.0.28"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"platejs": ">=52.0.
|
|
55
|
+
"platejs": ">=52.0.1",
|
|
56
56
|
"react": ">=18.0.0",
|
|
57
57
|
"react-dom": ">=18.0.0"
|
|
58
58
|
},
|