@copilotkit/react-ui 1.5.12-next.5 → 1.5.12-next.7

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 (38) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{chunk-CLC5XZLK.mjs → chunk-DGGCSR5M.mjs} +2 -2
  3. package/dist/{chunk-AFVE4KVO.mjs → chunk-E5SIPE2R.mjs} +2 -2
  4. package/dist/{chunk-IZY3KREJ.mjs → chunk-GDOB4BYD.mjs} +2 -2
  5. package/dist/{chunk-RJCZRKTV.mjs → chunk-WGAZXTUA.mjs} +2 -1
  6. package/dist/chunk-WGAZXTUA.mjs.map +1 -0
  7. package/dist/{chunk-ZYA5BMQA.mjs → chunk-YGWWZL4N.mjs} +2 -2
  8. package/dist/components/chat/Chat.js +1 -0
  9. package/dist/components/chat/Chat.js.map +1 -1
  10. package/dist/components/chat/Chat.mjs +2 -2
  11. package/dist/components/chat/Modal.js +1 -0
  12. package/dist/components/chat/Modal.js.map +1 -1
  13. package/dist/components/chat/Modal.mjs +3 -3
  14. package/dist/components/chat/Popup.js +1 -0
  15. package/dist/components/chat/Popup.js.map +1 -1
  16. package/dist/components/chat/Popup.mjs +4 -4
  17. package/dist/components/chat/Sidebar.js +1 -0
  18. package/dist/components/chat/Sidebar.js.map +1 -1
  19. package/dist/components/chat/Sidebar.mjs +4 -4
  20. package/dist/components/chat/Suggestion.js +1 -0
  21. package/dist/components/chat/Suggestion.js.map +1 -1
  22. package/dist/components/chat/Suggestion.mjs +1 -1
  23. package/dist/components/chat/index.js +1 -0
  24. package/dist/components/chat/index.js.map +1 -1
  25. package/dist/components/chat/index.mjs +5 -5
  26. package/dist/components/index.js +1 -0
  27. package/dist/components/index.js.map +1 -1
  28. package/dist/components/index.mjs +5 -5
  29. package/dist/index.js +1 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +5 -5
  32. package/package.json +4 -4
  33. package/src/components/chat/Suggestion.tsx +1 -0
  34. package/dist/chunk-RJCZRKTV.mjs.map +0 -1
  35. /package/dist/{chunk-CLC5XZLK.mjs.map → chunk-DGGCSR5M.mjs.map} +0 -0
  36. /package/dist/{chunk-AFVE4KVO.mjs.map → chunk-E5SIPE2R.mjs.map} +0 -0
  37. /package/dist/{chunk-IZY3KREJ.mjs.map → chunk-GDOB4BYD.mjs.map} +0 -0
  38. /package/dist/{chunk-ZYA5BMQA.mjs.map → chunk-YGWWZL4N.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # ui
2
2
 
3
+ ## 1.5.12-next.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [926499b]
8
+ - @copilotkit/react-core@1.5.12-next.7
9
+ - @copilotkit/runtime-client-gql@1.5.12-next.7
10
+ - @copilotkit/shared@1.5.12-next.7
11
+
12
+ ## 1.5.12-next.6
13
+
14
+ ### Patch Changes
15
+
16
+ - 6136a57: - fix(errors): add custom error classes to better describe library errors
17
+ - fix(errors): use new errors in error handling
18
+ - chore: add documentation and links to respective errors
19
+ - Updated dependencies [6136a57]
20
+ - @copilotkit/react-core@1.5.12-next.6
21
+ - @copilotkit/runtime-client-gql@1.5.12-next.6
22
+ - @copilotkit/shared@1.5.12-next.6
23
+
3
24
  ## 1.5.12-next.5
4
25
 
5
26
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-AFVE4KVO.mjs";
3
+ } from "./chunk-E5SIPE2R.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
27
27
  export {
28
28
  CopilotSidebar
29
29
  };
