@copilotkit/react-textarea 1.10.7-next.0 → 1.50.0-beta.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/CHANGELOG.md +0 -8
- package/dist/{chunk-HDBI2WN5.mjs → chunk-2IWVZ4PP.mjs} +17 -27
- package/dist/chunk-2IWVZ4PP.mjs.map +1 -0
- package/dist/{chunk-XW3ICO4S.mjs → chunk-3QJOFG3V.mjs} +1 -1
- package/dist/chunk-3QJOFG3V.mjs.map +1 -0
- package/dist/{chunk-HBWBHJ64.mjs → chunk-4VCJHANC.mjs} +9 -9
- package/dist/{chunk-7WVURIB7.mjs → chunk-5NZNJCP2.mjs} +21 -21
- package/dist/{chunk-2DF2AVDU.mjs → chunk-66KFI242.mjs} +2 -2
- package/dist/{chunk-C3PMJNQA.mjs → chunk-7VADGLV2.mjs} +6 -6
- package/dist/{chunk-RXV67GJN.mjs → chunk-DL3JWL2E.mjs} +4 -2
- package/dist/chunk-DL3JWL2E.mjs.map +1 -0
- package/dist/{chunk-7L6GIHDM.mjs → chunk-F2ULK22F.mjs} +1 -1
- package/dist/chunk-F2ULK22F.mjs.map +1 -0
- package/dist/{chunk-6SGWO63I.mjs → chunk-ISKK3RIW.mjs} +4 -4
- package/dist/chunk-JD7BAH7U.mjs +1 -0
- package/dist/{chunk-LQ2OWQU7.mjs → chunk-JLOABKLH.mjs} +2 -2
- package/dist/{chunk-LQ2OWQU7.mjs.map → chunk-JLOABKLH.mjs.map} +1 -1
- package/dist/{chunk-3PQ7GSFE.mjs → chunk-NAFNY4FL.mjs} +1 -1
- package/dist/chunk-NAFNY4FL.mjs.map +1 -0
- package/dist/{chunk-F6GMWOLE.mjs → chunk-ZQSEYPNN.mjs} +6 -25
- package/dist/chunk-ZQSEYPNN.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +17 -27
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +21 -21
- package/dist/components/base-copilot-textarea/render-element.d.ts +3 -2
- package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.d.ts +3 -2
- package/dist/components/base-copilot-textarea/render-placeholder.js.map +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.js +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.js +24 -48
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +75 -28
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js +16 -26
- package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.js +16 -26
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +8 -8
- 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 +5 -5
- 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 +6 -6
- 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 +6 -6
- package/dist/components/index.d.ts +2 -11
- package/dist/components/index.js +25 -531
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +23 -35
- package/dist/components/ui/command.d.ts +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +4 -20
- 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 +3 -1
- 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/hooks/misc/use-autosize-textarea.d.ts +1 -1
- package/dist/hooks/misc/use-autosize-textarea.js.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +76 -368
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -34
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +2 -2
- package/dist/types/autosuggestions-config/index.mjs +2 -2
- package/dist/types/index.mjs +3 -3
- package/package.json +22 -22
- package/src/components/base-copilot-textarea/render-element.tsx +2 -1
- package/src/components/base-copilot-textarea/render-placeholder.tsx +2 -1
- package/src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx +1 -1
- package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +28 -40
- package/src/components/index.ts +0 -3
- package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +24 -22
- package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +2 -1
- package/src/hooks/misc/use-autosize-textarea.tsx +1 -1
- package/dist/chunk-3PQ7GSFE.mjs.map +0 -1
- package/dist/chunk-7L6GIHDM.mjs.map +0 -1
- package/dist/chunk-F6GMWOLE.mjs.map +0 -1
- package/dist/chunk-HDBI2WN5.mjs.map +0 -1
- package/dist/chunk-MMVDU6DF.mjs +0 -1
- package/dist/chunk-NZIHZWRU.mjs +0 -60
- package/dist/chunk-NZIHZWRU.mjs.map +0 -1
- package/dist/chunk-RXV67GJN.mjs.map +0 -1
- package/dist/chunk-XW3ICO4S.mjs.map +0 -1
- /package/dist/{chunk-HBWBHJ64.mjs.map → chunk-4VCJHANC.mjs.map} +0 -0
- /package/dist/{chunk-7WVURIB7.mjs.map → chunk-5NZNJCP2.mjs.map} +0 -0
- /package/dist/{chunk-2DF2AVDU.mjs.map → chunk-66KFI242.mjs.map} +0 -0
- /package/dist/{chunk-C3PMJNQA.mjs.map → chunk-7VADGLV2.mjs.map} +0 -0
- /package/dist/{chunk-6SGWO63I.mjs.map → chunk-ISKK3RIW.mjs.map} +0 -0
- /package/dist/{chunk-MMVDU6DF.mjs.map → chunk-JD7BAH7U.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -81,7 +81,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
81
81
|
var src_exports = {};
|
|
82
82
|
__export(src_exports, {
|
|
83
83
|
BaseCopilotTextarea: () => BaseCopilotTextarea,
|
|
84
|
-
CopilotTextarea: () => CopilotTextarea,
|
|
85
84
|
defaultAutosuggestionsConfig: () => defaultAutosuggestionsConfig,
|
|
86
85
|
defaultBaseAutosuggestionsConfig: () => defaultBaseAutosuggestionsConfig
|
|
87
86
|
});
|
|
@@ -285,21 +284,21 @@ var withPartialHistory = (editor, shouldSave2) => {
|
|
|
285
284
|
const lastBatch = undos[undos.length - 1];
|
|
286
285
|
const lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];
|
|
287
286
|
let save = import_slate_history.HistoryEditor.isSaving(e);
|
|
288
|
-
let
|
|
287
|
+
let merge = import_slate_history.HistoryEditor.isMerging(e);
|
|
289
288
|
if (save == null) {
|
|
290
289
|
save = shouldSave2(op, lastOp);
|
|
291
290
|
}
|
|
292
291
|
if (save) {
|
|
293
|
-
if (
|
|
292
|
+
if (merge == null) {
|
|
294
293
|
if (lastBatch == null) {
|
|
295
|
-
|
|
294
|
+
merge = false;
|
|
296
295
|
} else if (operations.length !== 0) {
|
|
297
|
-
|
|
296
|
+
merge = true;
|
|
298
297
|
} else {
|
|
299
|
-
|
|
298
|
+
merge = shouldMerge(op, lastOp);
|
|
300
299
|
}
|
|
301
300
|
}
|
|
302
|
-
if (lastBatch &&
|
|
301
|
+
if (lastBatch && merge) {
|
|
303
302
|
lastBatch.operations.push(op);
|
|
304
303
|
} else {
|
|
305
304
|
const batch = {
|
|
@@ -683,32 +682,22 @@ var import_css = require("@emotion/css");
|
|
|
683
682
|
var import_react5 = __toESM(require("react"));
|
|
684
683
|
var import_react_dom = __toESM(require("react-dom"));
|
|
685
684
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
686
|
-
var Button = import_react5.default.forwardRef(
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
className,
|
|
703
|
-
import_css.css`
|
|
704
|
-
cursor: pointer;
|
|
705
|
-
color: ${reversed ? active ? "white" : "#aaa" : active ? "black" : "#ccc"};
|
|
706
|
-
`
|
|
707
|
-
)
|
|
708
|
-
})
|
|
709
|
-
);
|
|
710
|
-
}
|
|
711
|
-
);
|
|
685
|
+
var Button = import_react5.default.forwardRef((_a, ref) => {
|
|
686
|
+
var _b = _a, { className, active, reversed } = _b, props = __objRest(_b, ["className", "active", "reversed"]);
|
|
687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
688
|
+
"span",
|
|
689
|
+
__spreadProps(__spreadValues({}, props), {
|
|
690
|
+
ref,
|
|
691
|
+
className: (0, import_css.cx)(
|
|
692
|
+
className,
|
|
693
|
+
import_css.css`
|
|
694
|
+
cursor: pointer;
|
|
695
|
+
color: ${reversed ? active ? "white" : "#aaa" : active ? "black" : "#ccc"};
|
|
696
|
+
`
|
|
697
|
+
)
|
|
698
|
+
})
|
|
699
|
+
);
|
|
700
|
+
});
|
|
712
701
|
var Icon = import_react5.default.forwardRef(
|
|
713
702
|
(_a, ref) => {
|
|
714
703
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -1573,7 +1562,7 @@ var isSelectionEqual = (a, b) => {
|
|
|
1573
1562
|
return import_slate9.Range.equals(a, b);
|
|
1574
1563
|
};
|
|
1575
1564
|
function usePrevious(value) {
|
|
1576
|
-
const ref = (0, import_react11.useRef)();
|
|
1565
|
+
const ref = (0, import_react11.useRef)(void 0);
|
|
1577
1566
|
(0, import_react11.useEffect)(() => {
|
|
1578
1567
|
ref.current = value;
|
|
1579
1568
|
});
|
|
@@ -1791,102 +1780,8 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
|
|
|
1791
1780
|
};
|
|
1792
1781
|
}
|
|
1793
1782
|
|
|
1794
|
-
// src/components/copilot-textarea/copilot-textarea.tsx
|
|
1795
|
-
var import_react15 = __toESM(require("react"));
|
|
1796
|
-
|
|
1797
|
-
// src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
|
|
1798
|
-
var import_shared2 = require("@copilotkit/shared");
|
|
1799
|
-
var import_react_core3 = require("@copilotkit/react-core");
|
|
1800
|
-
var import_react13 = require("react");
|
|
1801
|
-
|
|
1802
|
-
// src/lib/retry.tsx
|
|
1803
|
-
function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
|
|
1804
|
-
return new Promise((resolve, reject) => {
|
|
1805
|
-
fn().then(resolve).catch((error) => {
|
|
1806
|
-
if (retriesLeft === 1) {
|
|
1807
|
-
reject(error);
|
|
1808
|
-
return;
|
|
1809
|
-
}
|
|
1810
|
-
setTimeout(() => {
|
|
1811
|
-
retry(fn, retriesLeft - 1, interval * backoff, backoff).then(resolve).catch(reject);
|
|
1812
|
-
}, interval);
|
|
1813
|
-
});
|
|
1814
|
-
});
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
// src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
|
|
1818
|
-
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
1819
|
-
function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategories, apiConfig) {
|
|
1820
|
-
const { getContextString, copilotApiConfig, runtimeClient } = (0, import_react_core3.useCopilotContext)();
|
|
1821
|
-
const { chatApiEndpoint: url, publicApiKey, credentials, properties } = copilotApiConfig;
|
|
1822
|
-
const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [import_shared2.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
1823
|
-
const { maxTokens, stop, temperature = 0 } = apiConfig;
|
|
1824
|
-
return (0, import_react13.useCallback)(
|
|
1825
|
-
(editorState2, abortSignal) => __async(this, null, function* () {
|
|
1826
|
-
const res = yield retry(() => __async(this, null, function* () {
|
|
1827
|
-
var _a, _b, _c;
|
|
1828
|
-
const messages = [
|
|
1829
|
-
new import_runtime_client_gql.TextMessage({
|
|
1830
|
-
role: import_runtime_client_gql.Role.System,
|
|
1831
|
-
content: apiConfig.makeSystemPrompt(
|
|
1832
|
-
textareaPurpose,
|
|
1833
|
-
getContextString([], contextCategories)
|
|
1834
|
-
)
|
|
1835
|
-
}),
|
|
1836
|
-
...apiConfig.fewShotMessages,
|
|
1837
|
-
editorState2.textAfterCursor != "" ? new import_runtime_client_gql.TextMessage({
|
|
1838
|
-
role: import_runtime_client_gql.Role.User,
|
|
1839
|
-
content: editorState2.textAfterCursor
|
|
1840
|
-
}) : null,
|
|
1841
|
-
new import_runtime_client_gql.TextMessage({
|
|
1842
|
-
role: import_runtime_client_gql.Role.User,
|
|
1843
|
-
content: `<TextAfterCursor>${editorState2.textAfterCursor}</TextAfterCursor>`
|
|
1844
|
-
}),
|
|
1845
|
-
new import_runtime_client_gql.TextMessage({
|
|
1846
|
-
role: import_runtime_client_gql.Role.User,
|
|
1847
|
-
content: `<TextBeforeCursor>${editorState2.textBeforeCursor}</TextBeforeCursor>`
|
|
1848
|
-
})
|
|
1849
|
-
].filter(Boolean);
|
|
1850
|
-
const response = yield runtimeClient.generateCopilotResponse({
|
|
1851
|
-
data: {
|
|
1852
|
-
frontend: {
|
|
1853
|
-
actions: [],
|
|
1854
|
-
url: window.location.href
|
|
1855
|
-
},
|
|
1856
|
-
messages: (0, import_runtime_client_gql.convertMessagesToGqlInput)((0, import_runtime_client_gql.filterAgentStateMessages)(messages)),
|
|
1857
|
-
metadata: {
|
|
1858
|
-
requestType: import_runtime_client_gql.CopilotRequestType.TextareaCompletion
|
|
1859
|
-
},
|
|
1860
|
-
forwardedParameters: {
|
|
1861
|
-
maxTokens,
|
|
1862
|
-
stop,
|
|
1863
|
-
temperature
|
|
1864
|
-
}
|
|
1865
|
-
},
|
|
1866
|
-
properties,
|
|
1867
|
-
signal: abortSignal
|
|
1868
|
-
}).toPromise();
|
|
1869
|
-
let result = "";
|
|
1870
|
-
for (const message of (0, import_runtime_client_gql.convertGqlOutputToMessages)(
|
|
1871
|
-
(_c = (_b = (_a = response.data) == null ? void 0 : _a.generateCopilotResponse) == null ? void 0 : _b.messages) != null ? _c : []
|
|
1872
|
-
)) {
|
|
1873
|
-
if (abortSignal.aborted) {
|
|
1874
|
-
break;
|
|
1875
|
-
}
|
|
1876
|
-
if (message.isTextMessage()) {
|
|
1877
|
-
result += message.content;
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
return result;
|
|
1881
|
-
}));
|
|
1882
|
-
return res;
|
|
1883
|
-
}),
|
|
1884
|
-
[apiConfig, getContextString, contextCategories, textareaPurpose]
|
|
1885
|
-
);
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
1783
|
// src/types/autosuggestions-config/suggestions-api-config.tsx
|
|
1889
|
-
var
|
|
1784
|
+
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
1890
1785
|
var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
1891
1786
|
return `You are a versatile writing assistant.
|
|
1892
1787
|
|
|
@@ -1913,28 +1808,28 @@ ${contextString}
|
|
|
1913
1808
|
`;
|
|
1914
1809
|
};
|
|
1915
1810
|
var defaultSuggestionsFewShotMessages = [
|
|
1916
|
-
new
|
|
1917
|
-
role:
|
|
1811
|
+
new import_runtime_client_gql.TextMessage({
|
|
1812
|
+
role: import_runtime_client_gql.Role.User,
|
|
1918
1813
|
content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
|
|
1919
1814
|
}),
|
|
1920
|
-
new
|
|
1921
|
-
role:
|
|
1815
|
+
new import_runtime_client_gql.TextMessage({
|
|
1816
|
+
role: import_runtime_client_gql.Role.User,
|
|
1922
1817
|
content: "This morning I woke up and went straight to the grocery store."
|
|
1923
1818
|
}),
|
|
1924
|
-
new
|
|
1925
|
-
role:
|
|
1819
|
+
new import_runtime_client_gql.TextMessage({
|
|
1820
|
+
role: import_runtime_client_gql.Role.Assistant,
|
|
1926
1821
|
content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
|
|
1927
1822
|
}),
|
|
1928
|
-
new
|
|
1929
|
-
role:
|
|
1823
|
+
new import_runtime_client_gql.TextMessage({
|
|
1824
|
+
role: import_runtime_client_gql.Role.User,
|
|
1930
1825
|
content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
|
|
1931
1826
|
}),
|
|
1932
|
-
new
|
|
1933
|
-
role:
|
|
1827
|
+
new import_runtime_client_gql.TextMessage({
|
|
1828
|
+
role: import_runtime_client_gql.Role.User,
|
|
1934
1829
|
content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
|
|
1935
1830
|
}),
|
|
1936
|
-
new
|
|
1937
|
-
role:
|
|
1831
|
+
new import_runtime_client_gql.TextMessage({
|
|
1832
|
+
role: import_runtime_client_gql.Role.Assistant,
|
|
1938
1833
|
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
1939
1834
|
})
|
|
1940
1835
|
];
|
|
@@ -1944,7 +1839,7 @@ var defaultSuggestionsApiConfig = {
|
|
|
1944
1839
|
};
|
|
1945
1840
|
|
|
1946
1841
|
// src/types/autosuggestions-config/insertions-api-config.tsx
|
|
1947
|
-
var
|
|
1842
|
+
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
1948
1843
|
var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
1949
1844
|
return `You are a versatile writing assistant helping the user insert new text into their existing work.
|
|
1950
1845
|
|
|
@@ -1973,36 +1868,36 @@ The conversation will be structured as follows:
|
|
|
1973
1868
|
`;
|
|
1974
1869
|
};
|
|
1975
1870
|
var defaultInsertionsFewShotMessages = [
|
|
1976
|
-
new
|
|
1977
|
-
role:
|
|
1871
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1872
|
+
role: import_runtime_client_gql2.Role.User,
|
|
1978
1873
|
content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
|
|
1979
1874
|
}),
|
|
1980
|
-
new
|
|
1981
|
-
role:
|
|
1875
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1876
|
+
role: import_runtime_client_gql2.Role.User,
|
|
1982
1877
|
content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store.</TextBeforeCursor>"
|
|
1983
1878
|
}),
|
|
1984
|
-
new
|
|
1985
|
-
role:
|
|
1879
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1880
|
+
role: import_runtime_client_gql2.Role.User,
|
|
1986
1881
|
content: "<InsertionPrompt>I bought a big watermelon</InsertionPrompt>"
|
|
1987
1882
|
}),
|
|
1988
|
-
new
|
|
1989
|
-
role:
|
|
1883
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1884
|
+
role: import_runtime_client_gql2.Role.Assistant,
|
|
1990
1885
|
content: "When I arrived I went straight to the produce section and picked out a big watermelon."
|
|
1991
1886
|
}),
|
|
1992
|
-
new
|
|
1993
|
-
role:
|
|
1887
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1888
|
+
role: import_runtime_client_gql2.Role.User,
|
|
1994
1889
|
content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
|
|
1995
1890
|
}),
|
|
1996
|
-
new
|
|
1997
|
-
role:
|
|
1891
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1892
|
+
role: import_runtime_client_gql2.Role.User,
|
|
1998
1893
|
content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
|
|
1999
1894
|
}),
|
|
2000
|
-
new
|
|
2001
|
-
role:
|
|
1895
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1896
|
+
role: import_runtime_client_gql2.Role.User,
|
|
2002
1897
|
content: "<InsertionPrompt>add section about the optionholder's pro rata share</InsertionPrompt>"
|
|
2003
1898
|
}),
|
|
2004
|
-
new
|
|
2005
|
-
role:
|
|
1899
|
+
new import_runtime_client_gql2.TextMessage({
|
|
1900
|
+
role: import_runtime_client_gql2.Role.Assistant,
|
|
2006
1901
|
content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
|
|
2007
1902
|
})
|
|
2008
1903
|
];
|
|
@@ -2013,7 +1908,7 @@ var defaultInsertionsApiConfig = {
|
|
|
2013
1908
|
};
|
|
2014
1909
|
|
|
2015
1910
|
// src/types/autosuggestions-config/editing-api-config.tsx
|
|
2016
|
-
var
|
|
1911
|
+
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2017
1912
|
var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
|
|
2018
1913
|
return `You are a versatile writing assistant helping the user edit a portion of their text.
|
|
2019
1914
|
|
|
@@ -2041,44 +1936,44 @@ The conversation will be structured as follows:
|
|
|
2041
1936
|
`;
|
|
2042
1937
|
};
|
|
2043
1938
|
var defaultEditingFewShotMessages = [
|
|
2044
|
-
new
|
|
2045
|
-
role:
|
|
1939
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1940
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2046
1941
|
content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>"
|
|
2047
1942
|
}),
|
|
2048
|
-
new
|
|
2049
|
-
role:
|
|
1943
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1944
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2050
1945
|
content: "<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>"
|
|
2051
1946
|
}),
|
|
2052
|
-
new
|
|
2053
|
-
role:
|
|
1947
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1948
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2054
1949
|
content: "<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>"
|
|
2055
1950
|
}),
|
|
2056
|
-
new
|
|
2057
|
-
role:
|
|
1951
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1952
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2058
1953
|
content: "<EditingPrompt>I also bought a big watermelon</EditingPrompt>"
|
|
2059
1954
|
}),
|
|
2060
|
-
new
|
|
2061
|
-
role:
|
|
1955
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1956
|
+
role: import_runtime_client_gql3.Role.Assistant,
|
|
2062
1957
|
content: "While I was there I picked up some apples, oranges, and bananas, and a big watermelon."
|
|
2063
1958
|
}),
|
|
2064
|
-
new
|
|
2065
|
-
role:
|
|
1959
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1960
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2066
1961
|
content: "<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>"
|
|
2067
1962
|
}),
|
|
2068
|
-
new
|
|
2069
|
-
role:
|
|
1963
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1964
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2070
1965
|
content: "<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>"
|
|
2071
1966
|
}),
|
|
2072
|
-
new
|
|
2073
|
-
role:
|
|
1967
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1968
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2074
1969
|
content: "<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>"
|
|
2075
1970
|
}),
|
|
2076
|
-
new
|
|
2077
|
-
role:
|
|
1971
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1972
|
+
role: import_runtime_client_gql3.Role.User,
|
|
2078
1973
|
content: "<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>"
|
|
2079
1974
|
}),
|
|
2080
|
-
new
|
|
2081
|
-
role:
|
|
1975
|
+
new import_runtime_client_gql3.TextMessage({
|
|
1976
|
+
role: import_runtime_client_gql3.Role.Assistant,
|
|
2082
1977
|
content: "It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project."
|
|
2083
1978
|
})
|
|
2084
1979
|
];
|
|
@@ -2089,205 +1984,18 @@ var defaultEditingApiConfig = {
|
|
|
2089
1984
|
};
|
|
2090
1985
|
|
|
2091
1986
|
// src/types/autosuggestions-config/autosuggestions-config.tsx
|
|
2092
|
-
var
|
|
1987
|
+
var import_react_core3 = require("@copilotkit/react-core");
|
|
2093
1988
|
var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
|
|
2094
|
-
contextCategories:
|
|
1989
|
+
contextCategories: import_react_core3.defaultCopilotContextCategories,
|
|
2095
1990
|
chatApiConfigs: {
|
|
2096
1991
|
suggestionsApiConfig: defaultSuggestionsApiConfig,
|
|
2097
1992
|
insertionApiConfig: defaultInsertionsApiConfig,
|
|
2098
1993
|
editingApiConfig: defaultEditingApiConfig
|
|
2099
1994
|
}
|
|
2100
1995
|
});
|
|
2101
|
-
|
|
2102
|
-
// src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx
|
|
2103
|
-
var import_shared3 = require("@copilotkit/shared");
|
|
2104
|
-
var import_react_core5 = require("@copilotkit/react-core");
|
|
2105
|
-
var import_react14 = require("react");
|
|
2106
|
-
var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
|
|
2107
|
-
function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
|
|
2108
|
-
const { getContextString, copilotApiConfig, runtimeClient } = (0, import_react_core5.useCopilotContext)();
|
|
2109
|
-
const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [import_shared3.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {});
|
|
2110
|
-
function runtimeClientResponseToStringStream(responsePromise) {
|
|
2111
|
-
return __async(this, null, function* () {
|
|
2112
|
-
const messagesStream = runtimeClient.asStream(responsePromise);
|
|
2113
|
-
return new ReadableStream({
|
|
2114
|
-
start(controller) {
|
|
2115
|
-
return __async(this, null, function* () {
|
|
2116
|
-
const reader = messagesStream.getReader();
|
|
2117
|
-
let sentContent = "";
|
|
2118
|
-
while (true) {
|
|
2119
|
-
const { done, value } = yield reader.read();
|
|
2120
|
-
if (done) {
|
|
2121
|
-
break;
|
|
2122
|
-
}
|
|
2123
|
-
const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(value.generateCopilotResponse.messages);
|
|
2124
|
-
let newContent = "";
|
|
2125
|
-
for (const message of messages) {
|
|
2126
|
-
if (message.isTextMessage()) {
|
|
2127
|
-
newContent += message.content;
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
if (newContent) {
|
|
2131
|
-
const contentToSend = newContent.slice(sentContent.length);
|
|
2132
|
-
controller.enqueue(contentToSend);
|
|
2133
|
-
sentContent += contentToSend;
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
controller.close();
|
|
2137
|
-
});
|
|
2138
|
-
}
|
|
2139
|
-
});
|
|
2140
|
-
});
|
|
2141
|
-
}
|
|
2142
|
-
const insertionFunction = (0, import_react14.useCallback)(
|
|
2143
|
-
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2144
|
-
const res = yield retry(() => __async(this, null, function* () {
|
|
2145
|
-
const messages = [
|
|
2146
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2147
|
-
role: import_runtime_client_gql5.Role.System,
|
|
2148
|
-
content: insertionApiConfig.makeSystemPrompt(
|
|
2149
|
-
textareaPurpose,
|
|
2150
|
-
getContextString(documents, contextCategories)
|
|
2151
|
-
)
|
|
2152
|
-
}),
|
|
2153
|
-
...insertionApiConfig.fewShotMessages,
|
|
2154
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2155
|
-
role: import_runtime_client_gql5.Role.User,
|
|
2156
|
-
content: `<TextAfterCursor>${editorState2.textAfterCursor}</TextAfterCursor>`
|
|
2157
|
-
}),
|
|
2158
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2159
|
-
role: import_runtime_client_gql5.Role.User,
|
|
2160
|
-
content: `<TextBeforeCursor>${editorState2.textBeforeCursor}</TextBeforeCursor>`
|
|
2161
|
-
}),
|
|
2162
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2163
|
-
role: import_runtime_client_gql5.Role.User,
|
|
2164
|
-
content: `<InsertionPrompt>${insertionPrompt}</InsertionPrompt>`
|
|
2165
|
-
})
|
|
2166
|
-
];
|
|
2167
|
-
return runtimeClientResponseToStringStream(
|
|
2168
|
-
runtimeClient.generateCopilotResponse({
|
|
2169
|
-
data: {
|
|
2170
|
-
frontend: {
|
|
2171
|
-
actions: [],
|
|
2172
|
-
url: window.location.href
|
|
2173
|
-
},
|
|
2174
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
|
|
2175
|
-
metadata: {
|
|
2176
|
-
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2177
|
-
}
|
|
2178
|
-
},
|
|
2179
|
-
properties: copilotApiConfig.properties,
|
|
2180
|
-
signal: abortSignal
|
|
2181
|
-
})
|
|
2182
|
-
);
|
|
2183
|
-
}));
|
|
2184
|
-
return res;
|
|
2185
|
-
}),
|
|
2186
|
-
[insertionApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
2187
|
-
);
|
|
2188
|
-
const editingFunction = (0, import_react14.useCallback)(
|
|
2189
|
-
(editorState2, editingPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2190
|
-
const res = yield retry(() => __async(this, null, function* () {
|
|
2191
|
-
const messages = [
|
|
2192
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2193
|
-
role: import_runtime_client_gql5.Role.System,
|
|
2194
|
-
content: editingApiConfig.makeSystemPrompt(
|
|
2195
|
-
textareaPurpose,
|
|
2196
|
-
getContextString(documents, contextCategories)
|
|
2197
|
-
)
|
|
2198
|
-
}),
|
|
2199
|
-
...editingApiConfig.fewShotMessages,
|
|
2200
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2201
|
-
role: import_runtime_client_gql5.Role.User,
|
|
2202
|
-
content: `<TextBeforeCursor>${editorState2.textBeforeCursor}</TextBeforeCursor>`
|
|
2203
|
-
}),
|
|
2204
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2205
|
-
role: import_runtime_client_gql5.Role.User,
|
|
2206
|
-
content: `<TextToEdit>${editorState2.selectedText}</TextToEdit>`
|
|
2207
|
-
}),
|
|
2208
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2209
|
-
role: import_runtime_client_gql5.Role.User,
|
|
2210
|
-
content: `<TextAfterCursor>${editorState2.textAfterCursor}</TextAfterCursor>`
|
|
2211
|
-
}),
|
|
2212
|
-
new import_runtime_client_gql5.TextMessage({
|
|
2213
|
-
role: import_runtime_client_gql5.Role.User,
|
|
2214
|
-
content: `<EditingPrompt>${editingPrompt}</EditingPrompt>`
|
|
2215
|
-
})
|
|
2216
|
-
];
|
|
2217
|
-
return runtimeClientResponseToStringStream(
|
|
2218
|
-
runtimeClient.generateCopilotResponse({
|
|
2219
|
-
data: {
|
|
2220
|
-
frontend: {
|
|
2221
|
-
actions: [],
|
|
2222
|
-
url: window.location.href
|
|
2223
|
-
},
|
|
2224
|
-
messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
|
|
2225
|
-
metadata: {
|
|
2226
|
-
requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
|
|
2227
|
-
}
|
|
2228
|
-
},
|
|
2229
|
-
properties: copilotApiConfig.properties,
|
|
2230
|
-
signal: abortSignal
|
|
2231
|
-
})
|
|
2232
|
-
);
|
|
2233
|
-
}));
|
|
2234
|
-
return res;
|
|
2235
|
-
}),
|
|
2236
|
-
[editingApiConfig, getContextString, contextCategories, textareaPurpose]
|
|
2237
|
-
);
|
|
2238
|
-
const insertionOrEditingFunction = (0, import_react14.useCallback)(
|
|
2239
|
-
(editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
|
|
2240
|
-
if (editorState2.selectedText === "") {
|
|
2241
|
-
return yield insertionFunction(editorState2, insertionPrompt, documents, abortSignal);
|
|
2242
|
-
} else {
|
|
2243
|
-
return yield editingFunction(editorState2, insertionPrompt, documents, abortSignal);
|
|
2244
|
-
}
|
|
2245
|
-
}),
|
|
2246
|
-
[insertionFunction, editingFunction]
|
|
2247
|
-
);
|
|
2248
|
-
return insertionOrEditingFunction;
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
// src/components/copilot-textarea/copilot-textarea.tsx
|
|
2252
|
-
var import_lodash = __toESM(require("lodash.merge"));
|
|
2253
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2254
|
-
var CopilotTextarea = import_react15.default.forwardRef(
|
|
2255
|
-
(props, ref) => {
|
|
2256
|
-
const _a = props, { autosuggestionsConfig: autosuggestionsConfigUserSpecified } = _a, forwardedProps = __objRest(_a, ["autosuggestionsConfig"]);
|
|
2257
|
-
const autosuggestionsConfig = (0, import_lodash.default)(
|
|
2258
|
-
defaultAutosuggestionsConfig,
|
|
2259
|
-
autosuggestionsConfigUserSpecified
|
|
2260
|
-
);
|
|
2261
|
-
const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
|
|
2262
|
-
autosuggestionsConfig.textareaPurpose,
|
|
2263
|
-
autosuggestionsConfig.contextCategories,
|
|
2264
|
-
autosuggestionsConfig.chatApiConfigs.suggestionsApiConfig
|
|
2265
|
-
);
|
|
2266
|
-
const insertionOrEditingFunction = useMakeStandardInsertionOrEditingFunction(
|
|
2267
|
-
autosuggestionsConfig.textareaPurpose,
|
|
2268
|
-
autosuggestionsConfig.contextCategories,
|
|
2269
|
-
autosuggestionsConfig.chatApiConfigs.insertionApiConfig,
|
|
2270
|
-
autosuggestionsConfig.chatApiConfigs.editingApiConfig
|
|
2271
|
-
);
|
|
2272
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2273
|
-
BaseCopilotTextarea,
|
|
2274
|
-
__spreadProps(__spreadValues({
|
|
2275
|
-
ref
|
|
2276
|
-
}, forwardedProps), {
|
|
2277
|
-
baseAutosuggestionsConfig: __spreadProps(__spreadValues({}, autosuggestionsConfig), {
|
|
2278
|
-
apiConfig: {
|
|
2279
|
-
insertionOrEditingFunction,
|
|
2280
|
-
autosuggestionsFunction
|
|
2281
|
-
}
|
|
2282
|
-
})
|
|
2283
|
-
})
|
|
2284
|
-
) });
|
|
2285
|
-
}
|
|
2286
|
-
);
|
|
2287
1996
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2288
1997
|
0 && (module.exports = {
|
|
2289
1998
|
BaseCopilotTextarea,
|
|
2290
|
-
CopilotTextarea,
|
|
2291
1999
|
defaultAutosuggestionsConfig,
|
|
2292
2000
|
defaultBaseAutosuggestionsConfig
|
|
2293
2001
|
});
|