@copilotkit/react-ui 0.14.0-alpha.5 → 0.14.1-alpha.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.
Files changed (143) hide show
  1. package/.turbo/turbo-build.log +80 -80
  2. package/CHANGELOG.md +31 -0
  3. package/dist/chunk-2KAF7NKC.mjs +484 -0
  4. package/dist/chunk-2KAF7NKC.mjs.map +1 -0
  5. package/dist/chunk-5KEDV5VC.mjs +27 -0
  6. package/dist/chunk-5KEDV5VC.mjs.map +1 -0
  7. package/dist/chunk-6LAZQHEB.mjs +129 -0
  8. package/dist/chunk-6LAZQHEB.mjs.map +1 -0
  9. package/dist/chunk-7NSRDJ5C.mjs +3 -0
  10. package/dist/chunk-7NSRDJ5C.mjs.map +1 -0
  11. package/dist/chunk-C34L4AWW.mjs +39 -0
  12. package/dist/chunk-C34L4AWW.mjs.map +1 -0
  13. package/dist/chunk-CF3BK4OX.mjs +53 -0
  14. package/dist/chunk-CF3BK4OX.mjs.map +1 -0
  15. package/dist/chunk-CNQX2VY3.mjs +66 -0
  16. package/dist/chunk-CNQX2VY3.mjs.map +1 -0
  17. package/dist/chunk-GCOPYGHH.mjs +27 -0
  18. package/dist/chunk-GCOPYGHH.mjs.map +1 -0
  19. package/dist/chunk-H4VKQGVU.mjs +3 -0
  20. package/dist/chunk-H4VKQGVU.mjs.map +1 -0
  21. package/dist/chunk-IJLMKBSZ.mjs +25 -0
  22. package/dist/chunk-IJLMKBSZ.mjs.map +1 -0
  23. package/dist/chunk-INCNMGJ7.mjs +72 -0
  24. package/dist/chunk-INCNMGJ7.mjs.map +1 -0
  25. package/dist/chunk-IU3WTXLQ.mjs +3 -0
  26. package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
  27. package/dist/chunk-M3CZWJI3.mjs +44 -0
  28. package/dist/chunk-M3CZWJI3.mjs.map +1 -0
  29. package/dist/chunk-MC6KTH4X.mjs +12 -0
  30. package/dist/chunk-MC6KTH4X.mjs.map +1 -0
  31. package/dist/chunk-MRXNTQOX.mjs +55 -0
  32. package/dist/chunk-MRXNTQOX.mjs.map +1 -0
  33. package/dist/chunk-OHWEJUCS.mjs +18 -0
  34. package/dist/chunk-OHWEJUCS.mjs.map +1 -0
  35. package/dist/chunk-OOBQC5H6.mjs +34 -0
  36. package/dist/chunk-OOBQC5H6.mjs.map +1 -0
  37. package/dist/chunk-POVINPXX.mjs +26 -0
  38. package/dist/chunk-POVINPXX.mjs.map +1 -0
  39. package/dist/chunk-Q6YO7LDK.mjs +40 -0
  40. package/dist/chunk-Q6YO7LDK.mjs.map +1 -0
  41. package/dist/chunk-RPTRCFSO.mjs +42 -0
  42. package/dist/chunk-RPTRCFSO.mjs.map +1 -0
  43. package/dist/chunk-SEH5PQVW.mjs +52 -0
  44. package/dist/chunk-SEH5PQVW.mjs.map +1 -0
  45. package/dist/chunk-SHOTWRKC.mjs +18 -0
  46. package/dist/chunk-SHOTWRKC.mjs.map +1 -0
  47. package/dist/chunk-SRBUGQTM.mjs +109 -0
  48. package/dist/chunk-SRBUGQTM.mjs.map +1 -0
  49. package/dist/chunk-TEYIQHMK.mjs +12 -0
  50. package/dist/chunk-TEYIQHMK.mjs.map +1 -0
  51. package/dist/chunk-U6NJWGTV.mjs +3 -0
  52. package/dist/chunk-U6NJWGTV.mjs.map +1 -0
  53. package/dist/chunk-VGX2W5ZB.mjs +28 -0
  54. package/dist/chunk-VGX2W5ZB.mjs.map +1 -0
  55. package/dist/chunk-XGUBRIUV.mjs +72 -0
  56. package/dist/chunk-XGUBRIUV.mjs.map +1 -0
  57. package/dist/chunk-ZYC5YVDO.mjs +21 -0
  58. package/dist/chunk-ZYC5YVDO.mjs.map +1 -0
  59. package/dist/components/chat-components/chat-list.mjs +12 -440
  60. package/dist/components/chat-components/chat-list.mjs.map +1 -1
  61. package/dist/components/chat-components/chat-message-actions.mjs +7 -168
  62. package/dist/components/chat-components/chat-message-actions.mjs.map +1 -1
  63. package/dist/components/chat-components/chat-message.mjs +10 -403
  64. package/dist/components/chat-components/chat-message.mjs.map +1 -1
  65. package/dist/components/chat-components/chat-panel.mjs +9 -301
  66. package/dist/components/chat-components/chat-panel.mjs.map +1 -1
  67. package/dist/components/chat-components/chat-scroll-anchor.mjs +4 -44
  68. package/dist/components/chat-components/chat-scroll-anchor.mjs.map +1 -1
  69. package/dist/components/chat-components/clear-history.mjs +25 -249
  70. package/dist/components/chat-components/clear-history.mjs.map +1 -1
  71. package/dist/components/chat-components/copilot-chat.mjs +21 -809
  72. package/dist/components/chat-components/copilot-chat.mjs.map +1 -1
  73. package/dist/components/chat-components/default-empty-screen.mjs +7 -175
  74. package/dist/components/chat-components/default-empty-screen.mjs.map +1 -1
  75. package/dist/components/chat-components/external-link.mjs +3 -25
  76. package/dist/components/chat-components/external-link.mjs.map +1 -1
  77. package/dist/components/chat-components/markdown.mjs +3 -10
  78. package/dist/components/chat-components/markdown.mjs.map +1 -1
  79. package/dist/components/chat-components/prompt-form.mjs +8 -227
  80. package/dist/components/chat-components/prompt-form.mjs.map +1 -1
  81. package/dist/components/chat-components/theme-toggle.mjs +14 -130
  82. package/dist/components/chat-components/theme-toggle.mjs.map +1 -1
  83. package/dist/components/chat-components/toaster.mjs +3 -7
  84. package/dist/components/chat-components/toaster.mjs.map +1 -1
  85. package/dist/components/chat-components/ui/alert-dialog.mjs +5 -199
  86. package/dist/components/chat-components/ui/alert-dialog.mjs.map +1 -1
  87. package/dist/components/chat-components/ui/badge.mjs +7 -49
  88. package/dist/components/chat-components/ui/badge.mjs.map +1 -1
  89. package/dist/components/chat-components/ui/button.mjs +4 -85
  90. package/dist/components/chat-components/ui/button.mjs.map +1 -1
  91. package/dist/components/chat-components/ui/codeblock.mjs +7 -283
  92. package/dist/components/chat-components/ui/codeblock.mjs.map +1 -1
  93. package/dist/components/chat-components/ui/dialog.mjs +25 -93
  94. package/dist/components/chat-components/ui/dialog.mjs.map +1 -1
  95. package/dist/components/chat-components/ui/dropdown-menu.mjs +8 -61
  96. package/dist/components/chat-components/ui/dropdown-menu.mjs.map +1 -1
  97. package/dist/components/chat-components/ui/icons.mjs +4 -554
  98. package/dist/components/chat-components/ui/icons.mjs.map +1 -1
  99. package/dist/components/chat-components/ui/input.mjs +7 -48
  100. package/dist/components/chat-components/ui/input.mjs.map +1 -1
  101. package/dist/components/chat-components/ui/label.mjs +9 -51
  102. package/dist/components/chat-components/ui/label.mjs.map +1 -1
  103. package/dist/components/chat-components/ui/select.mjs +23 -106
  104. package/dist/components/chat-components/ui/select.mjs.map +1 -1
  105. package/dist/components/chat-components/ui/separator.mjs +4 -68
  106. package/dist/components/chat-components/ui/separator.mjs.map +1 -1
  107. package/dist/components/chat-components/ui/sheet.mjs +23 -92
  108. package/dist/components/chat-components/ui/sheet.mjs.map +1 -1
  109. package/dist/components/chat-components/ui/switch.mjs +8 -53
  110. package/dist/components/chat-components/ui/switch.mjs.map +1 -1
  111. package/dist/components/chat-components/ui/textarea.mjs +7 -48
  112. package/dist/components/chat-components/ui/textarea.mjs.map +1 -1
  113. package/dist/components/chat-components/ui/tooltip.mjs +4 -72
  114. package/dist/components/chat-components/ui/tooltip.mjs.map +1 -1
  115. package/dist/components/index.mjs +25 -925
  116. package/dist/components/index.mjs.map +1 -1
  117. package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +24 -920
  118. package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs.map +1 -1
  119. package/dist/components/sidebar/copilot-sidebar.mjs +22 -842
  120. package/dist/components/sidebar/copilot-sidebar.mjs.map +1 -1
  121. package/dist/components/sidebar/sidebar-context.mjs +3 -10
  122. package/dist/components/sidebar/sidebar-context.mjs.map +1 -1
  123. package/dist/context/index.mjs +2 -0
  124. package/dist/context/index.mjs.map +1 -1
  125. package/dist/hooks/index.mjs +2 -0
  126. package/dist/hooks/index.mjs.map +1 -1
  127. package/dist/hooks/use-at-bottom.mjs +3 -19
  128. package/dist/hooks/use-at-bottom.mjs.map +1 -1
  129. package/dist/hooks/use-copy-to-clipboard.mjs +3 -26
  130. package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
  131. package/dist/hooks/use-enter-submit.mjs +3 -16
  132. package/dist/hooks/use-enter-submit.mjs.map +1 -1
  133. package/dist/index.mjs +28 -925
  134. package/dist/index.mjs.map +1 -1
  135. package/dist/lib/utils.mjs +3 -62
  136. package/dist/lib/utils.mjs.map +1 -1
  137. package/dist/lib/utils.test.mjs +1 -0
  138. package/dist/lib/utils.test.mjs.map +1 -1
  139. package/dist/types/index.mjs +2 -0
  140. package/dist/types/index.mjs.map +1 -1
  141. package/dist/types/types.mjs +2 -0
  142. package/dist/types/types.mjs.map +1 -1
  143. package/package.json +4 -4