30
- //# sourceMappingURL=chunk-CLC5XZLK.mjs.map
30
+ //# sourceMappingURL=chunk-DGGCSR5M.mjs.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-RQNJNK2W.mjs";
10
10
  import {
11
11
  CopilotChat
12
- } from "./chunk-ZYA5BMQA.mjs";
12
+ } from "./chunk-YGWWZL4N.mjs";
13
13
  import {
14
14
  UserMessage
15
15
  } from "./chunk-HEIDCT7I.mjs";
@@ -102,4 +102,4 @@ var CopilotModal = ({
102
102
  export {
103
103
  CopilotModal
104
104
  };
105
- //# sourceMappingURL=chunk-AFVE4KVO.mjs.map
105
+ //# sourceMappingURL=chunk-E5SIPE2R.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-AFVE4KVO.mjs";
3
+ } from "./chunk-E5SIPE2R.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
18
18
  export {
19
19
  CopilotPopup
20
20
  };
21
- //# sourceMappingURL=chunk-IZY3KREJ.mjs.map
21
+ //# sourceMappingURL=chunk-GDOB4BYD.mjs.map
@@ -22,6 +22,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
22
22
  onClick(message);
23
23
  },
24
24
  className: className || "suggestion",
25
+ "data-test-id": "suggestion",
25
26
  children: [
26
27
  partial && SmallSpinnerIcon,
27
28
  /* @__PURE__ */ jsx("span", { children: title })
@@ -103,4 +104,4 @@ export {
103
104
  Suggestion,
104
105
  reloadSuggestions
105
106
  };
106
- //# sourceMappingURL=chunk-RJCZRKTV.mjs.map
107
+ //# sourceMappingURL=chunk-WGAZXTUA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Suggestion.tsx"],"sourcesContent":["import {\n CopilotContextParams,\n extract,\n CopilotChatSuggestionConfiguration,\n CopilotMessagesContextParams,\n} from \"@copilotkit/react-core\";\nimport { SuggestionsProps } from \"./props\";\nimport { SmallSpinnerIcon } from \"./Icons\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport { CopilotRequestType } from \"@copilotkit/runtime-client-gql\";\n\nexport function Suggestion({ title, message, onClick, partial, className }: SuggestionsProps) {\n return (\n <button\n disabled={partial}\n onClick={(e) => {\n e.preventDefault();\n onClick(message);\n }}\n className={className || \"suggestion\"}\n data-test-id=\"suggestion\"\n >\n {partial && SmallSpinnerIcon}\n <span>{title}</span>\n </button>\n );\n}\n\nexport const reloadSuggestions = async (\n context: CopilotContextParams & CopilotMessagesContextParams,\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration },\n setCurrentSuggestions: (suggestions: { title: string; message: string }[]) => void,\n abortControllerRef: React.MutableRefObject<AbortController | null>,\n) => {\n const abortController = abortControllerRef.current;\n\n const tools = JSON.stringify(\n Object.values(context.actions).map((action) => ({\n name: action.name,\n description: action.description,\n jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters)),\n })),\n );\n\n const allSuggestions: CopilotChatSuggestion[] = [];\n\n for (const config of Object.values(chatSuggestionConfiguration)) {\n try {\n const numOfSuggestionsInstructions =\n config.minSuggestions === 0\n ? `Produce up to ${config.maxSuggestions} suggestions. ` +\n `If there are no highly relevant suggestions you can think of, provide an empty array.`\n : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;\n\n const result = await extract({\n context,\n instructions:\n \"Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. \",\n data:\n config.instructions +\n \"\\n\\n\" +\n numOfSuggestionsInstructions +\n \"\\n\\n\" +\n \"Available tools: \" +\n tools +\n \"\\n\\n\",\n requestType: CopilotRequestType.Task,\n parameters: [\n {\n name: \"suggestions\",\n type: \"object[]\",\n attributes: [\n {\n name: \"title\",\n description:\n \"The title of the suggestion. This is shown as a button and should be short.\",\n type: \"string\",\n },\n {\n name: \"message\",\n description:\n \"The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.\",\n type: \"string\",\n },\n ],\n },\n ],\n include: {\n messages: true,\n readable: true,\n },\n abortSignal: abortController?.signal,\n stream: ({ status, args }) => {\n const suggestions = args.suggestions || [];\n const newSuggestions: CopilotChatSuggestion[] = [];\n for (let i = 0; i < suggestions.length; i++) {\n // if GPT provides too many suggestions, limit the number of suggestions\n if (config.maxSuggestions !== undefined && i >= config.maxSuggestions) {\n break;\n }\n const { title, message } = suggestions[i];\n\n // If this is the last suggestion and the status is not complete, mark it as partial\n const partial = i == suggestions.length - 1 && status !== \"complete\";\n\n newSuggestions.push({\n title,\n message,\n partial,\n className: config.className,\n });\n }\n setCurrentSuggestions([...allSuggestions, ...newSuggestions]);\n },\n });\n allSuggestions.push(...result.suggestions);\n } catch (error) {\n console.error(\"Error loading suggestions\", error);\n }\n }\n\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n};\n"],"mappings":";;;;;;;;AAAA;AAAA,EAEE;AAAA,OAGK;AAIP,SAAS,oCAAoC;AAC7C,SAAS,0BAA0B;AAI/B,SAUE,KAVF;AAFG,SAAS,WAAW,EAAE,OAAO,SAAS,SAAS,SAAS,UAAU,GAAqB;AAC5F,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,SAAS,CAAC,MAAM;AACd,UAAE,eAAe;AACjB,gBAAQ,OAAO;AAAA,MACjB;AAAA,MACA,WAAW,aAAa;AAAA,MACxB,gBAAa;AAAA,MAEZ;AAAA,mBAAW;AAAA,QACZ,oBAAC,UAAM,iBAAM;AAAA;AAAA;AAAA,EACf;AAEJ;AAEO,IAAM,oBAAoB,CAC/B,SACA,6BACA,uBACA,uBACG;AACH,QAAM,kBAAkB,mBAAmB;AAE3C,QAAM,QAAQ,KAAK;AAAA,IACjB,OAAO,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,YAAY;AAAA,MAC9C,MAAM,OAAO;AAAA,MACb,aAAa,OAAO;AAAA,MACpB,YAAY,KAAK,UAAU,6BAA6B,OAAO,UAAU,CAAC;AAAA,IAC5E,EAAE;AAAA,EACJ;AAEA,QAAM,iBAA0C,CAAC;AAEjD,aAAW,UAAU,OAAO,OAAO,2BAA2B,GAAG;AAC/D,QAAI;AACF,YAAM,+BACJ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AAiB;AAClD,uBAAmB,UAAU;AAAA,EAC/B;AACF;","names":[]}
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  Suggestion,
21
21
  reloadSuggestions
22
- } from "./chunk-RJCZRKTV.mjs";
22
+ } from "./chunk-WGAZXTUA.mjs";
23
23
  import {
24
24
  CopilotDevConsole
25
25
  } from "./chunk-F2W5FD7L.mjs";
@@ -311,4 +311,4 @@ export {
311
311
  WrappedCopilotChat,
312
312
  useCopilotChatLogic
313
313
  };
314
- //# sourceMappingURL=chunk-ZYA5BMQA.mjs.map
314
+ //# sourceMappingURL=chunk-YGWWZL4N.mjs.map
@@ -1562,6 +1562,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
1562
1562
  onClick(message);
1563
1563
  },
1564
1564
  className: className || "suggestion",
1565
+ "data-test-id": "suggestion",
1565
1566
  children: [
1566
1567
  partial && SmallSpinnerIcon,
1567
1568
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: title })