@copilotkit/react-textarea 0.22.0 → 0.25.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/.turbo/turbo-build.log +104 -104
- package/CHANGELOG.md +33 -0
- package/dist/{chunk-WJYQWL4I.mjs → chunk-2C7O2EVM.mjs} +1 -1
- package/dist/{chunk-WJYQWL4I.mjs.map → chunk-2C7O2EVM.mjs.map} +1 -1
- package/dist/{chunk-KCHYD3EB.mjs → chunk-2CDXHWVF.mjs} +1 -1
- package/dist/chunk-2CDXHWVF.mjs.map +1 -0
- package/dist/{chunk-GCMQHIRF.mjs → chunk-2QDCE7PD.mjs} +1 -1
- package/dist/chunk-2QDCE7PD.mjs.map +1 -0
- package/dist/{chunk-ND5PXTAW.mjs → chunk-3PQ7GSFE.mjs} +1 -1
- package/dist/chunk-3PQ7GSFE.mjs.map +1 -0
- package/dist/{chunk-MRPRZQMN.mjs → chunk-5IISSXS2.mjs} +11 -11
- package/dist/chunk-5IISSXS2.mjs.map +1 -0
- package/dist/{chunk-RQHOUUXQ.mjs → chunk-5UNJXFUO.mjs} +1 -1
- package/dist/{chunk-RQHOUUXQ.mjs.map → chunk-5UNJXFUO.mjs.map} +1 -1
- package/dist/{chunk-NZKGYWQV.mjs → chunk-74HF6Q3L.mjs} +26 -27
- package/dist/chunk-74HF6Q3L.mjs.map +1 -0
- package/dist/{chunk-MPME5BW2.mjs → chunk-7LSRNPNI.mjs} +1 -1
- package/dist/chunk-7LSRNPNI.mjs.map +1 -0
- package/dist/{chunk-DYGPLRY3.mjs → chunk-7SZDD6XT.mjs} +4 -8
- package/dist/chunk-7SZDD6XT.mjs.map +1 -0
- package/dist/{chunk-SFEGMBSS.mjs → chunk-7VKOE5UL.mjs} +8 -12
- package/dist/chunk-7VKOE5UL.mjs.map +1 -0
- package/dist/{chunk-463BFNUP.mjs → chunk-AUCHS4VR.mjs} +2 -2
- package/dist/chunk-AUCHS4VR.mjs.map +1 -0
- package/dist/{chunk-JAFCXEPU.mjs → chunk-BLRAOGXD.mjs} +2 -2
- package/dist/{chunk-JAFCXEPU.mjs.map → chunk-BLRAOGXD.mjs.map} +1 -1
- package/dist/{chunk-NO3EYPQH.mjs → chunk-CK7Q3Y5A.mjs} +2 -2
- package/dist/{chunk-IXJ2HCOA.mjs → chunk-ECR45NSD.mjs} +1 -1
- package/dist/chunk-ECR45NSD.mjs.map +1 -0
- package/dist/{chunk-OELUUJZY.mjs → chunk-EZCKXWQF.mjs} +1 -1
- package/dist/chunk-EZCKXWQF.mjs.map +1 -0
- package/dist/{chunk-KGKLUWKW.mjs → chunk-F626GQCD.mjs} +1 -1
- package/dist/chunk-F626GQCD.mjs.map +1 -0
- package/dist/{chunk-5EJ5XOGP.mjs → chunk-FK2XUDQQ.mjs} +2 -2
- package/dist/chunk-FK2XUDQQ.mjs.map +1 -0
- package/dist/chunk-FP2EKU3L.mjs +28 -0
- package/dist/chunk-FP2EKU3L.mjs.map +1 -0
- package/dist/{chunk-F3MHL6ZY.mjs → chunk-GQN2HYFJ.mjs} +2 -5
- package/dist/chunk-GQN2HYFJ.mjs.map +1 -0
- package/dist/{chunk-AXN37AHC.mjs → chunk-K5LNB36H.mjs} +1 -1
- package/dist/chunk-K5LNB36H.mjs.map +1 -0
- package/dist/{chunk-JHTAOLEW.mjs → chunk-KDVMG3XF.mjs} +1 -1
- package/dist/chunk-KDVMG3XF.mjs.map +1 -0
- package/dist/{chunk-2NURR2DX.mjs → chunk-KMXSZRIA.mjs} +2 -2
- package/dist/chunk-KMXSZRIA.mjs.map +1 -0
- package/dist/{chunk-4S5ZJH3I.mjs → chunk-KNQIEOFP.mjs} +1 -1
- package/dist/{chunk-4S5ZJH3I.mjs.map → chunk-KNQIEOFP.mjs.map} +1 -1
- package/dist/{chunk-YQU7WG7T.mjs → chunk-LZ3UOAQ4.mjs} +3 -3
- package/dist/chunk-LZ3UOAQ4.mjs.map +1 -0
- package/dist/{chunk-NKW5OU2S.mjs → chunk-M2DR4KVB.mjs} +1 -1
- package/dist/chunk-M2DR4KVB.mjs.map +1 -0
- package/dist/{chunk-F2TIBXML.mjs → chunk-NTLVQENP.mjs} +7 -7
- package/dist/chunk-NTLVQENP.mjs.map +1 -0
- package/dist/{chunk-O5OWT5GE.mjs → chunk-PDCIGRCE.mjs} +8 -29
- package/dist/chunk-PDCIGRCE.mjs.map +1 -0
- package/dist/{chunk-YW3REYX6.mjs → chunk-QRKKPCUD.mjs} +2 -4
- package/dist/chunk-QRKKPCUD.mjs.map +1 -0
- package/dist/{chunk-RR6OQGTI.mjs → chunk-RBR32FWA.mjs} +1 -1
- package/dist/chunk-RBR32FWA.mjs.map +1 -0
- package/dist/{chunk-YTOPHPSG.mjs → chunk-T6MTDQZ7.mjs} +1 -1
- package/dist/chunk-T6MTDQZ7.mjs.map +1 -0
- package/dist/{chunk-QJDMIGLU.mjs → chunk-TZLW7PBU.mjs} +9 -12
- package/dist/chunk-TZLW7PBU.mjs.map +1 -0
- package/dist/{chunk-CSGFJU3L.mjs → chunk-U3LUDDT5.mjs} +2 -2
- package/dist/chunk-U3LUDDT5.mjs.map +1 -0
- package/dist/{chunk-LNAIMEB2.mjs → chunk-UEQYKC4W.mjs} +1 -1
- package/dist/chunk-UEQYKC4W.mjs.map +1 -0
- package/dist/{chunk-OD7ZMOVE.mjs → chunk-V55OPCG4.mjs} +2 -2
- package/dist/chunk-V55OPCG4.mjs.map +1 -0
- package/dist/{chunk-WPIA53HF.mjs → chunk-VYECMH73.mjs} +7 -25
- package/dist/chunk-VYECMH73.mjs.map +1 -0
- package/dist/{chunk-BYIG72TT.mjs → chunk-W2ZHOUV6.mjs} +5 -5
- package/dist/chunk-W2ZHOUV6.mjs.map +1 -0
- package/dist/{chunk-UHD44NC5.mjs → chunk-WVRTFPNO.mjs} +10 -20
- package/dist/chunk-WVRTFPNO.mjs.map +1 -0
- package/dist/{chunk-PGGR6HL5.mjs → chunk-ZEHF3AXH.mjs} +6 -9
- package/dist/chunk-ZEHF3AXH.mjs.map +1 -0
- package/dist/{chunk-XHUMROEY.mjs → chunk-ZKRM3DIR.mjs} +1 -1
- package/dist/chunk-ZKRM3DIR.mjs.map +1 -0
- package/dist/{chunk-WLPYYGES.mjs → chunk-ZMNOLW5V.mjs} +6 -16
- package/dist/chunk-ZMNOLW5V.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +31 -31
- package/dist/components/base-copilot-textarea/render-element.mjs +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +2 -2
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +40 -40
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +15 -15
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +10 -10
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +11 -11
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +3 -3
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +11 -11
- package/dist/components/index.mjs +40 -40
- package/dist/components/manual-ui/chip-with-icon.mjs +1 -5
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +4 -4
- package/dist/components/ui/button.mjs +2 -2
- package/dist/components/ui/card.mjs +46 -42
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.mjs +3 -3
- package/dist/components/ui/dialog.mjs +2 -2
- package/dist/components/ui/label.mjs +2 -2
- package/dist/components/ui/separator.mjs +14 -16
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.mjs +1 -1
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +4 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +2 -2
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +3 -3
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +8 -8
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +8 -8
- package/dist/hooks/misc/use-autosize-textarea.mjs +1 -1
- package/dist/index.mjs +40 -40
- package/dist/lib/debouncer.mjs +1 -1
- package/dist/lib/editor-to-text.mjs +1 -1
- package/dist/lib/get-text-around-cursor.mjs +1 -1
- package/dist/lib/retry.mjs +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +1 -1
- package/dist/lib/stream-promise-flatten.mjs +1 -1
- package/dist/lib/utils.mjs +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +5 -5
- package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
- package/dist/types/autosuggestions-config/index.mjs +6 -6
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +1 -1
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.mjs +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +1 -1
- package/dist/types/base/base-autosuggestions-config.d.ts +55 -2
- package/dist/types/base/base-autosuggestions-config.mjs +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +2 -2
- package/dist/types/base/index.mjs +1 -1
- package/dist/types/index.mjs +6 -6
- package/package.json +4 -4
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +31 -37
- package/src/components/base-copilot-textarea/render-element.tsx +3 -5
- package/src/components/base-copilot-textarea/render-placeholder.tsx +2 -4
- package/src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx +2 -5
- package/src/components/base-copilot-textarea/use-add-branding-css.tsx +2 -4
- package/src/components/copilot-textarea/copilot-textarea.tsx +12 -19
- package/src/components/hovering-toolbar/hovering-editor-provider.tsx +1 -3
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +14 -31
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +4 -16
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +11 -25
- package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +9 -8
- package/src/components/manual-ui/chip-with-icon.tsx +3 -12
- package/src/components/source-search-box/source-search-box.tsx +2 -12
- package/src/components/ui/button.tsx +6 -13
- package/src/components/ui/card.tsx +35 -65
- package/src/components/ui/command.tsx +8 -21
- package/src/components/ui/dialog.tsx +8 -29
- package/src/components/ui/label.tsx +3 -8
- package/src/components/ui/separator.tsx +13 -18
- package/src/components/ui/textarea.tsx +3 -4
- package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +13 -27
- package/src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx +1 -5
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +4 -11
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +6 -11
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +16 -36
- package/src/hooks/misc/use-autosize-textarea.tsx +1 -4
- package/src/lib/debouncer.ts +1 -3
- package/src/lib/editor-to-text.ts +4 -7
- package/src/lib/get-text-around-cursor.ts +2 -14
- package/src/lib/retry.tsx +1 -1
- package/src/lib/slatejs-edits/add-autocompletions.ts +2 -2
- package/src/lib/slatejs-edits/clear-autocompletions.ts +1 -4
- package/src/lib/slatejs-edits/replace-text.ts +1 -1
- package/src/lib/slatejs-edits/with-partial-history.ts +4 -11
- package/src/lib/stream-promise-flatten.ts +1 -3
- package/src/lib/utils.ts +4 -8
- package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +3 -7
- package/src/types/autosuggestions-config/autosuggestions-config.tsx +9 -21
- package/src/types/autosuggestions-config/editing-api-config.tsx +3 -5
- package/src/types/autosuggestions-config/insertions-api-config.tsx +2 -3
- package/src/types/autosuggestions-config/subtypes/chatlike-api-endpoint.tsx +18 -26
- package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +1 -4
- package/src/types/autosuggestions-config/suggestions-api-config.tsx +2 -3
- package/src/types/base/autosuggestions-bare-function.ts +2 -2
- package/src/types/base/base-autosuggestions-config.tsx +82 -4
- package/src/types/base/editor-autocomplete-state.ts +1 -1
- package/dist/chunk-2NURR2DX.mjs.map +0 -1
- package/dist/chunk-463BFNUP.mjs.map +0 -1
- package/dist/chunk-5EJ5XOGP.mjs.map +0 -1
- package/dist/chunk-AXN37AHC.mjs.map +0 -1
- package/dist/chunk-BYIG72TT.mjs.map +0 -1
- package/dist/chunk-CSGFJU3L.mjs.map +0 -1
- package/dist/chunk-DYGPLRY3.mjs.map +0 -1
- package/dist/chunk-F2TIBXML.mjs.map +0 -1
- package/dist/chunk-F3MHL6ZY.mjs.map +0 -1
- package/dist/chunk-GCMQHIRF.mjs.map +0 -1
- package/dist/chunk-IXJ2HCOA.mjs.map +0 -1
- package/dist/chunk-JHTAOLEW.mjs.map +0 -1
- package/dist/chunk-KCHYD3EB.mjs.map +0 -1
- package/dist/chunk-KGKLUWKW.mjs.map +0 -1
- package/dist/chunk-LNAIMEB2.mjs.map +0 -1
- package/dist/chunk-MPME5BW2.mjs.map +0 -1
- package/dist/chunk-MRPRZQMN.mjs.map +0 -1
- package/dist/chunk-ND5PXTAW.mjs.map +0 -1
- package/dist/chunk-NKW5OU2S.mjs.map +0 -1
- package/dist/chunk-NZKGYWQV.mjs.map +0 -1
- package/dist/chunk-O5OWT5GE.mjs.map +0 -1
- package/dist/chunk-OD7ZMOVE.mjs.map +0 -1
- package/dist/chunk-OELUUJZY.mjs.map +0 -1
- package/dist/chunk-PGGR6HL5.mjs.map +0 -1
- package/dist/chunk-QJDMIGLU.mjs.map +0 -1
- package/dist/chunk-RR6OQGTI.mjs.map +0 -1
- package/dist/chunk-S6JUGJK2.mjs +0 -13
- package/dist/chunk-S6JUGJK2.mjs.map +0 -1
- package/dist/chunk-SFEGMBSS.mjs.map +0 -1
- package/dist/chunk-UHD44NC5.mjs.map +0 -1
- package/dist/chunk-WLPYYGES.mjs.map +0 -1
- package/dist/chunk-WPIA53HF.mjs.map +0 -1
- package/dist/chunk-XHUMROEY.mjs.map +0 -1
- package/dist/chunk-YQU7WG7T.mjs.map +0 -1
- package/dist/chunk-YTOPHPSG.mjs.map +0 -1
- package/dist/chunk-YW3REYX6.mjs.map +0 -1
- /package/dist/{chunk-NO3EYPQH.mjs.map → chunk-CK7Q3Y5A.mjs.map} +0 -0
|
@@ -27,9 +27,9 @@ import { DocumentPointer } from "@copilotkit/react-core";
|
|
|
27
27
|
*/
|
|
28
28
|
export function useMakeStandardInsertionOrEditingFunction(
|
|
29
29
|
textareaPurpose: string,
|
|
30
|
-
contextCategories: string[]
|
|
30
|
+
contextCategories: string[],
|
|
31
31
|
insertionApiConfig: InsertionsApiConfig,
|
|
32
|
-
editingApiConfig: EditingApiConfig
|
|
32
|
+
editingApiConfig: EditingApiConfig,
|
|
33
33
|
): Generator_InsertionOrEditingSuggestion {
|
|
34
34
|
const { getContextString, copilotApiConfig } = useContext(CopilotContext);
|
|
35
35
|
|
|
@@ -38,7 +38,7 @@ export function useMakeStandardInsertionOrEditingFunction(
|
|
|
38
38
|
editorState: EditingEditorState,
|
|
39
39
|
insertionPrompt: string,
|
|
40
40
|
documents: DocumentPointer[],
|
|
41
|
-
abortSignal: AbortSignal
|
|
41
|
+
abortSignal: AbortSignal,
|
|
42
42
|
) => {
|
|
43
43
|
const res = await retry(async () => {
|
|
44
44
|
const messages: MinimalChatGPTMessage[] = [
|
|
@@ -46,7 +46,7 @@ export function useMakeStandardInsertionOrEditingFunction(
|
|
|
46
46
|
role: "system",
|
|
47
47
|
content: insertionApiConfig.makeSystemPrompt(
|
|
48
48
|
textareaPurpose,
|
|
49
|
-
getContextString(documents, contextCategories)
|
|
49
|
+
getContextString(documents, contextCategories),
|
|
50
50
|
),
|
|
51
51
|
},
|
|
52
52
|
...insertionApiConfig.fewShotMessages,
|
|
@@ -67,18 +67,13 @@ export function useMakeStandardInsertionOrEditingFunction(
|
|
|
67
67
|
},
|
|
68
68
|
];
|
|
69
69
|
|
|
70
|
-
const apiEndpoint =
|
|
71
|
-
|
|
72
|
-
return await apiEndpoint.run(
|
|
73
|
-
abortSignal,
|
|
74
|
-
messages,
|
|
75
|
-
insertionApiConfig.forwardedParams
|
|
76
|
-
);
|
|
70
|
+
const apiEndpoint = ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);
|
|
71
|
+
return await apiEndpoint.run(abortSignal, messages, insertionApiConfig.forwardedParams);
|
|
77
72
|
});
|
|
78
73
|
|
|
79
74
|
return res;
|
|
80
75
|
},
|
|
81
|
-
[insertionApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
76
|
+
[insertionApiConfig, getContextString, contextCategories, textareaPurpose],
|
|
82
77
|
);
|
|
83
78
|
|
|
84
79
|
const editingFunction = useCallback(
|
|
@@ -86,7 +81,7 @@ export function useMakeStandardInsertionOrEditingFunction(
|
|
|
86
81
|
editorState: EditingEditorState,
|
|
87
82
|
editingPrompt: string,
|
|
88
83
|
documents: DocumentPointer[],
|
|
89
|
-
abortSignal: AbortSignal
|
|
84
|
+
abortSignal: AbortSignal,
|
|
90
85
|
) => {
|
|
91
86
|
const res = await retry(async () => {
|
|
92
87
|
const messages: MinimalChatGPTMessage[] = [
|
|
@@ -94,7 +89,7 @@ export function useMakeStandardInsertionOrEditingFunction(
|
|
|
94
89
|
role: "system",
|
|
95
90
|
content: editingApiConfig.makeSystemPrompt(
|
|
96
91
|
textareaPurpose,
|
|
97
|
-
getContextString(documents, contextCategories)
|
|
92
|
+
getContextString(documents, contextCategories),
|
|
98
93
|
),
|
|
99
94
|
},
|
|
100
95
|
...editingApiConfig.fewShotMessages,
|
|
@@ -120,18 +115,13 @@ export function useMakeStandardInsertionOrEditingFunction(
|
|
|
120
115
|
},
|
|
121
116
|
];
|
|
122
117
|
|
|
123
|
-
const apiEndpoint =
|
|
124
|
-
|
|
125
|
-
return await apiEndpoint.run(
|
|
126
|
-
abortSignal,
|
|
127
|
-
messages,
|
|
128
|
-
editingApiConfig.forwardedParams
|
|
129
|
-
);
|
|
118
|
+
const apiEndpoint = ChatlikeApiEndpoint.fromCopilotApiConfig(copilotApiConfig);
|
|
119
|
+
return await apiEndpoint.run(abortSignal, messages, editingApiConfig.forwardedParams);
|
|
130
120
|
});
|
|
131
121
|
|
|
132
122
|
return res;
|
|
133
123
|
},
|
|
134
|
-
[editingApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
124
|
+
[editingApiConfig, getContextString, contextCategories, textareaPurpose],
|
|
135
125
|
);
|
|
136
126
|
|
|
137
127
|
const insertionOrEditingFunction = useCallback(
|
|
@@ -139,25 +129,15 @@ export function useMakeStandardInsertionOrEditingFunction(
|
|
|
139
129
|
editorState: EditingEditorState,
|
|
140
130
|
insertionPrompt: string,
|
|
141
131
|
documents: DocumentPointer[],
|
|
142
|
-
abortSignal: AbortSignal
|
|
132
|
+
abortSignal: AbortSignal,
|
|
143
133
|
) => {
|
|
144
134
|
if (editorState.selectedText === "") {
|
|
145
|
-
return await insertionFunction(
|
|
146
|
-
editorState,
|
|
147
|
-
insertionPrompt,
|
|
148
|
-
documents,
|
|
149
|
-
abortSignal
|
|
150
|
-
);
|
|
135
|
+
return await insertionFunction(editorState, insertionPrompt, documents, abortSignal);
|
|
151
136
|
} else {
|
|
152
|
-
return await editingFunction(
|
|
153
|
-
editorState,
|
|
154
|
-
insertionPrompt,
|
|
155
|
-
documents,
|
|
156
|
-
abortSignal
|
|
157
|
-
);
|
|
137
|
+
return await editingFunction(editorState, insertionPrompt, documents, abortSignal);
|
|
158
138
|
}
|
|
159
139
|
},
|
|
160
|
-
[insertionFunction, editingFunction]
|
|
140
|
+
[insertionFunction, editingFunction],
|
|
161
141
|
);
|
|
162
142
|
|
|
163
143
|
return insertionOrEditingFunction;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Ref, RefObject, useEffect } from "react";
|
|
2
2
|
|
|
3
3
|
// Updates the height of a <textarea> when the value changes.
|
|
4
|
-
const useAutosizeTextArea = (
|
|
5
|
-
textAreaRef: RefObject<HTMLTextAreaElement>,
|
|
6
|
-
value: string
|
|
7
|
-
) => {
|
|
4
|
+
const useAutosizeTextArea = (textAreaRef: RefObject<HTMLTextAreaElement>, value: string) => {
|
|
8
5
|
useEffect(() => {
|
|
9
6
|
if (textAreaRef.current !== null) {
|
|
10
7
|
// We need to reset the height momentarily to get the correct scrollHeight for the textarea
|
package/src/lib/debouncer.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export type AsyncFunction<T extends any[]> = (
|
|
2
|
-
...args: [...T, AbortSignal]
|
|
3
|
-
) => Promise<void>;
|
|
1
|
+
export type AsyncFunction<T extends any[]> = (...args: [...T, AbortSignal]) => Promise<void>;
|
|
4
2
|
|
|
5
3
|
export class Debouncer<T extends any[]> {
|
|
6
4
|
private timeoutId?: number;
|
|
@@ -5,7 +5,7 @@ import { SuggestionAwareText } from "../types/base/custom-editor";
|
|
|
5
5
|
|
|
6
6
|
function nodeChildrenToTextComponents(
|
|
7
7
|
editor: BaseEditor & ReactEditor & HistoryEditor,
|
|
8
|
-
nodes: Descendant[]
|
|
8
|
+
nodes: Descendant[],
|
|
9
9
|
): SuggestionAwareText[] {
|
|
10
10
|
// find inlineable elements
|
|
11
11
|
const indeciesOfInlineElements = new Set(
|
|
@@ -16,7 +16,7 @@ function nodeChildrenToTextComponents(
|
|
|
16
16
|
}
|
|
17
17
|
return -1;
|
|
18
18
|
})
|
|
19
|
-
.filter((index) => index !== -1)
|
|
19
|
+
.filter((index) => index !== -1),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
// ignorable elements = inline elements,
|
|
@@ -28,8 +28,7 @@ function nodeChildrenToTextComponents(
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const isNeighbourOfInline =
|
|
31
|
-
indeciesOfInlineElements.has(index - 1) ||
|
|
32
|
-
indeciesOfInlineElements.has(index + 1);
|
|
31
|
+
indeciesOfInlineElements.has(index - 1) || indeciesOfInlineElements.has(index + 1);
|
|
33
32
|
if (isNeighbourOfInline) {
|
|
34
33
|
return (node as any).text !== "";
|
|
35
34
|
}
|
|
@@ -53,9 +52,7 @@ function nodeChildrenToTextComponents(
|
|
|
53
52
|
.reduce((acc, val) => acc.concat(val), []);
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
export const editorToText = (
|
|
57
|
-
editor: BaseEditor & ReactEditor & HistoryEditor
|
|
58
|
-
) => {
|
|
55
|
+
export const editorToText = (editor: BaseEditor & ReactEditor & HistoryEditor) => {
|
|
59
56
|
const flattened = nodeChildrenToTextComponents(editor, editor.children);
|
|
60
57
|
|
|
61
58
|
const text = flattened.map((textComponent) => textComponent.text).join("\n");
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Editor,
|
|
3
|
-
Node,
|
|
4
|
-
Path,
|
|
5
|
-
Range,
|
|
6
|
-
Text,
|
|
7
|
-
Element,
|
|
8
|
-
BasePoint,
|
|
9
|
-
BaseRange,
|
|
10
|
-
Point,
|
|
11
|
-
} from "slate";
|
|
1
|
+
import { Editor, Node, Path, Range, Text, Element, BasePoint, BaseRange, Point } from "slate";
|
|
12
2
|
import { EditorAutocompleteState } from "../types/base/editor-autocomplete-state";
|
|
13
3
|
|
|
14
4
|
export interface EditorTextState {
|
|
@@ -19,9 +9,7 @@ export interface EditorTextState {
|
|
|
19
9
|
textAfterCursor: string;
|
|
20
10
|
}
|
|
21
11
|
|
|
22
|
-
export function getTextAroundCollapsedCursor(
|
|
23
|
-
editor: Editor
|
|
24
|
-
): EditorAutocompleteState | null {
|
|
12
|
+
export function getTextAroundCollapsedCursor(editor: Editor): EditorAutocompleteState | null {
|
|
25
13
|
const { selection } = editor;
|
|
26
14
|
if (!selection || !Range.isCollapsed(selection)) {
|
|
27
15
|
return null;
|
package/src/lib/retry.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { CustomEditor } from "../../types/base/custom-editor";
|
|
|
4
4
|
export function addAutocompletionsToEditor(
|
|
5
5
|
editor: CustomEditor,
|
|
6
6
|
newSuggestion: string,
|
|
7
|
-
point: BasePoint
|
|
7
|
+
point: BasePoint,
|
|
8
8
|
) {
|
|
9
9
|
const editorPosition = editor.selection;
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ export function addAutocompletionsToEditor(
|
|
|
20
20
|
],
|
|
21
21
|
{
|
|
22
22
|
at: point,
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
// restore cursor position
|
|
@@ -13,10 +13,7 @@ export function clearAutocompletionsFromEditor(editor: CustomEditor) {
|
|
|
13
13
|
try {
|
|
14
14
|
Transforms.removeNodes(editor, { at: path });
|
|
15
15
|
} catch (e) {
|
|
16
|
-
console.log(
|
|
17
|
-
"CopilotTextarea.clearAutocompletionsFromEditor: error removing node",
|
|
18
|
-
e
|
|
19
|
-
);
|
|
16
|
+
console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
19
|
}
|
|
@@ -3,14 +3,11 @@ import { HistoryEditor } from "slate-history";
|
|
|
3
3
|
|
|
4
4
|
// Copy-pasted from `https://github.com/ianstormtaylor/slate/blob/main/packages/slate-history/src/with-history.ts`
|
|
5
5
|
// With one exception: the `shouldSave` function is passed in as an argument to `withPartialHistory` instead of being hardcoded
|
|
6
|
-
export type ShouldSaveToHistory = (
|
|
7
|
-
op: Operation,
|
|
8
|
-
prev: Operation | undefined
|
|
9
|
-
) => boolean;
|
|
6
|
+
export type ShouldSaveToHistory = (op: Operation, prev: Operation | undefined) => boolean;
|
|
10
7
|
|
|
11
8
|
export const withPartialHistory = <T extends Editor>(
|
|
12
9
|
editor: T,
|
|
13
|
-
shouldSave: ShouldSaveToHistory
|
|
10
|
+
shouldSave: ShouldSaveToHistory,
|
|
14
11
|
) => {
|
|
15
12
|
const e = editor as T & HistoryEditor;
|
|
16
13
|
const { apply } = e;
|
|
@@ -69,8 +66,7 @@ export const withPartialHistory = <T extends Editor>(
|
|
|
69
66
|
const { operations, history } = e;
|
|
70
67
|
const { undos } = history;
|
|
71
68
|
const lastBatch = undos[undos.length - 1];
|
|
72
|
-
const lastOp =
|
|
73
|
-
lastBatch && lastBatch.operations[lastBatch.operations.length - 1];
|
|
69
|
+
const lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];
|
|
74
70
|
let save = HistoryEditor.isSaving(e);
|
|
75
71
|
let merge = HistoryEditor.isMerging(e);
|
|
76
72
|
|
|
@@ -144,10 +140,7 @@ const shouldMerge = (op: Operation, prev: Operation | undefined): boolean => {
|
|
|
144
140
|
return false;
|
|
145
141
|
};
|
|
146
142
|
|
|
147
|
-
export const defaultShouldSave = (
|
|
148
|
-
op: Operation,
|
|
149
|
-
prev: Operation | undefined
|
|
150
|
-
): boolean => {
|
|
143
|
+
export const defaultShouldSave = (op: Operation, prev: Operation | undefined): boolean => {
|
|
151
144
|
if (op.type === "set_selection") {
|
|
152
145
|
return false;
|
|
153
146
|
}
|
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
* @returns {ReadableStream<A>} - The flattened stream.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export function streamPromiseFlatten<A>(
|
|
12
|
-
promise: Promise<ReadableStream<A>>
|
|
13
|
-
): ReadableStream<A> {
|
|
11
|
+
export function streamPromiseFlatten<A>(promise: Promise<ReadableStream<A>>): ReadableStream<A> {
|
|
14
12
|
return new ReadableStream<A>({
|
|
15
13
|
async start(controller) {
|
|
16
14
|
try {
|
package/src/lib/utils.ts
CHANGED
|
@@ -8,13 +8,10 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
8
8
|
|
|
9
9
|
export const nanoid = customAlphabet(
|
|
10
10
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
11
|
-
7
|
|
11
|
+
7,
|
|
12
12
|
); // 7-character random string
|
|
13
13
|
|
|
14
|
-
export async function fetcher<JSON = any>(
|
|
15
|
-
input: RequestInfo,
|
|
16
|
-
init?: RequestInit
|
|
17
|
-
): Promise<JSON> {
|
|
14
|
+
export async function fetcher<JSON = any>(input: RequestInfo, init?: RequestInit): Promise<JSON> {
|
|
18
15
|
const res = await fetch(input, init);
|
|
19
16
|
|
|
20
17
|
if (!res.ok) {
|
|
@@ -43,13 +40,12 @@ export function formatDate(input: string | number | Date): string {
|
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
export const arraysAreEqual = (arr1: number[], arr2: number[]): boolean =>
|
|
46
|
-
arr1.length === arr2.length &&
|
|
47
|
-
arr1.every((value, index) => value === arr2[index]);
|
|
43
|
+
arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);
|
|
48
44
|
|
|
49
45
|
export function nullableCompatibleEqualityCheck<T>(
|
|
50
46
|
naiveEqualityCheck: (a: T, b: T) => boolean,
|
|
51
47
|
a: T | null | undefined,
|
|
52
|
-
b: T | null | undefined
|
|
48
|
+
b: T | null | undefined,
|
|
53
49
|
): boolean {
|
|
54
50
|
if (a === null || a === undefined || b === null || b === undefined) {
|
|
55
51
|
return a === b;
|
|
@@ -3,18 +3,14 @@ import { InsertionsApiConfig } from "./insertions-api-config";
|
|
|
3
3
|
import { SuggestionsApiConfig } from "./suggestions-api-config";
|
|
4
4
|
|
|
5
5
|
// Mostly mirrors a partial SuggestionsApiConfig, but with some fields MANDATORY.
|
|
6
|
-
export interface SuggestionsApiConfigUserSpecified
|
|
7
|
-
extends Partial<SuggestionsApiConfig> {}
|
|
6
|
+
export interface SuggestionsApiConfigUserSpecified extends Partial<SuggestionsApiConfig> {}
|
|
8
7
|
|
|
9
8
|
// Mostly mirrors a partial InsertionsApiConfig, but with some fields MANDATORY.
|
|
10
|
-
export interface InsertionsApiConfigUserSpecified
|
|
11
|
-
extends Partial<InsertionsApiConfig> {}
|
|
9
|
+
export interface InsertionsApiConfigUserSpecified extends Partial<InsertionsApiConfig> {}
|
|
12
10
|
|
|
13
11
|
// Mostly mirrors a partial AutosuggestionsConfig, but with some fields MANDATORY.
|
|
14
12
|
export interface AutosuggestionsConfigUserSpecified
|
|
15
|
-
extends Partial<
|
|
16
|
-
Omit<AutosuggestionsConfig, "chatApiConfigs" | "textareaPurpose">
|
|
17
|
-
> {
|
|
13
|
+
extends Partial<Omit<AutosuggestionsConfig, "chatApiConfigs" | "textareaPurpose">> {
|
|
18
14
|
textareaPurpose: string; // the user MUST specify textareaPurpose - it's not optional
|
|
19
15
|
chatApiConfigs: {
|
|
20
16
|
suggestionsApiConfig?: SuggestionsApiConfigUserSpecified;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "../base";
|
|
5
|
-
import {
|
|
6
|
-
SuggestionsApiConfig,
|
|
7
|
-
defaultSuggestionsApiConfig,
|
|
8
|
-
} from "./suggestions-api-config";
|
|
9
|
-
import {
|
|
10
|
-
InsertionsApiConfig,
|
|
11
|
-
defaultInsertionsApiConfig,
|
|
12
|
-
} from "./insertions-api-config";
|
|
1
|
+
import { BaseAutosuggestionsConfig, defaultBaseAutosuggestionsConfig } from "../base";
|
|
2
|
+
import { SuggestionsApiConfig, defaultSuggestionsApiConfig } from "./suggestions-api-config";
|
|
3
|
+
import { InsertionsApiConfig, defaultInsertionsApiConfig } from "./insertions-api-config";
|
|
13
4
|
import { ChatlikeApiEndpoint } from ".";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
defaultEditingApiConfig,
|
|
17
|
-
} from "./editing-api-config";
|
|
5
|
+
import { EditingApiConfig, defaultEditingApiConfig } from "./editing-api-config";
|
|
6
|
+
import { defaultCopilotContextCategories } from "@copilotkit/react-core";
|
|
18
7
|
|
|
19
8
|
// Like the base autosuggestions config, with 2 additional fields:
|
|
20
|
-
// 1.
|
|
9
|
+
// 1. contextCategories: string[] | undefined;
|
|
21
10
|
// 2. instead of apiConfigs, we have chatApiConfigs: a higher-level abstraction that uses a ChatGPT-like API endpoint.
|
|
22
|
-
export interface AutosuggestionsConfig
|
|
23
|
-
|
|
24
|
-
externalContextCategories: string[] | undefined;
|
|
11
|
+
export interface AutosuggestionsConfig extends Omit<BaseAutosuggestionsConfig, "apiConfig"> {
|
|
12
|
+
contextCategories: string[];
|
|
25
13
|
chatApiConfigs: {
|
|
26
14
|
suggestionsApiConfig: SuggestionsApiConfig;
|
|
27
15
|
insertionApiConfig: InsertionsApiConfig;
|
|
@@ -34,7 +22,7 @@ export const defaultAutosuggestionsConfig: Omit<
|
|
|
34
22
|
"textareaPurpose" | "apiEndpoint"
|
|
35
23
|
> = {
|
|
36
24
|
...defaultBaseAutosuggestionsConfig,
|
|
37
|
-
|
|
25
|
+
contextCategories: defaultCopilotContextCategories,
|
|
38
26
|
chatApiConfigs: {
|
|
39
27
|
suggestionsApiConfig: defaultSuggestionsApiConfig,
|
|
40
28
|
insertionApiConfig: defaultInsertionsApiConfig,
|
|
@@ -9,7 +9,7 @@ export interface EditingApiConfig {
|
|
|
9
9
|
|
|
10
10
|
export const defaultEditingMakeSystemPrompt: MakeSystemPrompt = (
|
|
11
11
|
textareaPurpose,
|
|
12
|
-
contextString
|
|
12
|
+
contextString,
|
|
13
13
|
) => {
|
|
14
14
|
return `You are a versatile writing assistant.
|
|
15
15
|
|
|
@@ -45,14 +45,12 @@ export const defaultEditingFewShotMessages: MinimalChatGPTMessage[] = [
|
|
|
45
45
|
{
|
|
46
46
|
role: "user",
|
|
47
47
|
name: "TextToEdit",
|
|
48
|
-
content:
|
|
49
|
-
"While I was there I also picked up some apples, oranges, and bananas. ",
|
|
48
|
+
content: "While I was there I also picked up some apples, oranges, and bananas. ",
|
|
50
49
|
},
|
|
51
50
|
{
|
|
52
51
|
role: "user",
|
|
53
52
|
name: "TextAfterCursor",
|
|
54
|
-
content:
|
|
55
|
-
"The grocery store was having a sale on fruit, so I decided to stock up.",
|
|
53
|
+
content: "The grocery store was having a sale on fruit, so I decided to stock up.",
|
|
56
54
|
},
|
|
57
55
|
{
|
|
58
56
|
role: "user",
|
|
@@ -9,7 +9,7 @@ export interface InsertionsApiConfig {
|
|
|
9
9
|
|
|
10
10
|
export const defaultInsertionsMakeSystemPrompt: MakeSystemPrompt = (
|
|
11
11
|
textareaPurpose,
|
|
12
|
-
contextString
|
|
12
|
+
contextString,
|
|
13
13
|
) => {
|
|
14
14
|
return `You are a versatile writing assistant.
|
|
15
15
|
|
|
@@ -39,8 +39,7 @@ export const defaultInsertionsFewShotMessages: MinimalChatGPTMessage[] = [
|
|
|
39
39
|
{
|
|
40
40
|
role: "user",
|
|
41
41
|
name: "TextAfterCursor",
|
|
42
|
-
content:
|
|
43
|
-
"While I was there I also picked up some apples, oranges, and bananas.",
|
|
42
|
+
content: "While I was there I also picked up some apples, oranges, and bananas.",
|
|
44
43
|
},
|
|
45
44
|
{
|
|
46
45
|
role: "user",
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CopilotApiConfig,
|
|
3
|
-
copilotApiConfigExtrapolator,
|
|
4
|
-
} from "@copilotkit/react-core";
|
|
1
|
+
import { CopilotApiConfig, copilotApiConfigExtrapolator } from "@copilotkit/react-core";
|
|
5
2
|
import { MinimalChatGPTMessage } from "./minimal-chat-gpt-message";
|
|
6
3
|
|
|
7
4
|
export type ChatlikeApiEndpointImpl = (
|
|
8
5
|
abortSignal: AbortSignal,
|
|
9
6
|
messages: MinimalChatGPTMessage[],
|
|
10
|
-
forwardedProps?: { [key: string]: any }
|
|
7
|
+
forwardedProps?: { [key: string]: any },
|
|
11
8
|
) => Promise<string>;
|
|
12
9
|
|
|
13
10
|
export type StreamingChatlikeApiEndpointImpl = (
|
|
14
11
|
abortSignal: AbortSignal,
|
|
15
12
|
messages: MinimalChatGPTMessage[],
|
|
16
|
-
forwardedProps?: { [key: string]: any }
|
|
13
|
+
forwardedProps?: { [key: string]: any },
|
|
17
14
|
) => Promise<ReadableStream<string>>;
|
|
18
15
|
|
|
19
16
|
export class ChatlikeApiEndpoint {
|
|
@@ -28,30 +25,25 @@ export class ChatlikeApiEndpoint {
|
|
|
28
25
|
* @param apiEndpoint The URL of the OpenAI-compatible API endpoint.
|
|
29
26
|
* @returns A new instance of ChatlikeApiEndpoint.
|
|
30
27
|
*/
|
|
31
|
-
static fromCopilotApiConfig(
|
|
32
|
-
copilotApiConfig: CopilotApiConfig
|
|
33
|
-
): ChatlikeApiEndpoint {
|
|
28
|
+
static fromCopilotApiConfig(copilotApiConfig: CopilotApiConfig): ChatlikeApiEndpoint {
|
|
34
29
|
return new ChatlikeApiEndpoint(
|
|
35
30
|
async (
|
|
36
31
|
abortSignal: AbortSignal,
|
|
37
32
|
messages: MinimalChatGPTMessage[],
|
|
38
|
-
forwardedProps?: { [key: string]: any }
|
|
33
|
+
forwardedProps?: { [key: string]: any },
|
|
39
34
|
) => {
|
|
40
|
-
const res = await fetch(
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
body
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
signal: abortSignal,
|
|
53
|
-
}
|
|
54
|
-
);
|
|
35
|
+
const res = await fetch(copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: {
|
|
38
|
+
...copilotApiConfig.headers,
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify({
|
|
41
|
+
...forwardedProps,
|
|
42
|
+
...copilotApiConfig.body,
|
|
43
|
+
messages: messages,
|
|
44
|
+
}),
|
|
45
|
+
signal: abortSignal,
|
|
46
|
+
});
|
|
55
47
|
|
|
56
48
|
const bodySteram: ReadableStream<Uint8Array> | null = res.body;
|
|
57
49
|
if (!bodySteram) {
|
|
@@ -62,7 +54,7 @@ export class ChatlikeApiEndpoint {
|
|
|
62
54
|
const stringStream = bodySteram.pipeThrough(new TextDecoderStream());
|
|
63
55
|
|
|
64
56
|
return stringStream;
|
|
65
|
-
}
|
|
57
|
+
},
|
|
66
58
|
);
|
|
67
59
|
}
|
|
68
60
|
|
|
@@ -9,7 +9,7 @@ export interface SuggestionsApiConfig {
|
|
|
9
9
|
|
|
10
10
|
export const defaultSuggestionsMakeSystemPrompt: MakeSystemPrompt = (
|
|
11
11
|
textareaPurpose,
|
|
12
|
-
contextString
|
|
12
|
+
contextString,
|
|
13
13
|
) => {
|
|
14
14
|
return `You are a versatile writing assistant.
|
|
15
15
|
|
|
@@ -39,8 +39,7 @@ export const defaultSuggestionsFewShotMessages: MinimalChatGPTMessage[] = [
|
|
|
39
39
|
{
|
|
40
40
|
role: "user",
|
|
41
41
|
name: "TextAfterCursor",
|
|
42
|
-
content:
|
|
43
|
-
"While I was there I also picked up some apples, oranges, and bananas.",
|
|
42
|
+
content: "While I was there I also picked up some apples, oranges, and bananas.",
|
|
44
43
|
},
|
|
45
44
|
{
|
|
46
45
|
role: "user",
|
|
@@ -11,14 +11,14 @@ export interface EditingEditorState extends InsertionEditorState {
|
|
|
11
11
|
|
|
12
12
|
export type AutosuggestionsBareFunction = (
|
|
13
13
|
editorState: InsertionEditorState,
|
|
14
|
-
abortSignal: AbortSignal
|
|
14
|
+
abortSignal: AbortSignal,
|
|
15
15
|
) => Promise<string>;
|
|
16
16
|
|
|
17
17
|
export type Generator_InsertionOrEditingSuggestion = (
|
|
18
18
|
editorState: EditingEditorState,
|
|
19
19
|
prompt: string,
|
|
20
20
|
documents: DocumentPointer[],
|
|
21
|
-
abortSignal: AbortSignal
|
|
21
|
+
abortSignal: AbortSignal,
|
|
22
22
|
) => Promise<ReadableStream<string>>;
|
|
23
23
|
|
|
24
24
|
export interface InsertionEditorApiConfig {
|