@@ -1,810 +1,22 @@
1
- "use client";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
- var __async = (__this, __arguments, generator) => {
34
- return new Promise((resolve, reject) => {
35
- var fulfilled = (value) => {
36
- try {
37
- step(generator.next(value));
38
- } catch (e) {
39
- reject(e);
40
- }
41
- };
42
- var rejected = (value) => {
43
- try {
44
- step(generator.throw(value));
45
- } catch (e) {
46
- reject(e);
47
- }
48
- };
49
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
- step((generator = generator.apply(__this, __arguments)).next());
51
- });
52
- };
53
-
54
- // src/components/chat-components/ui/separator.tsx
55
- import * as React from "react";
56
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
57
-
58
- // src/lib/utils.ts
59
- import { clsx } from "clsx";
60
- import { customAlphabet } from "nanoid";
61
- import { twMerge } from "tailwind-merge";
62
- function cn(...inputs) {
63
- return twMerge(clsx(inputs));
64
- }
65
- var nanoid = customAlphabet(
66
- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
67
- 7
68
- );
69
-
70
- // src/components/chat-components/ui/separator.tsx
71
- import { jsx } from "react/jsx-runtime";
72
- var Separator = React.forwardRef((_a, ref) => {
73
- var _b = _a, { className, orientation = "horizontal", decorative = true } = _b, props = __objRest(_b, ["className", "orientation", "decorative"]);
74
- return /* @__PURE__ */ jsx(
75
- SeparatorPrimitive.Root,
76
- __spreadValues({
77
- ref,
78
- decorative,
79
- orientation,
80
- className: cn(
81
- "shrink-0 bg-border",
82
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
83
- className
84
- )
85
- }, props)
86
- );
87
- });
88
- Separator.displayName = SeparatorPrimitive.Root.displayName;
89
-
90
- // src/components/chat-components/chat-message.tsx
91
- import remarkGfm from "remark-gfm";
92
- import remarkMath from "remark-math";
93
-
94
- // src/components/chat-components/ui/codeblock.tsx
95
- import { memo } from "react";
96
- import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
97
-
98
- // src/hooks/use-copy-to-clipboard.tsx
99
- import * as React2 from "react";
100
- function useCopyToClipboard({ timeout = 2e3 }) {
101
- const [isCopied, setIsCopied] = React2.useState(false);
102
- const copyToClipboard = (value) => {
103
- var _a;
104
- if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
105
- return;
106
- }
107
- if (!value) {
108
- return;
109
- }
110
- navigator.clipboard.writeText(value).then(() => {
111
- setIsCopied(true);
112
- setTimeout(() => {
113
- setIsCopied(false);
114
- }, timeout);
115
- });
116
- };
117
- return { isCopied, copyToClipboard };
118
- }
119
-
120
- // src/components/chat-components/ui/icons.tsx
121
- import * as React3 from "react";
122
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
123
- function IconOpenAI(_a) {
124
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
125
- return /* @__PURE__ */ jsxs(
126
- "svg",
127
- __spreadProps(__spreadValues({
128
- fill: "currentColor",
129
- viewBox: "0 0 24 24",
130
- role: "img",
131
- xmlns: "http://www.w3.org/2000/svg",
132
- className: cn("h-4 w-4", className)
133
- }, props), {
134
- children: [
135
- /* @__PURE__ */ jsx2("title", { children: "OpenAI icon" }),
136
- /* @__PURE__ */ jsx2("path", { d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" })
137
- ]
138
- })
139
- );
140
- }
141
- function IconArrowRight(_a) {
142
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
143
- return /* @__PURE__ */ jsx2(
144
- "svg",
145
- __spreadProps(__spreadValues({
146
- xmlns: "http://www.w3.org/2000/svg",
147
- viewBox: "0 0 256 256",
148
- fill: "currentColor",
149
- className: cn("h-4 w-4", className)
150
- }, props), {
151
- children: /* @__PURE__ */ jsx2("path", { d: "m221.66 133.66-72 72a8 8 0 0 1-11.32-11.32L196.69 136H40a8 8 0 0 1 0-16h156.69l-58.35-58.34a8 8 0 0 1 11.32-11.32l72 72a8 8 0 0 1 0 11.32Z" })
152
- })
153
- );
154
- }
155
- function IconUser(_a) {
156
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
157
- return /* @__PURE__ */ jsx2(
158
- "svg",
159
- __spreadProps(__spreadValues({
160
- xmlns: "http://www.w3.org/2000/svg",
161
- viewBox: "0 0 256 256",
162
- fill: "currentColor",
163
- className: cn("h-4 w-4", className)
164
- }, props), {
165
- children: /* @__PURE__ */ jsx2("path", { d: "M230.92 212c-15.23-26.33-38.7-45.21-66.09-54.16a72 72 0 1 0-73.66 0c-27.39 8.94-50.86 27.82-66.09 54.16a8 8 0 1 0 13.85 8c18.84-32.56 52.14-52 89.07-52s70.23 19.44 89.07 52a8 8 0 1 0 13.85-8ZM72 96a56 56 0 1 1 56 56 56.06 56.06 0 0 1-56-56Z" })
166
- })
167
- );
168
- }
169
- function IconArrowElbow(_a) {
170
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
171
- return /* @__PURE__ */ jsx2(
172
- "svg",
173
- __spreadProps(__spreadValues({
174
- xmlns: "http://www.w3.org/2000/svg",
175
- viewBox: "0 0 256 256",
176
- fill: "currentColor",
177
- className: cn("h-4 w-4", className)
178
- }, props), {
179
- children: /* @__PURE__ */ jsx2("path", { d: "M200 32v144a8 8 0 0 1-8 8H67.31l34.35 34.34a8 8 0 0 1-11.32 11.32l-48-48a8 8 0 0 1 0-11.32l48-48a8 8 0 0 1 11.32 11.32L67.31 168H184V32a8 8 0 0 1 16 0Z" })
180
- })
181
- );
182
- }
183
- function IconRefresh(_a) {
184
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
185
- return /* @__PURE__ */ jsx2(
186
- "svg",
187
- __spreadProps(__spreadValues({
188
- xmlns: "http://www.w3.org/2000/svg",
189
- viewBox: "0 0 256 256",
190
- fill: "currentColor",
191
- className: cn("h-4 w-4", className)
192
- }, props), {
193
- children: /* @__PURE__ */ jsx2("path", { d: "M197.67 186.37a8 8 0 0 1 0 11.29C196.58 198.73 170.82 224 128 224c-37.39 0-64.53-22.4-80-39.85V208a8 8 0 0 1-16 0v-48a8 8 0 0 1 8-8h48a8 8 0 0 1 0 16H55.44C67.76 183.35 93 208 128 208c36 0 58.14-21.46 58.36-21.68a8 8 0 0 1 11.31.05ZM216 40a8 8 0 0 0-8 8v23.85C192.53 54.4 165.39 32 128 32c-42.82 0-68.58 25.27-69.66 26.34a8 8 0 0 0 11.3 11.34C69.86 69.46 92 48 128 48c35 0 60.24 24.65 72.56 40H168a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8V48a8 8 0 0 0-8-8Z" })
194
- })
195
- );
196
- }
197
- function IconStop(_a) {
198
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
199
- return /* @__PURE__ */ jsx2(
200
- "svg",
201
- __spreadProps(__spreadValues({
202
- xmlns: "http://www.w3.org/2000/svg",
203
- viewBox: "0 0 256 256",
204
- fill: "currentColor",
205
- className: cn("h-4 w-4", className)
206
- }, props), {
207
- children: /* @__PURE__ */ jsx2("path", { d: "M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm24-120h-48a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8Zm-8 48h-32v-32h32Z" })
208
- })
209
- );
210
- }
211
- function IconCopy(_a) {
212
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
213
- return /* @__PURE__ */ jsx2(
214
- "svg",
215
- __spreadProps(__spreadValues({
216
- xmlns: "http://www.w3.org/2000/svg",
217
- viewBox: "0 0 256 256",
218
- fill: "currentColor",
219
- className: cn("h-4 w-4", className)
220
- }, props), {
221
- children: /* @__PURE__ */ jsx2("path", { d: "M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" })
222
- })
223
- );
224
- }
225
- function IconCheck(_a) {
226
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
227
- return /* @__PURE__ */ jsx2(
228
- "svg",
229
- __spreadProps(__spreadValues({
230
- xmlns: "http://www.w3.org/2000/svg",
231
- viewBox: "0 0 256 256",
232
- fill: "currentColor",
233
- className: cn("h-4 w-4", className)
234
- }, props), {
235
- children: /* @__PURE__ */ jsx2("path", { d: "m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" })
236
- })
237
- );
238
- }
239
- function IconDownload(_a) {
240
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
241
- return /* @__PURE__ */ jsx2(
242
- "svg",
243
- __spreadProps(__spreadValues({
244
- xmlns: "http://www.w3.org/2000/svg",
245
- viewBox: "0 0 256 256",
246
- fill: "currentColor",
247
- className: cn("h-4 w-4", className)
248
- }, props), {
249
- children: /* @__PURE__ */ jsx2("path", { d: "M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" })
250
- })
251
- );
252
- }
253
-
254
- // src/components/chat-components/ui/button.tsx
255
- import * as React4 from "react";
256
- import { Slot } from "@radix-ui/react-slot";
257
- import { cva } from "class-variance-authority";
258
- import { jsx as jsx3 } from "react/jsx-runtime";
259
- var buttonVariants = cva(
260
- "inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
261
- {
262
- variants: {
263
- variant: {
264
- default: "bg-primary text-primary-foreground shadow-md hover:bg-primary/90",
265
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
266
- outline: "border border-input hover:bg-accent hover:text-accent-foreground",
267
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
268
- ghost: "shadow-none hover:bg-accent hover:text-accent-foreground",
269
- link: "text-primary underline-offset-4 shadow-none hover:underline"
270
- },
271
- size: {
272
- default: "h-8 px-4 py-2",
273
- sm: "h-8 rounded-md px-3",
274
- lg: "h-11 rounded-md px-8",
275
- icon: "h-8 w-8 p-0"
276
- }
277
- },
278
- defaultVariants: {
279
- variant: "default",
280
- size: "default"
281
- }
282
- }
283
- );
284
- var Button = React4.forwardRef(
285
- (_a, ref) => {
286
- var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
287
- const Comp = asChild ? Slot : "button";
288
- return /* @__PURE__ */ jsx3(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
289
- }
290
- );
291
- Button.displayName = "Button";
292
-
293
- // src/components/chat-components/ui/codeblock.tsx
294
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
295
- var programmingLanguages = {
296
- javascript: ".js",
297
- python: ".py",
298
- java: ".java",
299
- c: ".c",
300
- cpp: ".cpp",
301
- "c++": ".cpp",
302
- "c#": ".cs",
303
- ruby: ".rb",
304
- php: ".php",
305
- swift: ".swift",
306
- "objective-c": ".m",
307
- kotlin: ".kt",
308
- typescript: ".ts",
309
- go: ".go",
310
- perl: ".pl",
311
- rust: ".rs",
312
- scala: ".scala",
313
- haskell: ".hs",
314
- lua: ".lua",
315
- shell: ".sh",
316
- sql: ".sql",
317
- html: ".html",
318
- css: ".css"
319
- // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
320
- };
321
- var generateRandomString = (length, lowercase = false) => {
322
- const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
323
- let result = "";
324
- for (let i = 0; i < length; i++) {
325
- result += chars.charAt(Math.floor(Math.random() * chars.length));
326
- }
327
- return lowercase ? result.toLowerCase() : result;
328
- };
329
- var CodeBlock = memo(({ language, value }) => {
330
- const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
331
- const downloadAsFile = () => {
332
- if (typeof window === "undefined") {
333
- return;
334
- }
335
- const fileExtension = programmingLanguages[language] || ".file";
336
- const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
337
- const fileName = window.prompt("Enter file name", suggestedFileName);
338
- if (!fileName) {
339
- return;
340
- }
341
- const blob = new Blob([value], { type: "text/plain" });
342
- const url = URL.createObjectURL(blob);
343
- const link = document.createElement("a");
344
- link.download = fileName;
345
- link.href = url;
346
- link.style.display = "none";
347
- document.body.appendChild(link);
348
- link.click();
349
- document.body.removeChild(link);
350
- URL.revokeObjectURL(url);
351
- };
352
- const onCopy = () => {
353
- if (isCopied)
354
- return;
355
- copyToClipboard(value);
356
- };
357
- return /* @__PURE__ */ jsxs2("div", { className: "codeblock relative w-full bg-zinc-950 font-sans", children: [
358
- /* @__PURE__ */ jsxs2("div", { className: "flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100", children: [
359
- /* @__PURE__ */ jsx4("span", { className: "text-xs lowercase", children: language }),
360
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center space-x-1", children: [
361
- /* @__PURE__ */ jsxs2(
362
- Button,
363
- {
364
- variant: "ghost",
365
- className: "hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
366
- onClick: downloadAsFile,
367
- size: "icon",
368
- children: [
369
- /* @__PURE__ */ jsx4(IconDownload, {}),
370
- /* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Download" })
371
- ]
372
- }
373
- ),
374
- /* @__PURE__ */ jsxs2(
375
- Button,
376
- {
377
- variant: "ghost",
378
- size: "icon",
379
- className: "text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
380
- onClick: onCopy,
381
- children: [
382
- isCopied ? /* @__PURE__ */ jsx4(IconCheck, {}) : /* @__PURE__ */ jsx4(IconCopy, {}),
383
- /* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Copy code" })
384
- ]
385
- }
386
- )
387
- ] })
388
- ] }),
389
- /* @__PURE__ */ jsx4(
390
- SyntaxHighlighter,
391
- {
392
- language,
393
- PreTag: "div",
394
- showLineNumbers: true,
395
- customStyle: {
396
- margin: 0,
397
- width: "100%",
398
- background: "transparent",
399
- padding: "1.5rem 1rem"
400
- },
401
- codeTagProps: {
402
- style: {
403
- fontSize: "0.9rem",
404
- fontFamily: "var(--font-mono)"
405
- }
406
- },
407
- children: value
408
- }
409
- )
410
- ] });
411
- });
412
- CodeBlock.displayName = "CodeBlock";
413
-
414
- // src/components/chat-components/markdown.tsx
415
- import { memo as memo2 } from "react";
416
- import ReactMarkdown from "react-markdown";
417
- var MemoizedReactMarkdown = memo2(
418
- ReactMarkdown,
419
- (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
420
- );
421
-
422
- // src/components/chat-components/chat-message-actions.tsx
423
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
424
- function ChatMessageActions(_a) {
425
- var _b = _a, { message, className } = _b, props = __objRest(_b, ["message", "className"]);
426
- const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
427
- const onCopy = () => {
428
- if (isCopied)
429
- return;
430
- copyToClipboard(message.content);
431
- };
432
- return /* @__PURE__ */ jsx5(
433
- "div",
434
- __spreadProps(__spreadValues({
435
- className: cn(
436
- "flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0",
437
- className
438
- )
439
- }, props), {
440
- children: /* @__PURE__ */ jsxs3(Button, { variant: "ghost", size: "icon", onClick: onCopy, children: [
441
- isCopied ? /* @__PURE__ */ jsx5(IconCheck, {}) : /* @__PURE__ */ jsx5(IconCopy, {}),
442
- /* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Copy message" })
443
- ] })
444
- })
445
- );
446
- }
447
-
448
- // src/components/chat-components/chat-message.tsx
449
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
450
- function ChatMessage(_a) {
451
- var _b = _a, { message } = _b, props = __objRest(_b, ["message"]);
452
- return /* @__PURE__ */ jsxs4("div", __spreadProps(__spreadValues({ className: cn("group relative mb-4 flex items-start") }, props), { children: [
453
- /* @__PURE__ */ jsx6(
454
- "div",
455
- {
456
- className: cn(
457
- "flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow",
458
- message.role === "user" ? "bg-background" : "bg-primary text-primary-foreground"
459
- ),
460
- children: message.role === "user" ? /* @__PURE__ */ jsx6(IconUser, {}) : /* @__PURE__ */ jsx6(IconOpenAI, {})
461
- }
462
- ),
463
- /* @__PURE__ */ jsxs4("div", { className: "ml-4 flex-1 space-y-2 overflow-hidden px-1", children: [
464
- /* @__PURE__ */ jsx6(
465
- MemoizedReactMarkdown,
466
- {
467
- className: "prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm",
468
- remarkPlugins: [remarkGfm, remarkMath],
469
- components: {
470
- p({ children }) {
471
- return /* @__PURE__ */ jsx6("p", { className: "mb-2 last:mb-0", children });
472
- },
473
- code(_a2) {
474
- var _b2 = _a2, { children, className, inline } = _b2, props2 = __objRest(_b2, ["children", "className", "inline"]);
475
- if (children.length) {
476
- if (children[0] == "\u258D") {
477
- return /* @__PURE__ */ jsx6("span", { className: "mt-1 animate-pulse cursor-default", children: "\u258D" });
478
- }
479
- children[0] = children[0].replace("`\u258D`", "\u258D");
480
- }
481
- const match = /language-(\w+)/.exec(className || "");
482
- if (inline) {
483
- return /* @__PURE__ */ jsx6("code", __spreadProps(__spreadValues({ className }, props2), { children }));
484
- }
485
- return /* @__PURE__ */ jsx6(
486
- CodeBlock,
487
- __spreadValues({
488
- language: match && match[1] || "",
489
- value: String(children).replace(/\n$/, "")
490
- }, props2),
491
- Math.random()
492
- );
493
- }
494
- },
495
- children: message.content
496
- }
497
- ),
498
- /* @__PURE__ */ jsx6(ChatMessageActions, { message })
499
- ] })
500
- ] }));
501
- }
502
-
503
- // src/components/chat-components/chat-list.tsx
504
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
505
- function ChatList({ messages }) {
506
- const displayedMessages = messages.filter((message) => message.role !== "system");
507
- if (!displayedMessages.length) {
508
- return null;
509
- }
510
- return /* @__PURE__ */ jsx7("div", { className: "relative mx-auto max-w-2xl px-0", children: displayedMessages.map((message, index) => /* @__PURE__ */ jsxs5("div", { children: [
511
- /* @__PURE__ */ jsx7(ChatMessage, { message }),
512
- index < displayedMessages.length - 1 && /* @__PURE__ */ jsx7(Separator, { className: "my-4 md:my-4" })
513
- ] }, index)) });
514
- }
515
-
516
- // src/components/chat-components/prompt-form.tsx
517
- import * as React6 from "react";
518
- import TextareaAutosize from "react-textarea-autosize";
519
-
520
- // src/hooks/use-enter-submit.tsx
521
- import { useRef } from "react";
522
- function useEnterSubmit() {
523
- const formRef = useRef(null);
524
- const handleKeyDown = (event) => {
525
- var _a;
526
- if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
527
- (_a = formRef.current) == null ? void 0 : _a.requestSubmit();
528
- event.preventDefault();
529
- }
530
- };
531
- return { formRef, onKeyDown: handleKeyDown };
532
- }
533
-
534
- // src/components/chat-components/ui/tooltip.tsx
535
- import * as React5 from "react";
536
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
537
- import { jsx as jsx8 } from "react/jsx-runtime";
538
- var Tooltip = TooltipPrimitive.Root;
539
- var TooltipTrigger = TooltipPrimitive.Trigger;
540
- var TooltipContent = React5.forwardRef((_a, ref) => {
541
- var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
542
- return /* @__PURE__ */ jsx8(
543
- TooltipPrimitive.Content,
544
- __spreadValues({
545
- ref,
546
- sideOffset,
547
- className: cn(
548
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md animate-in fade-in-50 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",
549
- className
550
- )
551
- }, props)
552
- );
553
- });
554
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
555
-
556
- // src/components/chat-components/prompt-form.tsx
557
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
558
- function PromptForm({ onSubmit, input, setInput, isLoading }) {
559
- const { formRef, onKeyDown } = useEnterSubmit();
560
- const inputRef = React6.useRef(null);
561
- React6.useEffect(() => {
562
- if (inputRef.current) {
563
- inputRef.current.focus();
564
- }
565
- }, []);
566
- return /* @__PURE__ */ jsx9(
567
- "form",
568
- {
569
- onSubmit: (e) => __async(this, null, function* () {
570
- e.preventDefault();
571
- if (!(input == null ? void 0 : input.trim())) {
572
- return;
573
- }
574
- setInput("");
575
- yield onSubmit(input);
576
- }),
577
- ref: formRef,
578
- children: /* @__PURE__ */ jsxs6("div", { className: "relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md border sm:px-12", children: [
579
- /* @__PURE__ */ jsxs6(Tooltip, { children: [
580
- /* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true }),
581
- /* @__PURE__ */ jsx9(TooltipContent, { children: "New Chat" })
582
- ] }),
583
- /* @__PURE__ */ jsx9(
584
- TextareaAutosize,
585
- {
586
- ref: inputRef,
587
- tabIndex: 0,
588
- onKeyDown,
589
- rows: 1,
590
- value: input,
591
- onChange: (e) => setInput(e.target.value),
592
- placeholder: "Send a message.",
593
- spellCheck: false,
594
- className: "min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"
595
- }
596
- ),
597
- /* @__PURE__ */ jsx9("div", { className: "absolute right-0 top-4 sm:right-4", children: /* @__PURE__ */ jsxs6(Tooltip, { children: [
598
- /* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
599
- Button,
600
- {
601
- type: "submit",
602
- size: "icon",
603
- disabled: isLoading || input === "",
604
- className: " bg-slate-300",
605
- children: [
606
- /* @__PURE__ */ jsx9(IconArrowElbow, {}),
607
- /* @__PURE__ */ jsx9("span", { className: "sr-only", children: "Send message" })
608
- ]
609
- }
610
- ) }),
611
- /* @__PURE__ */ jsx9(TooltipContent, { children: "Send message" })
612
- ] }) })
613
- ] })
614
- }
615
- );
616
- }
617
-
618
- // src/components/chat-components/chat-panel.tsx
619
- import { nanoid as nanoid2 } from "nanoid";
620
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
621
- function ChatPanel({
622
- id,
623
- isLoading,
624
- stop,
625
- append,
626
- reload,
627
- input,
628
- setInput,
629
- messages
630
- }) {
631
- return /* @__PURE__ */ jsx10(
632
- "div",
633
- {
634
- className: "inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50% mt-4 mb-8",
635
- style: { width: "100%", overflow: "hidden", boxSizing: "border-box" },
636
- children: /* @__PURE__ */ jsxs7("div", { className: "mx-auto sm:max-w-2xl sm:px-4", children: [
637
- /* @__PURE__ */ jsx10("div", { className: "flex h-10 items-center justify-center mb-4", children: isLoading ? /* @__PURE__ */ jsxs7(Button, { variant: "outline", onClick: () => stop(), className: "bg-background", children: [
638
- /* @__PURE__ */ jsx10(IconStop, { className: "mr-2" }),
639
- "Stop generating"
640
- ] }) : (messages == null ? void 0 : messages.length) > 0 && /* @__PURE__ */ jsxs7(Button, { variant: "outline", onClick: () => reload(), className: "bg-background", children: [
641
- /* @__PURE__ */ jsx10(IconRefresh, { className: "mr-2" }),
642
- "Regenerate response"
643
- ] }) }),
644
- /* @__PURE__ */ jsx10("div", { className: "space-y-4 border-2 bg-background px-4 py-2 shadow-lg sm:rounded-xl md:py-4", children: /* @__PURE__ */ jsx10(
645
- PromptForm,
646
- {
647
- onSubmit: (value) => __async(this, null, function* () {
648
- yield append({
649
- id: id || nanoid2(),
650
- content: value,
651
- role: "user"
652
- });
653
- }),
654
- input,
655
- setInput,
656
- isLoading
657
- }
658
- ) })
659
- ] })
660
- }
661
- );
662
- }
663
-
664
- // src/components/chat-components/external-link.tsx
665
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
666
- function ExternalLink({ href, children }) {
667
- return /* @__PURE__ */ jsxs8(
668
- "a",
669
- {
670
- href,
671
- target: "_blank",
672
- className: "inline-flex flex-1 justify-center gap-1 leading-4 hover:underline",
673
- children: [
674
- /* @__PURE__ */ jsx11("span", { children }),
675
- /* @__PURE__ */ jsx11("svg", { "aria-hidden": "true", height: "7", viewBox: "0 0 6 6", width: "7", className: "opacity-70", children: /* @__PURE__ */ jsx11(
676
- "path",
677
- {
678
- d: "M1.25215 5.54731L0.622742 4.9179L3.78169 1.75597H1.3834L1.38936 0.890915H5.27615V4.78069H4.40513L4.41109 2.38538L1.25215 5.54731Z",
679
- fill: "currentColor"
680
- }
681
- ) })
682
- ]
683
- }
684
- );
685
- }
686
-
687
- // src/components/chat-components/default-empty-screen.tsx
688
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
689
- var exampleMessages = [
690
- {
691
- heading: "Explain technical concepts",
692
- message: `What is a "serverless function"?`
693
- },
694
- {
695
- heading: "Summarize an article",
696
- message: "Summarize the following article for a 2nd grader: \n"
697
- },
698
- {
699
- heading: "Draft an email",
700
- message: `Draft an email to my boss about the following:
701
- `
702
- }
703
- ];
704
- var DefaultEmptyScreen = (props) => {
705
- return /* @__PURE__ */ jsx12("div", { className: "mx-auto max-w-2xl px-4", children: /* @__PURE__ */ jsxs9("div", { className: "rounded-lg border bg-background p-8", children: [
706
- /* @__PURE__ */ jsx12("h1", { className: "mb-2 text-lg font-semibold", children: "Welcome to CopilotKit! \u{1F44B}" }),
707
- /* @__PURE__ */ jsxs9("p", { className: "mb-2 leading-normal text-muted-foreground", children: [
708
- "This is a Copilot built with",
709
- " ",
710
- /* @__PURE__ */ jsx12(ExternalLink, { href: "https://recursively.ai", children: "recursively.ai's" }),
711
- " ",
712
- /* @__PURE__ */ jsx12(ExternalLink, { href: "https://github.com/RecursivelyAI/CopilotKit", children: "CopilotKit" }),
713
- " ",
714
- "."
715
- ] }),
716
- /* @__PURE__ */ jsx12("p", { className: "leading-normal text-muted-foreground", children: "You can start a conversation here or try the following examples:" }),
717
- /* @__PURE__ */ jsx12("div", { className: "mt-4 flex flex-col items-start space-y-2", children: exampleMessages.map((message, index) => /* @__PURE__ */ jsxs9(
718
- Button,
719
- {
720
- variant: "link",
721
- className: "h-auto p-0 text-base",
722
- onClick: () => props.setInput(message.message),
723
- children: [
724
- /* @__PURE__ */ jsx12(IconArrowRight, { className: "mr-2 text-muted-foreground" }),
725
- message.heading
726
- ]
727
- },
728
- index
729
- )) })
730
- ] }) });
731
- };
732
-
733
- // src/components/chat-components/chat-scroll-anchor.tsx
734
- import * as React8 from "react";
735
- import { useInView } from "react-intersection-observer";
736
-
737
- // src/hooks/use-at-bottom.tsx
738
- import * as React7 from "react";
739
- function useAtBottom(offset = 0) {
740
- const [isAtBottom, setIsAtBottom] = React7.useState(false);
741
- React7.useEffect(() => {
742
- const handleScroll = () => {
743
- setIsAtBottom(window.innerHeight + window.scrollY >= document.body.offsetHeight - offset);
744
- };
745
- window.addEventListener("scroll", handleScroll, { passive: true });
746
- handleScroll();
747
- return () => {
748
- window.removeEventListener("scroll", handleScroll);
749
- };
750
- }, [offset]);
751
- return isAtBottom;
752
- }
753
-
754
- // src/components/chat-components/chat-scroll-anchor.tsx
755
- import { jsx as jsx13 } from "react/jsx-runtime";
756
- function ChatScrollAnchor({ trackVisibility }) {
757
- const isAtBottom = useAtBottom();
758
- const { ref, entry, inView } = useInView({
759
- trackVisibility,
760
- delay: 100,
761
- rootMargin: "0px 0px -150px 0px"
762
- });
763
- React8.useEffect(() => {
764
- if (isAtBottom && trackVisibility && !inView) {
765
- entry == null ? void 0 : entry.target.scrollIntoView({
766
- block: "start"
767
- });
768
- }
769
- }, [inView, entry, isAtBottom, trackVisibility]);
770
- return /* @__PURE__ */ jsx13("div", { ref, className: "h-px w-full" });
771
- }
772
-
773
- // src/components/chat-components/copilot-chat.tsx
774
- import { useCopilotChat } from "@copilotkit/react-core";
775
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
776
- function CopilotChat({
777
- id,
778
- initialMessages,
779
- makeSystemMessage,
780
- EmptyScreen = DefaultEmptyScreen
781
- }) {
782
- const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({
783
- id,
784
- initialMessages,
785
- makeSystemMessage
786
- });
787
- return /* @__PURE__ */ jsxs10("div", { className: "w-full h-full flex flex-col overflow-hidden box-border items-start", children: [
788
- /* @__PURE__ */ jsx14("div", { className: "pt-5 px-5 overflow-y-auto overflow-x-hidden w-full flex-grow", children: visibleMessages.length ? /* @__PURE__ */ jsxs10("div", { className: "pl-0 pr-6", children: [
789
- /* @__PURE__ */ jsx14(ChatList, { messages: visibleMessages }),
790
- /* @__PURE__ */ jsx14(ChatScrollAnchor, { trackVisibility: isLoading })
791
- ] }) : /* @__PURE__ */ jsx14(EmptyScreen, { setInput }) }),
792
- /* @__PURE__ */ jsx14("div", { className: "flex-shrink-0 w-full", children: /* @__PURE__ */ jsx14(
793
- ChatPanel,
794
- {
795
- id,
796
- isLoading,
797
- stop,
798
- append,
799
- reload,
800
- messages: visibleMessages,
801
- input,
802
- setInput
803
- }
804
- ) })
805
- ] });
806
- }
807
- export {
808
- CopilotChat
809
- };
1
+ export { CopilotChat } from '../../chunk-RPTRCFSO.mjs';
2
+ import '../../chunk-SEH5PQVW.mjs';
3
+ import '../../chunk-5KEDV5VC.mjs';
4
+ import '../../chunk-SHOTWRKC.mjs';
5
+ import '../../chunk-GCOPYGHH.mjs';
6
+ import '../../chunk-CNQX2VY3.mjs';
7
+ import '../../chunk-6LAZQHEB.mjs';
8
+ import '../../chunk-TEYIQHMK.mjs';
9
+ import '../../chunk-OOBQC5H6.mjs';
10
+ import '../../chunk-CF3BK4OX.mjs';
11
+ import '../../chunk-INCNMGJ7.mjs';
12
+ import '../../chunk-VGX2W5ZB.mjs';
13
+ import '../../chunk-M3CZWJI3.mjs';
14
+ import '../../chunk-2KAF7NKC.mjs';
15
+ import '../../chunk-Q6YO7LDK.mjs';
16
+ import '../../chunk-IJLMKBSZ.mjs';
17
+ import '../../chunk-ZYC5YVDO.mjs';
18
+ import '../../chunk-POVINPXX.mjs';
19
+ import '../../chunk-OHWEJUCS.mjs';
20
+ import '../../chunk-MRXNTQOX.mjs';
21
+ //# sourceMappingURL=out.js.map
810
22
  //# sourceMappingURL=copilot-chat.mjs.map