@copilotkit/react-textarea 1.1.2 → 1.1.3-feat-runtime-remote-actions.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/CHANGELOG.md +26 -0
- package/README.md +32 -37
- package/dist/{chunk-MUAPKB7X.mjs → chunk-2XDYLKPH.mjs} +11 -8
- package/dist/chunk-2XDYLKPH.mjs.map +1 -0
- package/dist/{chunk-UUL4NSW5.mjs → chunk-4AMCUMC7.mjs} +2 -2
- package/dist/{chunk-3EU4PCFB.mjs → chunk-52SISOOU.mjs} +8 -6
- package/dist/chunk-52SISOOU.mjs.map +1 -0
- package/dist/{chunk-AKWXW22A.mjs → chunk-6OSHC73C.mjs} +4 -4
- package/dist/chunk-6OSHC73C.mjs.map +1 -0
- package/dist/{chunk-2RGJ6YD6.mjs → chunk-I3SPIGAI.mjs} +2 -2
- package/dist/{chunk-QQLDM3AI.mjs → chunk-I72DKFHD.mjs} +9 -3
- package/dist/chunk-I72DKFHD.mjs.map +1 -0
- package/dist/{chunk-OLYQNYUN.mjs → chunk-J62KUPFZ.mjs} +3 -3
- package/dist/chunk-QJNFNPWH.mjs +85 -0
- package/dist/chunk-QJNFNPWH.mjs.map +1 -0
- package/dist/{chunk-UNLOFAW7.mjs → chunk-UGEKMSRR.mjs} +5 -5
- package/dist/chunk-UGEKMSRR.mjs.map +1 -0
- package/dist/{chunk-Q5KJBZUF.mjs → chunk-VSVQZUPW.mjs} +2 -2
- package/dist/{chunk-5G7N3XVC.mjs → chunk-WGWQRALG.mjs} +2 -2
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +66 -70
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +8 -8
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +3 -1
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +5 -3
- package/dist/components/copilot-textarea/copilot-textarea.js +77 -78
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +11 -11
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +2 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +2 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +4 -4
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +6 -6
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +2 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +4 -4
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +4 -4
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +2 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +4 -4
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +5 -5
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +3 -2
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +1 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +4 -4
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +5 -5
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.js +77 -78
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -11
- package/dist/components/manual-ui/chip-with-icon.d.ts +3 -1
- package/dist/components/source-search-box/source-search-box.d.ts +3 -2
- package/dist/components/source-search-box/source-search-box.mjs +3 -3
- package/dist/components/ui/command.d.ts +20 -15
- package/dist/components/ui/command.js +8 -2
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/command.mjs +2 -2
- package/dist/components/ui/dialog.d.ts +3 -2
- package/dist/components/ui/dialog.js +8 -2
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dialog.mjs +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js +62 -66
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +4 -3
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +7 -5
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
- package/dist/index.css +0 -5
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +77 -78
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/lib/slatejs-edits/with-partial-history.d.ts +2 -4
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +1 -1
- package/dist/types/base/base-copilot-textarea-props.d.ts +4 -51
- package/dist/types/base/index.d.ts +52 -3
- package/dist/types/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/components/copilot-textarea/copilot-textarea.tsx +4 -2
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +3 -4
- package/src/components/ui/dialog.tsx +9 -2
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +63 -67
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +6 -4
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +8 -6
- package/dist/chunk-3EU4PCFB.mjs.map +0 -1
- package/dist/chunk-AKWXW22A.mjs.map +0 -1
- package/dist/chunk-FMQG2ZM3.mjs +0 -89
- package/dist/chunk-FMQG2ZM3.mjs.map +0 -1
- package/dist/chunk-MUAPKB7X.mjs.map +0 -1
- package/dist/chunk-QQLDM3AI.mjs.map +0 -1
- package/dist/chunk-UNLOFAW7.mjs.map +0 -1
- /package/dist/{chunk-UUL4NSW5.mjs.map → chunk-4AMCUMC7.mjs.map} +0 -0
- /package/dist/{chunk-2RGJ6YD6.mjs.map → chunk-I3SPIGAI.mjs.map} +0 -0
- /package/dist/{chunk-OLYQNYUN.mjs.map → chunk-J62KUPFZ.mjs.map} +0 -0
- /package/dist/{chunk-Q5KJBZUF.mjs.map → chunk-VSVQZUPW.mjs.map} +0 -0
- /package/dist/{chunk-5G7N3XVC.mjs.map → chunk-WGWQRALG.mjs.map} +0 -0
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCopilotTextarea
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-J62KUPFZ.mjs";
|
|
4
4
|
import "../../chunk-2C7O2EVM.mjs";
|
|
5
5
|
import "../../chunk-GQN2HYFJ.mjs";
|
|
6
6
|
import "../../chunk-23Q6A46J.mjs";
|
|
7
7
|
import "../../chunk-AJ5OMEXM.mjs";
|
|
8
8
|
import "../../chunk-DRV2FOHZ.mjs";
|
|
9
9
|
import "../../chunk-4NHVQZ67.mjs";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-QJNFNPWH.mjs";
|
|
11
11
|
import "../../chunk-5UNJXFUO.mjs";
|
|
12
12
|
import "../../chunk-LQ2OWQU7.mjs";
|
|
13
13
|
import "../../chunk-7LSRNPNI.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-4AMCUMC7.mjs";
|
|
15
15
|
import "../../chunk-L7VVZH4Q.mjs";
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-I3SPIGAI.mjs";
|
|
17
|
+
import "../../chunk-UGEKMSRR.mjs";
|
|
18
18
|
import "../../chunk-KMVGEY7Q.mjs";
|
|
19
19
|
import "../../chunk-3PQ7GSFE.mjs";
|
|
20
20
|
import "../../chunk-4PDYALMP.mjs";
|
|
21
21
|
import "../../chunk-D47EKHIF.mjs";
|
|
22
22
|
import "../../chunk-LYB4B6MK.mjs";
|
|
23
23
|
import "../../chunk-CF5GISTC.mjs";
|
|
24
|
-
import "../../chunk-
|
|
25
|
-
import "../../chunk-
|
|
26
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-WGWQRALG.mjs";
|
|
25
|
+
import "../../chunk-VSVQZUPW.mjs";
|
|
26
|
+
import "../../chunk-I72DKFHD.mjs";
|
|
27
27
|
import "../../chunk-2QDCE7PD.mjs";
|
|
28
28
|
import "../../chunk-YLFAIYRY.mjs";
|
|
29
29
|
import "../../chunk-WJHSY5T6.mjs";
|
package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
1
3
|
interface TrackerTextEditedSinceLastCursorMovementProps {
|
|
2
4
|
setCursorMovedSinceLastTextChange: (value: boolean) => void;
|
|
3
5
|
}
|
|
4
|
-
declare function TrackerTextEditedSinceLastCursorMovement(props: TrackerTextEditedSinceLastCursorMovementProps): JSX.Element;
|
|
6
|
+
declare function TrackerTextEditedSinceLastCursorMovement(props: TrackerTextEditedSinceLastCursorMovementProps): react_jsx_runtime.JSX.Element;
|
|
5
7
|
|
|
6
8
|
export { TrackerTextEditedSinceLastCursorMovement };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { BaseCopilotTextareaProps } from '../../types/base/
|
|
2
|
+
import { BaseCopilotTextareaProps } from '../../types/base/index.js';
|
|
3
3
|
import { HTMLCopilotTextAreaElement } from '../../types/html-copilot-textarea-element.js';
|
|
4
4
|
import { AutosuggestionsConfigUserSpecified } from '../../types/autosuggestions-config/autosuggestions-config-user-specified.js';
|
|
5
5
|
import '../../types/base/base-autosuggestions-config.js';
|
|
@@ -26,7 +26,8 @@ import '../../types/autosuggestions-config/editing-api-config.js';
|
|
|
26
26
|
* ## Example
|
|
27
27
|
*
|
|
28
28
|
* ```tsx
|
|
29
|
-
* import { CopilotTextarea } from '@copilot/react-
|
|
29
|
+
* import { CopilotTextarea } from '@copilot/react-textarea';
|
|
30
|
+
* import "@copilotkit/react-textarea/styles.css";
|
|
30
31
|
*
|
|
31
32
|
* <CopilotTextarea
|
|
32
33
|
* autosuggestionsConfig={{
|
|
@@ -55,8 +56,9 @@ import '../../types/autosuggestions-config/editing-api-config.js';
|
|
|
55
56
|
* For example:
|
|
56
57
|
*
|
|
57
58
|
* ```tsx
|
|
58
|
-
* import { CopilotTextarea } from "@copilotkit/react-textarea";
|
|
59
59
|
* import { useState } from "react";
|
|
60
|
+
* import { CopilotTextarea } from "@copilotkit/react-textarea";
|
|
61
|
+
* import "@copilotkit/react-textarea/styles.css";
|
|
60
62
|
*
|
|
61
63
|
* export function ExampleComponent() {
|
|
62
64
|
* const [text, setText] = useState("");
|
|
@@ -107,7 +107,7 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
|
107
107
|
// src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
|
|
108
108
|
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
109
109
|
function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategories, apiConfig) {
|
|
110
|
-
const { getContextString, copilotApiConfig } = (0,
|
|
110
|
+
const { getContextString, copilotApiConfig } = (0, import_react_core.useCopilotContext)();
|
|
111
111
|
const { chatApiEndpoint: url, publicApiKey, credentials, properties } = copilotApiConfig;
|
|
112
112
|
const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [import_shared.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
113
113
|
const { maxTokens, stop } = apiConfig;
|
|
@@ -146,9 +146,10 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
|
|
|
146
146
|
const response = yield runtimeClient.generateCopilotResponse({
|
|
147
147
|
data: {
|
|
148
148
|
frontend: {
|
|
149
|
-
actions: []
|
|
149
|
+
actions: [],
|
|
150
|
+
url: window.location.href
|
|
150
151
|
},
|
|
151
|
-
messages: (0, import_runtime_client_gql.convertMessagesToGqlInput)(messages),
|
|
152
|
+
messages: (0, import_runtime_client_gql.convertMessagesToGqlInput)((0, import_runtime_client_gql.filterAgentStateMessages)(messages)),
|
|
152
153
|
metadata: {
|
|
153
154
|
requestType: import_runtime_client_gql.CopilotRequestType.TextareaCompletion
|
|
154
155
|
},
|
|
@@ -854,78 +855,74 @@ function replaceEditorText(editor, newText) {
|
|
|
854
855
|
|
|
855
856
|
// src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts
|
|
856
857
|
function usePopulateCopilotTextareaRef(editor, ref) {
|
|
857
|
-
import_react4.default.useImperativeHandle(
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
if (
|
|
867
|
-
|
|
868
|
-
if (typeof value === "function") {
|
|
869
|
-
return value.bind(this.customMethods);
|
|
870
|
-
}
|
|
871
|
-
return value;
|
|
872
|
-
} else if (this.isKeyOfHTMLElement(propKey)) {
|
|
873
|
-
const value = this.editorHtmlElement[propKey];
|
|
874
|
-
if (typeof value === "function") {
|
|
875
|
-
return value.bind(this.editorHtmlElement);
|
|
876
|
-
}
|
|
877
|
-
return value;
|
|
858
|
+
import_react4.default.useImperativeHandle(ref, () => {
|
|
859
|
+
class Combined {
|
|
860
|
+
constructor(customMethods2, editorHtmlElement2) {
|
|
861
|
+
this.customMethods = customMethods2;
|
|
862
|
+
this.editorHtmlElement = editorHtmlElement2;
|
|
863
|
+
}
|
|
864
|
+
get(target, propKey) {
|
|
865
|
+
if (this.isKeyOfCustomMethods(propKey)) {
|
|
866
|
+
const value = this.customMethods[propKey];
|
|
867
|
+
if (typeof value === "function") {
|
|
868
|
+
return value.bind(this.customMethods);
|
|
878
869
|
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
this.editorHtmlElement[propKey] = value;
|
|
885
|
-
} else {
|
|
886
|
-
target[propKey] = value;
|
|
870
|
+
return value;
|
|
871
|
+
} else if (this.isKeyOfHTMLElement(propKey)) {
|
|
872
|
+
const value = this.editorHtmlElement[propKey];
|
|
873
|
+
if (typeof value === "function") {
|
|
874
|
+
return value.bind(this.editorHtmlElement);
|
|
887
875
|
}
|
|
888
|
-
return
|
|
889
|
-
}
|
|
890
|
-
isKeyOfCustomMethods(key) {
|
|
891
|
-
return key in this.customMethods;
|
|
892
|
-
}
|
|
893
|
-
isKeyOfHTMLElement(key) {
|
|
894
|
-
return key in this.editorHtmlElement;
|
|
876
|
+
return value;
|
|
895
877
|
}
|
|
896
878
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
};
|
|
905
|
-
class CustomMethods {
|
|
906
|
-
constructor(editor2) {
|
|
907
|
-
this.editor = editor2;
|
|
908
|
-
}
|
|
909
|
-
focus() {
|
|
910
|
-
import_slate_react2.ReactEditor.focus(this.editor);
|
|
911
|
-
}
|
|
912
|
-
blur() {
|
|
913
|
-
import_slate_react2.ReactEditor.blur(this.editor);
|
|
914
|
-
}
|
|
915
|
-
get value() {
|
|
916
|
-
return getFullEditorTextWithNewlines(this.editor);
|
|
917
|
-
}
|
|
918
|
-
set value(value) {
|
|
919
|
-
replaceEditorText(this.editor, value);
|
|
879
|
+
set(target, propKey, value) {
|
|
880
|
+
if (this.isKeyOfCustomMethods(propKey)) {
|
|
881
|
+
this.customMethods[propKey] = value;
|
|
882
|
+
} else if (this.isKeyOfHTMLElement(propKey)) {
|
|
883
|
+
this.editorHtmlElement[propKey] = value;
|
|
884
|
+
} else {
|
|
885
|
+
target[propKey] = value;
|
|
920
886
|
}
|
|
887
|
+
return true;
|
|
921
888
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
889
|
+
isKeyOfCustomMethods(key) {
|
|
890
|
+
return key in this.customMethods;
|
|
891
|
+
}
|
|
892
|
+
isKeyOfHTMLElement(key) {
|
|
893
|
+
return key in this.editorHtmlElement;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
const handler = {
|
|
897
|
+
get(target, propKey) {
|
|
898
|
+
return target.get(target, propKey);
|
|
899
|
+
},
|
|
900
|
+
set(target, propKey, value) {
|
|
901
|
+
return target.set(target, propKey, value);
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
class CustomMethods {
|
|
905
|
+
constructor(editor2) {
|
|
906
|
+
this.editor = editor2;
|
|
907
|
+
}
|
|
908
|
+
focus() {
|
|
909
|
+
import_slate_react2.ReactEditor.focus(this.editor);
|
|
910
|
+
}
|
|
911
|
+
blur() {
|
|
912
|
+
import_slate_react2.ReactEditor.blur(this.editor);
|
|
913
|
+
}
|
|
914
|
+
get value() {
|
|
915
|
+
return getFullEditorTextWithNewlines(this.editor);
|
|
916
|
+
}
|
|
917
|
+
set value(value) {
|
|
918
|
+
replaceEditorText(this.editor, value);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
const editorHtmlElement = import_slate_react2.ReactEditor.toDOMNode(editor, editor);
|
|
922
|
+
const customMethods = new CustomMethods(editor);
|
|
923
|
+
const combined = new Combined(customMethods, editorHtmlElement);
|
|
924
|
+
return new Proxy(combined, handler);
|
|
925
|
+
}, [editor]);
|
|
929
926
|
}
|
|
930
927
|
|
|
931
928
|
// src/lib/slatejs-edits/add-autocompletions.ts
|
|
@@ -1152,6 +1149,9 @@ function Logo({
|
|
|
1152
1149
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", style: { width, height }, children });
|
|
1153
1150
|
}
|
|
1154
1151
|
|
|
1152
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
1153
|
+
var import_react_core4 = require("@copilotkit/react-core");
|
|
1154
|
+
|
|
1155
1155
|
// src/components/ui/button.tsx
|
|
1156
1156
|
var React3 = __toESM(require("react"));
|
|
1157
1157
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
@@ -1232,9 +1232,6 @@ function streamPromiseFlatten(promise) {
|
|
|
1232
1232
|
});
|
|
1233
1233
|
}
|
|
1234
1234
|
|
|
1235
|
-
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
1236
|
-
var import_react_core4 = require("@copilotkit/react-core");
|
|
1237
|
-
|
|
1238
1235
|
// src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx
|
|
1239
1236
|
var import_Chip = __toESM(require("@mui/material/Chip/Chip.js"));
|
|
1240
1237
|
var import_Avatar = __toESM(require("@mui/material/Avatar/Avatar.js"));
|
|
@@ -1299,7 +1296,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1299
1296
|
insertionOrEditingFunction,
|
|
1300
1297
|
contextCategories
|
|
1301
1298
|
}) => {
|
|
1302
|
-
const { getDocumentsContext } = (0,
|
|
1299
|
+
const { getDocumentsContext } = (0, import_react_core4.useCopilotContext)();
|
|
1303
1300
|
const [editSuggestion, setEditSuggestion] = (0, import_react8.useState)("");
|
|
1304
1301
|
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react8.useState)(false);
|
|
1305
1302
|
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react8.useState)("");
|
|
@@ -2104,7 +2101,7 @@ var import_react_core5 = require("@copilotkit/react-core");
|
|
|
2104
2101
|
var import_react14 = require("react");
|
|
2105
2102
|
var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
|
|
2106
2103
|
function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
|
|
2107
|
-
const { getContextString, copilotApiConfig } = (0,
|
|
2104
|
+
const { getContextString, copilotApiConfig } = (0, import_react_core5.useCopilotContext)();
|
|
2108
2105
|
const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [import_shared2.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {});
|
|
2109
2106
|
const runtimeClient = new import_runtime_client_gql5.CopilotRuntimeClient({
|
|
2110
2107
|
url: copilotApiConfig.chatApiEndpoint,
|
|
@@ -2173,9 +2170,10 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2173
2170
|
runtimeClient.generateCopilotResponse({
|
|
2174
2171
|
data: {
|
|
2175
2172
|
frontend: {
|
|
2176
|
-
actions: []
|
|
2173
|
+
actions: [],
|
|
2174
|
+
url: window.location.href
|
|
2177
2175
|
},
|
|
2178
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(messages),
|
|
2176
|
+
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
|
|
2179
2177
|
metadata: {
|
|
2180
2178
|
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2181
2179
|
}
|
|
@@ -2228,9 +2226,10 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
|
|
|
2228
2226
|
runtimeClient2.generateCopilotResponse({
|
|
2229
2227
|
data: {
|
|
2230
2228
|
frontend: {
|
|
2231
|
-
actions: []
|
|
2229
|
+
actions: [],
|
|
2230
|
+
url: window.location.href
|
|
2232
2231
|
},
|
|
2233
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(messages),
|
|
2232
|
+
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
|
|
2234
2233
|
metadata: {
|
|
2235
2234
|
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2236
2235
|
}
|