@copilotkit/react-textarea 1.4.1-pre.2 → 1.4.1-pre.6

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +50 -4
  2. package/dist/{chunk-DS52LMD2.mjs → chunk-53RID4IZ.mjs} +3 -3
  3. package/dist/{chunk-BG4GF6PP.mjs → chunk-PTPNOBEI.mjs} +2 -9
  4. package/dist/chunk-PTPNOBEI.mjs.map +1 -0
  5. package/dist/{chunk-VPGMB7K3.mjs → chunk-RXV67GJN.mjs} +4 -17
  6. package/dist/chunk-RXV67GJN.mjs.map +1 -0
  7. package/dist/components/copilot-textarea/copilot-textarea.js +4 -22
  8. package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
  9. package/dist/components/copilot-textarea/copilot-textarea.mjs +3 -3
  10. package/dist/components/index.js +4 -22
  11. package/dist/components/index.js.map +1 -1
  12. package/dist/components/index.mjs +3 -3
  13. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +1 -7
  14. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
  15. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
  16. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +3 -15
  17. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
  18. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
  19. package/dist/index.js +4 -22
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +3 -3
  22. package/package.json +7 -7
  23. package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +1 -8
  24. package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +2 -16
  25. package/dist/chunk-BG4GF6PP.mjs.map +0 -1
  26. package/dist/chunk-VPGMB7K3.mjs.map +0 -1
  27. /package/dist/{chunk-DS52LMD2.mjs.map → chunk-53RID4IZ.mjs.map} +0 -0
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  CopilotTextarea
3
- } from "../../chunk-DS52LMD2.mjs";
4
- import "../../chunk-VPGMB7K3.mjs";
5
- import "../../chunk-BG4GF6PP.mjs";
3
+ } from "../../chunk-53RID4IZ.mjs";
4
+ import "../../chunk-RXV67GJN.mjs";
5
+ import "../../chunk-PTPNOBEI.mjs";
6
6
  import "../../chunk-RUV6NBIF.mjs";
7
7
  import "../../chunk-ZTYA6QOT.mjs";
8
8
  import "../../chunk-EJGGLWWR.mjs";
@@ -1818,7 +1818,7 @@ function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
1818
1818
  // src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
1819
1819
  var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
1820
1820
  function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategories, apiConfig) {
1821
- const { getContextString, copilotApiConfig } = (0, import_react_core3.useCopilotContext)();
1821
+ const { getContextString, copilotApiConfig, runtimeClient } = (0, import_react_core3.useCopilotContext)();
1822
1822
  const { chatApiEndpoint: url, publicApiKey, credentials, properties } = copilotApiConfig;
1823
1823
  const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [import_shared.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
1824
1824
  const { maxTokens, stop } = apiConfig;
@@ -1848,12 +1848,6 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
1848
1848
  content: `<TextBeforeCursor>${editorState2.textBeforeCursor}</TextBeforeCursor>`
1849
1849
  })
1850
1850
  ].filter(Boolean);
1851
- const runtimeClient = new import_runtime_client_gql.CopilotRuntimeClient({
1852
- url,
1853
- publicApiKey,
1854
- headers,
1855
- credentials
1856
- });
1857
1851
  const response = yield runtimeClient.generateCopilotResponse({
1858
1852
  data: {
1859
1853
  frontend: {
@@ -2111,17 +2105,11 @@ var import_react_core5 = require("@copilotkit/react-core");
2111
2105
  var import_react14 = require("react");
2112
2106
  var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
2113
2107
  function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
2114
- const { getContextString, copilotApiConfig } = (0, import_react_core5.useCopilotContext)();
2108
+ const { getContextString, copilotApiConfig, runtimeClient } = (0, import_react_core5.useCopilotContext)();
2115
2109
  const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [import_shared2.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {});
2116
- const runtimeClient = new import_runtime_client_gql5.CopilotRuntimeClient({
2117
- url: copilotApiConfig.chatApiEndpoint,
2118
- publicApiKey: copilotApiConfig.publicApiKey,
2119
- headers,
2120
- credentials: copilotApiConfig.credentials
2121
- });
2122
2110
  function runtimeClientResponseToStringStream(responsePromise) {
2123
2111
  return __async(this, null, function* () {
2124
- const messagesStream = yield import_runtime_client_gql5.CopilotRuntimeClient.asStream(responsePromise);
2112
+ const messagesStream = runtimeClient.asStream(responsePromise);
2125
2113
  return new ReadableStream({
2126
2114
  start(controller) {
2127
2115
  return __async(this, null, function* () {
@@ -2226,14 +2214,8 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2226
2214
  content: `<EditingPrompt>${editingPrompt}</EditingPrompt>`
2227
2215
  })
2228
2216
  ];
2229
- const runtimeClient2 = new import_runtime_client_gql5.CopilotRuntimeClient({
2230
- url: copilotApiConfig.chatApiEndpoint,
2231
- publicApiKey: copilotApiConfig.publicApiKey,
2232
- headers,
2233
- credentials: copilotApiConfig.credentials
2234
- });
2235
2217
  return runtimeClientResponseToStringStream(
2236
- runtimeClient2.generateCopilotResponse({
2218
+ runtimeClient.generateCopilotResponse({
2237
2219
  data: {
2238
2220
  frontend: {
2239
2221
  actions: [],