@scenemesh/entity-engine-aimodule 1.0.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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +854 -0
  3. package/dist/ai-core-LBGYFGOK.mjs +17 -0
  4. package/dist/ai-core-LBGYFGOK.mjs.map +1 -0
  5. package/dist/ai-core-UGJWSCQN.js +17 -0
  6. package/dist/ai-core-UGJWSCQN.js.map +1 -0
  7. package/dist/ai-core-manager-B3Z34RHA.mjs +9 -0
  8. package/dist/ai-core-manager-B3Z34RHA.mjs.map +1 -0
  9. package/dist/ai-core-manager-W7SSDCG5.js +9 -0
  10. package/dist/ai-core-manager-W7SSDCG5.js.map +1 -0
  11. package/dist/ai-embeddings-5ED5LDXX.mjs +17 -0
  12. package/dist/ai-embeddings-5ED5LDXX.mjs.map +1 -0
  13. package/dist/ai-embeddings-WCXZMMTZ.js +17 -0
  14. package/dist/ai-embeddings-WCXZMMTZ.js.map +1 -0
  15. package/dist/ai-form-renderer-24IWNMX5.js +233 -0
  16. package/dist/ai-form-renderer-24IWNMX5.js.map +1 -0
  17. package/dist/ai-form-renderer-BORQABF2.mjs +233 -0
  18. package/dist/ai-form-renderer-BORQABF2.mjs.map +1 -0
  19. package/dist/ai-provider-3PSCVEEN.mjs +17 -0
  20. package/dist/ai-provider-3PSCVEEN.mjs.map +1 -0
  21. package/dist/ai-provider-WMPMVZFL.js +17 -0
  22. package/dist/ai-provider-WMPMVZFL.js.map +1 -0
  23. package/dist/ai-renderer-7WGGWH5D.mjs +134 -0
  24. package/dist/ai-renderer-7WGGWH5D.mjs.map +1 -0
  25. package/dist/ai-renderer-OILYWAJV.js +134 -0
  26. package/dist/ai-renderer-OILYWAJV.js.map +1 -0
  27. package/dist/ai-settings-DGCFPK3U.js +15 -0
  28. package/dist/ai-settings-DGCFPK3U.js.map +1 -0
  29. package/dist/ai-settings-DTXEAB64.mjs +15 -0
  30. package/dist/ai-settings-DTXEAB64.mjs.map +1 -0
  31. package/dist/ai-structured-EGZ26ZS4.mjs +13 -0
  32. package/dist/ai-structured-EGZ26ZS4.mjs.map +1 -0
  33. package/dist/ai-structured-N2FZLO4A.js +13 -0
  34. package/dist/ai-structured-N2FZLO4A.js.map +1 -0
  35. package/dist/ai-tools-B3R77HZ3.js +19 -0
  36. package/dist/ai-tools-B3R77HZ3.js.map +1 -0
  37. package/dist/ai-tools-JAPVYQGE.mjs +19 -0
  38. package/dist/ai-tools-JAPVYQGE.mjs.map +1 -0
  39. package/dist/ai.module-GAHVCBTP.js +7 -0
  40. package/dist/ai.module-GAHVCBTP.js.map +1 -0
  41. package/dist/ai.module-TTPMTPB3.mjs +7 -0
  42. package/dist/ai.module-TTPMTPB3.mjs.map +1 -0
  43. package/dist/chunk-25C2NRSD.mjs +611 -0
  44. package/dist/chunk-25C2NRSD.mjs.map +1 -0
  45. package/dist/chunk-4JQ7UOXH.js +427 -0
  46. package/dist/chunk-4JQ7UOXH.js.map +1 -0
  47. package/dist/chunk-6IUKES2L.js +290 -0
  48. package/dist/chunk-6IUKES2L.js.map +1 -0
  49. package/dist/chunk-COWPK7XN.mjs +834 -0
  50. package/dist/chunk-COWPK7XN.mjs.map +1 -0
  51. package/dist/chunk-CTEXPMVZ.js +512 -0
  52. package/dist/chunk-CTEXPMVZ.js.map +1 -0
  53. package/dist/chunk-DXQTHA75.js +573 -0
  54. package/dist/chunk-DXQTHA75.js.map +1 -0
  55. package/dist/chunk-DZFQ6I23.js +72 -0
  56. package/dist/chunk-DZFQ6I23.js.map +1 -0
  57. package/dist/chunk-J323UTPE.mjs +650 -0
  58. package/dist/chunk-J323UTPE.mjs.map +1 -0
  59. package/dist/chunk-LHNNALVF.js +834 -0
  60. package/dist/chunk-LHNNALVF.js.map +1 -0
  61. package/dist/chunk-O7SZSMXV.js +1621 -0
  62. package/dist/chunk-O7SZSMXV.js.map +1 -0
  63. package/dist/chunk-OTNOFOVW.js +650 -0
  64. package/dist/chunk-OTNOFOVW.js.map +1 -0
  65. package/dist/chunk-PRIGZEI4.mjs +72 -0
  66. package/dist/chunk-PRIGZEI4.mjs.map +1 -0
  67. package/dist/chunk-SBSZ3IPB.mjs +573 -0
  68. package/dist/chunk-SBSZ3IPB.mjs.map +1 -0
  69. package/dist/chunk-SXPA6SSD.mjs +1621 -0
  70. package/dist/chunk-SXPA6SSD.mjs.map +1 -0
  71. package/dist/chunk-T5A4KAVS.mjs +512 -0
  72. package/dist/chunk-T5A4KAVS.mjs.map +1 -0
  73. package/dist/chunk-TDRKKUNT.mjs +357 -0
  74. package/dist/chunk-TDRKKUNT.mjs.map +1 -0
  75. package/dist/chunk-TJFNODPE.js +357 -0
  76. package/dist/chunk-TJFNODPE.js.map +1 -0
  77. package/dist/chunk-V2SSI3SL.mjs +427 -0
  78. package/dist/chunk-V2SSI3SL.mjs.map +1 -0
  79. package/dist/chunk-X42L6MTY.mjs +290 -0
  80. package/dist/chunk-X42L6MTY.mjs.map +1 -0
  81. package/dist/chunk-YSVMY77H.js +611 -0
  82. package/dist/chunk-YSVMY77H.js.map +1 -0
  83. package/dist/core-ANYRS6EF.mjs +73 -0
  84. package/dist/core-ANYRS6EF.mjs.map +1 -0
  85. package/dist/core-K5K34DCS.js +73 -0
  86. package/dist/core-K5K34DCS.js.map +1 -0
  87. package/dist/core-index.d.mts +1668 -0
  88. package/dist/core-index.d.ts +1668 -0
  89. package/dist/core-index.js +101 -0
  90. package/dist/core-index.js.map +1 -0
  91. package/dist/core-index.mjs +101 -0
  92. package/dist/core-index.mjs.map +1 -0
  93. package/dist/index.d.mts +2911 -0
  94. package/dist/index.d.ts +2911 -0
  95. package/dist/index.js +1177 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/index.mjs +1177 -0
  98. package/dist/index.mjs.map +1 -0
  99. package/dist/tools-352X7A6X.mjs +366 -0
  100. package/dist/tools-352X7A6X.mjs.map +1 -0
  101. package/dist/tools-YLEX6GNO.js +366 -0
  102. package/dist/tools-YLEX6GNO.js.map +1 -0
  103. package/dist/ui-index.d.mts +627 -0
  104. package/dist/ui-index.d.ts +627 -0
  105. package/dist/ui-index.js +2354 -0
  106. package/dist/ui-index.js.map +1 -0
  107. package/dist/ui-index.mjs +2353 -0
  108. package/dist/ui-index.mjs.map +1 -0
  109. package/package.json +105 -0
@@ -0,0 +1,2354 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+
24
+ // src/hooks/useChat.ts
25
+ var _react = require('@ai-sdk/react');
26
+ var useChat;
27
+ var init_useChat = __esm({
28
+ "src/hooks/useChat.ts"() {
29
+ "use strict";
30
+ useChat = exports.useChat = _react.useChat;
31
+ }
32
+ });
33
+
34
+ // src/hooks/useObject.ts
35
+
36
+ var useObject;
37
+ var init_useObject = __esm({
38
+ "src/hooks/useObject.ts"() {
39
+ "use strict";
40
+ useObject = exports.useObject = _react.experimental_useObject;
41
+ }
42
+ });
43
+
44
+ // src/hooks/useCompletion.ts
45
+
46
+ var useCompletion;
47
+ var init_useCompletion = __esm({
48
+ "src/hooks/useCompletion.ts"() {
49
+ "use strict";
50
+ useCompletion = exports.useCompletion = _react.useCompletion;
51
+ }
52
+ });
53
+
54
+ // src/hooks/index.ts
55
+ var hooks_exports = {};
56
+ __export(hooks_exports, {
57
+ useChat: () => useChat,
58
+ useCompletion: () => useCompletion,
59
+ useObject: () => useObject
60
+ });
61
+ var init_hooks = __esm({
62
+ "src/hooks/index.ts"() {
63
+ "use strict";
64
+ init_useChat();
65
+ init_useObject();
66
+ init_useCompletion();
67
+ }
68
+ });
69
+
70
+ // src/components/DynamicUI/EntityEngineDynamicComponents.tsx
71
+ var _entityengine = require('@scenemesh/entity-engine');
72
+ var _jsxruntime = require('react/jsx-runtime');
73
+ var DynamicEntityGridComponent, DynamicEntityFormComponent, DynamicEntityKanbanComponent, DynamicEntityDashboardComponent, DynamicEntityMastailComponent, DynamicErrorDisplayComponent, ENTITY_DYNAMIC_COMPONENTS;
74
+ var init_EntityEngineDynamicComponents = __esm({
75
+ "src/components/DynamicUI/EntityEngineDynamicComponents.tsx"() {
76
+ "use strict";
77
+ DynamicEntityGridComponent = exports.DynamicEntityGridComponent = ({
78
+ modelName = "",
79
+ displayMode = "table",
80
+ toolName,
81
+ _renderHint
82
+ }) => {
83
+ if (!modelName) {
84
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
85
+ padding: "1rem",
86
+ border: "1px solid #e2e8f0",
87
+ borderRadius: "0.5rem",
88
+ backgroundColor: "#f8fafc"
89
+ }, children: [
90
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "h4", { children: [
91
+ "\u26A0\uFE0F ",
92
+ toolName,
93
+ " \u9519\u8BEF"
94
+ ] }),
95
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "\u7F3A\u5C11\u5FC5\u9700\u7684 modelName \u53C2\u6570" })
96
+ ] });
97
+ }
98
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
99
+ _entityengine.EntityViewContainer,
100
+ {
101
+ modelName,
102
+ viewType: "grid",
103
+ behavior: { mode: "display" },
104
+ viewOptions: {
105
+ mode: displayMode,
106
+ hideToolbar: false,
107
+ hideEditColumn: false,
108
+ hidePagination: false
109
+ }
110
+ }
111
+ ) });
112
+ };
113
+ DynamicEntityFormComponent = exports.DynamicEntityFormComponent = ({
114
+ modelName = "",
115
+ baseObjectId,
116
+ mode = "display",
117
+ toCreating = false,
118
+ toolName
119
+ }) => {
120
+ if (!modelName) {
121
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
122
+ padding: "1rem",
123
+ border: "1px solid #e2e8f0",
124
+ borderRadius: "0.5rem",
125
+ backgroundColor: "#f8fafc"
126
+ }, children: [
127
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "h4", { children: [
128
+ "\u26A0\uFE0F ",
129
+ toolName,
130
+ " \u9519\u8BEF"
131
+ ] }),
132
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "\u7F3A\u5C11\u5FC5\u9700\u7684 modelName \u53C2\u6570" })
133
+ ] });
134
+ }
135
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
136
+ _entityengine.EntityViewContainer,
137
+ {
138
+ modelName,
139
+ viewType: "form",
140
+ baseObjectId,
141
+ behavior: {
142
+ mode,
143
+ toCreating
144
+ }
145
+ }
146
+ ) });
147
+ };
148
+ DynamicEntityKanbanComponent = exports.DynamicEntityKanbanComponent = ({
149
+ modelName = "",
150
+ toolName,
151
+ _renderHint
152
+ }) => {
153
+ if (!modelName) {
154
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
155
+ padding: "1rem",
156
+ border: "1px solid #e2e8f0",
157
+ borderRadius: "0.5rem",
158
+ backgroundColor: "#f8fafc"
159
+ }, children: [
160
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "h4", { children: [
161
+ "\u26A0\uFE0F ",
162
+ toolName,
163
+ " \u9519\u8BEF"
164
+ ] }),
165
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "\u7F3A\u5C11\u5FC5\u9700\u7684 modelName \u53C2\u6570" })
166
+ ] });
167
+ }
168
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
169
+ _entityengine.EntityViewContainer,
170
+ {
171
+ modelName,
172
+ viewType: "kanban",
173
+ behavior: { mode: "display" },
174
+ viewOptions: {
175
+ hideToolbar: false,
176
+ hideEditColumn: false,
177
+ hidePagination: false
178
+ }
179
+ }
180
+ ) });
181
+ };
182
+ DynamicEntityDashboardComponent = exports.DynamicEntityDashboardComponent = ({
183
+ modelName = "",
184
+ toolName,
185
+ _renderHint
186
+ }) => {
187
+ if (!modelName) {
188
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
189
+ padding: "1rem",
190
+ border: "1px solid #e2e8f0",
191
+ borderRadius: "0.5rem",
192
+ backgroundColor: "#f8fafc"
193
+ }, children: [
194
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "h4", { children: [
195
+ "\u26A0\uFE0F ",
196
+ toolName,
197
+ " \u9519\u8BEF"
198
+ ] }),
199
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "\u7F3A\u5C11\u5FC5\u9700\u7684 modelName \u53C2\u6570" })
200
+ ] });
201
+ }
202
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
203
+ _entityengine.EntityViewContainer,
204
+ {
205
+ modelName,
206
+ viewType: "dashboard",
207
+ behavior: { mode: "display" },
208
+ viewOptions: {
209
+ hideToolbar: false,
210
+ hideEditColumn: false,
211
+ hidePagination: false
212
+ }
213
+ }
214
+ ) });
215
+ };
216
+ DynamicEntityMastailComponent = exports.DynamicEntityMastailComponent = ({
217
+ modelName = "",
218
+ baseObjectId,
219
+ toolName,
220
+ _renderHint
221
+ }) => {
222
+ if (!modelName) {
223
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
224
+ padding: "1rem",
225
+ border: "1px solid #e2e8f0",
226
+ borderRadius: "0.5rem",
227
+ backgroundColor: "#f8fafc"
228
+ }, children: [
229
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "h4", { children: [
230
+ "\u26A0\uFE0F ",
231
+ toolName,
232
+ " \u9519\u8BEF"
233
+ ] }),
234
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "\u7F3A\u5C11\u5FC5\u9700\u7684 modelName \u53C2\u6570" })
235
+ ] });
236
+ }
237
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
238
+ _entityengine.EntityViewContainer,
239
+ {
240
+ modelName,
241
+ viewType: "mastail",
242
+ baseObjectId,
243
+ behavior: { mode: "display" },
244
+ viewOptions: {
245
+ hideToolbar: false,
246
+ hideEditColumn: false,
247
+ hidePagination: false
248
+ }
249
+ }
250
+ ) });
251
+ };
252
+ DynamicErrorDisplayComponent = ({
253
+ toolName,
254
+ error,
255
+ errorDetails,
256
+ errorType,
257
+ executedAt,
258
+ _renderHint
259
+ }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
260
+ padding: "1rem",
261
+ backgroundColor: "#fee2e2",
262
+ border: "1px solid #fecaca",
263
+ borderRadius: "0.5rem",
264
+ color: "#dc2626",
265
+ margin: "0.5rem 0"
266
+ }, children: [
267
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { fontWeight: "500", marginBottom: "0.5rem" }, children: [
268
+ "\u274C ",
269
+ toolName,
270
+ " \u6267\u884C\u5931\u8D25"
271
+ ] }),
272
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: { margin: 0, fontSize: "0.875rem" }, children: error }),
273
+ errorDetails && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { style: { marginTop: "0.5rem" }, children: [
274
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer", fontSize: "0.875rem" }, children: "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F" }),
275
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { style: {
276
+ marginTop: "0.25rem",
277
+ fontSize: "0.75rem",
278
+ backgroundColor: "#fef2f2",
279
+ padding: "0.5rem",
280
+ borderRadius: "0.25rem",
281
+ overflow: "auto",
282
+ whiteSpace: "pre-wrap"
283
+ }, children: errorDetails })
284
+ ] }),
285
+ executedAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
286
+ fontSize: "0.75rem",
287
+ color: "#991b1b",
288
+ marginTop: "0.5rem",
289
+ opacity: 0.8
290
+ }, children: [
291
+ "\u6267\u884C\u65F6\u95F4: ",
292
+ new Date(executedAt).toLocaleString()
293
+ ] })
294
+ ] });
295
+ ENTITY_DYNAMIC_COMPONENTS = exports.ENTITY_DYNAMIC_COMPONENTS = {
296
+ "DynamicDataTable": DynamicEntityGridComponent,
297
+ "DynamicDataGrid": DynamicEntityGridComponent,
298
+ "DynamicDataList": DynamicEntityGridComponent,
299
+ "DynamicEntityForm": DynamicEntityFormComponent,
300
+ "DynamicEntityKanban": DynamicEntityKanbanComponent,
301
+ "DynamicEntityDashboard": DynamicEntityDashboardComponent,
302
+ "DynamicEntityMastail": DynamicEntityMastailComponent,
303
+ "DynamicErrorDisplay": DynamicErrorDisplayComponent
304
+ };
305
+ }
306
+ });
307
+
308
+ // src/components/DynamicUI/DynamicToolRenderer.tsx
309
+
310
+ function DynamicToolRenderer({ toolName, input, output, state }) {
311
+ switch (state) {
312
+ case "input-streaming":
313
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { padding: "0.75rem", background: "#f8fafc", borderRadius: "0.5rem", border: "1px solid #e2e8f0" }, children: [
314
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { fontWeight: "500", marginBottom: "0.25rem" }, children: [
315
+ "\u26A1 ",
316
+ toolName,
317
+ " - \u51C6\u5907\u4E2D..."
318
+ ] }),
319
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { fontSize: "0.875rem", color: "#64748b" }, children: "\u6B63\u5728\u89E3\u6790\u5DE5\u5177\u53C2\u6570..." })
320
+ ] });
321
+ case "input-available":
322
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { padding: "0.75rem", background: "#fef3c7", borderRadius: "0.5rem", border: "1px solid #f59e0b" }, children: [
323
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { fontWeight: "500", marginBottom: "0.25rem" }, children: [
324
+ "\u{1F527} ",
325
+ toolName,
326
+ " - \u6267\u884C\u4E2D"
327
+ ] }),
328
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { fontSize: "0.875rem", color: "#92400e" }, children: [
329
+ _optionalChain([input, 'optionalAccess', _ => _.modelName]) && `\u67E5\u8BE2\u6A21\u578B\uFF1A${input.modelName}`,
330
+ _optionalChain([input, 'optionalAccess', _2 => _2.displayMode]) && ` | \u663E\u793A\u6A21\u5F0F\uFF1A${input.displayMode}`
331
+ ] })
332
+ ] });
333
+ case "output-available":
334
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
335
+ DynamicOutputRenderer,
336
+ {
337
+ toolName,
338
+ input,
339
+ output
340
+ }
341
+ );
342
+ case "output-error":
343
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
344
+ padding: "1rem",
345
+ background: "#fee2e2",
346
+ borderRadius: "0.5rem",
347
+ border: "1px solid #fecaca",
348
+ color: "#dc2626"
349
+ }, children: [
350
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { fontWeight: "500", marginBottom: "0.5rem" }, children: [
351
+ "\u274C ",
352
+ toolName,
353
+ " \u6267\u884C\u5931\u8D25"
354
+ ] }),
355
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: { margin: 0 }, children: _optionalChain([output, 'optionalAccess', _3 => _3.error]) || "\u672A\u77E5\u9519\u8BEF" }),
356
+ _optionalChain([output, 'optionalAccess', _4 => _4.errorDetails]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { style: { marginTop: "0.5rem" }, children: [
357
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "\u8BE6\u7EC6\u4FE1\u606F" }),
358
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: { marginTop: "0.25rem", fontSize: "0.875rem" }, children: output.errorDetails })
359
+ ] })
360
+ ] });
361
+ default:
362
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { padding: "0.75rem", background: "#f1f5f9", borderRadius: "0.5rem" }, children: [
363
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "h4", { children: [
364
+ "\u{1F527} ",
365
+ toolName
366
+ ] }),
367
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { children: [
368
+ "\u672A\u77E5\u72B6\u6001: ",
369
+ state
370
+ ] })
371
+ ] });
372
+ }
373
+ }
374
+ function DynamicOutputRenderer({ toolName, input, output }) {
375
+ const renderHint = _optionalChain([output, 'optionalAccess', _5 => _5._renderHint]);
376
+ const componentType = _optionalChain([renderHint, 'optionalAccess', _6 => _6.componentType]);
377
+ const displayMode = _optionalChain([input, 'optionalAccess', _7 => _7.displayMode]) || _optionalChain([output, 'optionalAccess', _8 => _8.displayMode]);
378
+ let selectedComponentType;
379
+ if (componentType && componentType in ENTITY_DYNAMIC_COMPONENTS) {
380
+ selectedComponentType = componentType;
381
+ } else {
382
+ switch (displayMode) {
383
+ case "table":
384
+ selectedComponentType = "DynamicDataTable";
385
+ break;
386
+ case "list":
387
+ selectedComponentType = "DynamicDataGrid";
388
+ break;
389
+ case "grid":
390
+ selectedComponentType = "DynamicDataGrid";
391
+ break;
392
+ case "form":
393
+ selectedComponentType = "DynamicEntityForm";
394
+ break;
395
+ case "kanban":
396
+ selectedComponentType = "DynamicEntityKanban";
397
+ break;
398
+ case "dashboard":
399
+ selectedComponentType = "DynamicEntityDashboard";
400
+ break;
401
+ case "mastail":
402
+ selectedComponentType = "DynamicEntityMastail";
403
+ break;
404
+ default:
405
+ if (_optionalChain([input, 'optionalAccess', _9 => _9.baseObjectId]) || _optionalChain([output, 'optionalAccess', _10 => _10.baseObjectId])) {
406
+ selectedComponentType = "DynamicEntityForm";
407
+ } else {
408
+ selectedComponentType = "DynamicDataGrid";
409
+ }
410
+ }
411
+ }
412
+ const SelectedComponent = ENTITY_DYNAMIC_COMPONENTS[selectedComponentType];
413
+ const componentProps = {
414
+ toolName,
415
+ modelName: _optionalChain([input, 'optionalAccess', _11 => _11.modelName]) || _optionalChain([output, 'optionalAccess', _12 => _12.modelName]),
416
+ displayMode: displayMode || "table",
417
+ data: _optionalChain([output, 'optionalAccess', _13 => _13.data]),
418
+ totalCount: _optionalChain([output, 'optionalAccess', _14 => _14.totalCount]),
419
+ pagination: _optionalChain([output, 'optionalAccess', _15 => _15.pagination]),
420
+ query: _optionalChain([output, 'optionalAccess', _16 => _16.query]) || {
421
+ sortBy: _optionalChain([input, 'optionalAccess', _17 => _17.sortBy]),
422
+ filters: _optionalChain([input, 'optionalAccess', _18 => _18.filters])
423
+ },
424
+ baseObjectId: _optionalChain([input, 'optionalAccess', _19 => _19.baseObjectId]),
425
+ mode: _optionalChain([input, 'optionalAccess', _20 => _20.mode]) === "create" ? "edit" : _optionalChain([input, 'optionalAccess', _21 => _21.mode]) || "display",
426
+ toCreating: _optionalChain([input, 'optionalAccess', _22 => _22.mode]) === "create",
427
+ executedAt: _optionalChain([output, 'optionalAccess', _23 => _23.executedAt]),
428
+ toolCallId: _optionalChain([output, 'optionalAccess', _24 => _24.toolCallId]),
429
+ _renderHint: renderHint
430
+ };
431
+ if (selectedComponentType === "DynamicErrorDisplay") {
432
+ componentProps.error = _optionalChain([output, 'optionalAccess', _25 => _25.error]) || "Unknown error";
433
+ componentProps.errorDetails = _optionalChain([output, 'optionalAccess', _26 => _26.errorDetails]) || _optionalChain([renderHint, 'optionalAccess', _27 => _27.errorDetails]);
434
+ componentProps.errorType = _optionalChain([output, 'optionalAccess', _28 => _28.errorType]) || _optionalChain([renderHint, 'optionalAccess', _29 => _29.errorType]) || "unknown";
435
+ }
436
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { margin: "0.5rem 0" }, children: [
437
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
438
+ fontWeight: "500",
439
+ marginBottom: "0.75rem",
440
+ padding: "0.5rem",
441
+ background: "#f0f9ff",
442
+ borderRadius: "0.375rem",
443
+ border: "1px solid #e0f2fe"
444
+ }, children: [
445
+ "\u{1F527} ",
446
+ toolName,
447
+ " \u7ED3\u679C",
448
+ _optionalChain([output, 'optionalAccess', _30 => _30.executedAt]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
449
+ fontSize: "0.75rem",
450
+ color: "#64748b",
451
+ marginLeft: "0.5rem"
452
+ }, children: new Date(output.executedAt).toLocaleString() })
453
+ ] }),
454
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectedComponent, { ...componentProps })
455
+ ] });
456
+ }
457
+ var init_DynamicToolRenderer = __esm({
458
+ "src/components/DynamicUI/DynamicToolRenderer.tsx"() {
459
+ "use strict";
460
+ init_EntityEngineDynamicComponents();
461
+ }
462
+ });
463
+
464
+ // src/components/DynamicUI/index.ts
465
+ var init_DynamicUI = __esm({
466
+ "src/components/DynamicUI/index.ts"() {
467
+ "use strict";
468
+ init_DynamicToolRenderer();
469
+ init_EntityEngineDynamicComponents();
470
+ }
471
+ });
472
+
473
+ // src/components/GenerativeUI/PrebuiltComponents.tsx
474
+
475
+
476
+ var WeatherComponent, LocationComponent, CodeExecutionComponent;
477
+ var init_PrebuiltComponents = __esm({
478
+ "src/components/GenerativeUI/PrebuiltComponents.tsx"() {
479
+ "use strict";
480
+ WeatherComponent = exports.WeatherComponent = ({
481
+ temperature = 0,
482
+ weather = "",
483
+ location = "",
484
+ humidity,
485
+ windSpeed
486
+ }) => (
487
+ // <div style={{
488
+ // background: 'linear-gradient(135deg, #74b9ff 0%, #0984e3 100%)',
489
+ // color: 'white',
490
+ // padding: '1.5rem',
491
+ // borderRadius: '0.75rem',
492
+ // margin: '0.5rem 0',
493
+ // boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
494
+ // }}>
495
+ // <div style={{ display: 'flex', alignItems: 'center', marginBottom: '0.5rem' }}>
496
+ // <span style={{ fontSize: '1.5rem', marginRight: '0.5rem' }}>🌤️</span>
497
+ // <h3 style={{ margin: 0, fontSize: '1.25rem' }}>{location}</h3>
498
+ // </div>
499
+ // <p style={{ margin: '0.25rem 0', fontSize: '1rem' }}>{weather}</p>
500
+ // <p style={{ margin: '0.25rem 0', fontSize: '1.5rem', fontWeight: 'bold' }}>{temperature}°C</p>
501
+ // {humidity && <p style={{ margin: '0.25rem 0', fontSize: '0.875rem' }}>湿度: {humidity}%</p>}
502
+ // {windSpeed && <p style={{ margin: '0.25rem 0', fontSize: '0.875rem' }}>风速: {windSpeed} km/h</p>}
503
+ // </div>
504
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _entityengine.EntityViewContainer, { modelName: "product", viewType: "grid", behavior: { mode: "edit" } })
505
+ );
506
+ LocationComponent = exports.LocationComponent = ({
507
+ city = "",
508
+ country = "",
509
+ province = "",
510
+ coordinates,
511
+ timezone = "",
512
+ population,
513
+ area
514
+ }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
515
+ background: "linear-gradient(135deg, #fd79a8 0%, #e84393 100%)",
516
+ color: "white",
517
+ padding: "1.5rem",
518
+ borderRadius: "0.75rem",
519
+ margin: "0.5rem 0",
520
+ boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
521
+ }, children: [
522
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "flex", alignItems: "center", marginBottom: "0.5rem" }, children: [
523
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { fontSize: "1.5rem", marginRight: "0.5rem" }, children: "\u{1F4CD}" }),
524
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { style: { margin: 0, fontSize: "1.25rem" }, children: city })
525
+ ] }),
526
+ province && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { margin: "0.25rem 0", fontSize: "1rem" }, children: [
527
+ province,
528
+ ", ",
529
+ country
530
+ ] }),
531
+ coordinates && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { margin: "0.25rem 0", fontSize: "0.875rem" }, children: [
532
+ "\u5750\u6807: ",
533
+ coordinates.lat.toFixed(4),
534
+ ", ",
535
+ coordinates.lng.toFixed(4)
536
+ ] }),
537
+ timezone && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { margin: "0.25rem 0", fontSize: "0.875rem" }, children: [
538
+ "\u65F6\u533A: ",
539
+ timezone
540
+ ] }),
541
+ population && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { margin: "0.25rem 0", fontSize: "0.875rem" }, children: [
542
+ "\u4EBA\u53E3: ",
543
+ population.toLocaleString(),
544
+ "\u4E07\u4EBA"
545
+ ] }),
546
+ area && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { margin: "0.25rem 0", fontSize: "0.875rem" }, children: [
547
+ "\u9762\u79EF: ",
548
+ area.toLocaleString(),
549
+ " km\xB2"
550
+ ] })
551
+ ] });
552
+ CodeExecutionComponent = exports.CodeExecutionComponent = ({
553
+ code = "",
554
+ language = "javascript",
555
+ output = "",
556
+ status = "success"
557
+ }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
558
+ background: "#f8fafc",
559
+ border: "1px solid #e2e8f0",
560
+ borderRadius: "0.75rem",
561
+ margin: "0.5rem 0",
562
+ overflow: "hidden"
563
+ }, children: [
564
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
565
+ background: "#334155",
566
+ color: "white",
567
+ padding: "0.75rem 1rem",
568
+ fontSize: "0.875rem",
569
+ display: "flex",
570
+ alignItems: "center"
571
+ }, children: [
572
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { marginRight: "0.5rem" }, children: "\u{1F4BB}" }),
573
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
574
+ "\u4EE3\u7801\u6267\u884C (",
575
+ language,
576
+ ")"
577
+ ] }),
578
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
579
+ marginLeft: "auto",
580
+ fontSize: "0.75rem",
581
+ color: status === "success" ? "#10b981" : status === "error" ? "#ef4444" : "#f59e0b"
582
+ }, children: status === "success" ? "\u2705 \u6210\u529F" : status === "error" ? "\u274C \u9519\u8BEF" : "\u23F3 \u8FD0\u884C\u4E2D" })
583
+ ] }),
584
+ code && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "1rem" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { style: {
585
+ background: "#1e293b",
586
+ color: "#e2e8f0",
587
+ padding: "1rem",
588
+ borderRadius: "0.5rem",
589
+ fontSize: "0.875rem",
590
+ overflow: "auto",
591
+ margin: "0 0 1rem 0"
592
+ }, children: code }) }),
593
+ output && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { padding: "0 1rem 1rem" }, children: [
594
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { style: { margin: "0 0 0.5rem 0", fontSize: "0.875rem", color: "#64748b" }, children: "\u8F93\u51FA:" }),
595
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { style: {
596
+ background: status === "error" ? "#fef2f2" : "#f0f9ff",
597
+ color: status === "error" ? "#dc2626" : "#0f172a",
598
+ padding: "1rem",
599
+ borderRadius: "0.5rem",
600
+ fontSize: "0.875rem",
601
+ overflow: "auto",
602
+ margin: 0,
603
+ border: `1px solid ${status === "error" ? "#fecaca" : "#e0f2fe"}`
604
+ }, children: output })
605
+ ] })
606
+ ] });
607
+ }
608
+ });
609
+
610
+ // src/components/MessageBubble/MessageBubble.tsx
611
+ var _core = require('@mantine/core');
612
+
613
+ function MessageBubble({
614
+ message,
615
+ showAvatar = false,
616
+ // 不再使用头像
617
+ showTimestamp = true,
618
+ onToolResult,
619
+ enableReasoning = true,
620
+ enableGenerativeUI = true,
621
+ showReasoningByDefault = false
622
+ }) {
623
+ const isUser = message.role === "user";
624
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Stack, { gap: "xs", mb: "md", style: { width: "100%" }, children: [
625
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
626
+ _core.Group,
627
+ {
628
+ gap: "xs",
629
+ align: "center",
630
+ justify: isUser ? "flex-end" : "flex-start",
631
+ children: [
632
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
633
+ _core.Badge,
634
+ {
635
+ variant: "light",
636
+ color: isUser ? "blue" : "gray",
637
+ size: "xs",
638
+ radius: "sm",
639
+ children: isUser ? "You" : "AI"
640
+ }
641
+ ),
642
+ showTimestamp && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-5)", children: (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
643
+ ]
644
+ }
645
+ ),
646
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
647
+ _core.Box,
648
+ {
649
+ style: {
650
+ width: "100%",
651
+ display: "flex",
652
+ justifyContent: isUser ? "flex-end" : "flex-start"
653
+ },
654
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
655
+ _core.Box,
656
+ {
657
+ style: {
658
+ maxWidth: "100%",
659
+ width: isUser ? "fit-content" : "100%"
660
+ },
661
+ children: message.parts.map((part, index) => {
662
+ if (part.type === "text") {
663
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
664
+ _core.Text,
665
+ {
666
+ size: "sm",
667
+ style: {
668
+ lineHeight: 1.5,
669
+ whiteSpace: "pre-wrap",
670
+ wordBreak: "break-word",
671
+ textAlign: isUser ? "right" : "left"
672
+ },
673
+ c: "var(--mantine-color-text)",
674
+ children: part.text
675
+ },
676
+ index
677
+ );
678
+ }
679
+ if (part.type === "file") {
680
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileDisplay, { file: part }, index);
681
+ }
682
+ if (part.type === "data") {
683
+ if (_optionalChain([part, 'access', _31 => _31.data, 'optionalAccess', _32 => _32.type]) === "reasoning" && enableReasoning) {
684
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
685
+ ReasoningDisplay,
686
+ {
687
+ reasoning: part.data.content,
688
+ step: part.data.step
689
+ },
690
+ index
691
+ );
692
+ }
693
+ return null;
694
+ }
695
+ if (part.type === "tool-getWeather") {
696
+ switch (part.state) {
697
+ case "input-streaming":
698
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: "Preparing weather request..." }, index);
699
+ case "input-available":
700
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: [
701
+ "Getting weather for ",
702
+ _optionalChain([part, 'access', _33 => _33.input, 'optionalAccess', _34 => _34.location]),
703
+ "..."
704
+ ] }, index);
705
+ case "output-available": {
706
+ if (onToolResult) {
707
+ onToolResult({
708
+ toolName: "getWeather",
709
+ input: part.input,
710
+ output: part.output,
711
+ state: part.state
712
+ });
713
+ }
714
+ const rawData = part.output.data || part.output;
715
+ const weatherData = {
716
+ ...rawData,
717
+ weather: rawData.condition || rawData.weather
718
+ };
719
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WeatherComponent, { ...weatherData }) }, index);
720
+ }
721
+ case "output-error":
722
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Paper, { p: "sm", withBorder: true, style: {
723
+ backgroundColor: "var(--mantine-color-red-0)",
724
+ borderColor: "var(--mantine-color-red-2)",
725
+ borderLeft: "3px solid var(--mantine-color-red-4)"
726
+ }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-red-8)", children: [
727
+ "\u274C Weather Error: ",
728
+ part.errorText
729
+ ] }) }, index);
730
+ default:
731
+ return null;
732
+ }
733
+ }
734
+ if (part.type === "tool-getLocation") {
735
+ switch (part.state) {
736
+ case "input-streaming":
737
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: "Preparing location request..." }, index);
738
+ case "input-available":
739
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: [
740
+ "Getting location for ",
741
+ _optionalChain([part, 'access', _35 => _35.input, 'optionalAccess', _36 => _36.city]),
742
+ "..."
743
+ ] }, index);
744
+ case "output-available": {
745
+ if (onToolResult) {
746
+ onToolResult({
747
+ toolName: "getLocation",
748
+ input: part.input,
749
+ output: part.output,
750
+ state: part.state
751
+ });
752
+ }
753
+ const locationData = part.output.data || part.output;
754
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LocationComponent, { ...locationData }) }, index);
755
+ }
756
+ case "output-error":
757
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Paper, { p: "sm", withBorder: true, style: {
758
+ backgroundColor: "var(--mantine-color-red-0)",
759
+ borderColor: "var(--mantine-color-red-2)",
760
+ borderLeft: "3px solid var(--mantine-color-red-4)"
761
+ }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-red-8)", children: [
762
+ "\u274C Location Error: ",
763
+ part.errorText
764
+ ] }) }, index);
765
+ default:
766
+ return null;
767
+ }
768
+ }
769
+ if (part.type === "tool-displayWeather") {
770
+ switch (part.state) {
771
+ case "input-streaming":
772
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: "Preparing weather display..." }, index);
773
+ case "input-available":
774
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: [
775
+ "Loading weather display for ",
776
+ _optionalChain([part, 'access', _37 => _37.input, 'optionalAccess', _38 => _38.location]),
777
+ "..."
778
+ ] }, index);
779
+ case "output-available":
780
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WeatherComponent, { ...part.output }) }, index);
781
+ case "output-error":
782
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Paper, { p: "sm", withBorder: true, style: {
783
+ backgroundColor: "var(--mantine-color-red-0)",
784
+ borderColor: "var(--mantine-color-red-2)",
785
+ borderLeft: "3px solid var(--mantine-color-red-4)"
786
+ }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-red-8)", children: [
787
+ "\u274C Weather Display Error: ",
788
+ part.errorText
789
+ ] }) }, index);
790
+ default:
791
+ return null;
792
+ }
793
+ }
794
+ if (part.type === "tool-executeCode") {
795
+ switch (part.state) {
796
+ case "input-streaming":
797
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: "Preparing code execution..." }, index);
798
+ case "input-available":
799
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: "Executing code..." }, index);
800
+ case "output-available":
801
+ if (onToolResult) {
802
+ onToolResult({
803
+ toolName: "executeCode",
804
+ input: part.input,
805
+ output: part.output,
806
+ state: part.state
807
+ });
808
+ }
809
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CodeExecutionComponent, { ...part.output }) }, index);
810
+ case "output-error":
811
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Paper, { p: "sm", withBorder: true, style: {
812
+ backgroundColor: "var(--mantine-color-red-0)",
813
+ borderColor: "var(--mantine-color-red-2)",
814
+ borderLeft: "3px solid var(--mantine-color-red-4)"
815
+ }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-red-8)", children: [
816
+ "\u274C Code Execution Error: ",
817
+ part.errorText
818
+ ] }) }, index);
819
+ default:
820
+ return null;
821
+ }
822
+ }
823
+ if (part.type === "dynamic-tool") {
824
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
825
+ DynamicToolRenderer,
826
+ {
827
+ toolName: part.toolName,
828
+ input: part.input,
829
+ output: part.output,
830
+ state: part.state
831
+ },
832
+ index
833
+ );
834
+ }
835
+ if (part.type === "tool-result") {
836
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Paper, { p: "sm", withBorder: true, style: {
837
+ backgroundColor: "var(--mantine-color-blue-0)",
838
+ borderColor: "var(--mantine-color-blue-2)",
839
+ borderLeft: "3px solid var(--mantine-color-blue-4)"
840
+ }, children: [
841
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", fw: 500, c: "var(--mantine-color-blue-8)", mb: 4, children: "\u{1F527} Tool Result" }),
842
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { component: "pre", size: "xs", style: {
843
+ fontFamily: "monospace",
844
+ margin: 0,
845
+ lineHeight: 1.3,
846
+ overflow: "auto"
847
+ }, c: "var(--mantine-color-gray-7)", children: JSON.stringify(part.result, null, 2) })
848
+ ] }, index);
849
+ }
850
+ return null;
851
+ })
852
+ }
853
+ )
854
+ }
855
+ )
856
+ ] });
857
+ }
858
+ var ReasoningDisplay, FileDisplay;
859
+ var init_MessageBubble = __esm({
860
+ "src/components/MessageBubble/MessageBubble.tsx"() {
861
+ "use strict";
862
+ init_DynamicUI();
863
+ init_PrebuiltComponents();
864
+ ReasoningDisplay = ({ reasoning, step }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
865
+ _core.Paper,
866
+ {
867
+ p: "sm",
868
+ withBorder: true,
869
+ style: {
870
+ backgroundColor: "var(--mantine-color-yellow-0)",
871
+ borderColor: "var(--mantine-color-yellow-2)",
872
+ borderLeft: "3px solid var(--mantine-color-yellow-4)"
873
+ },
874
+ children: [
875
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", fw: 500, c: "var(--mantine-color-yellow-8)", mb: 4, children: [
876
+ "\u{1F4AD} ",
877
+ step ? `Step ${step}:` : "Reasoning:"
878
+ ] }),
879
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-7)", style: { lineHeight: 1.3 }, children: reasoning })
880
+ ]
881
+ }
882
+ );
883
+ FileDisplay = ({ file }) => {
884
+ if (!file) return null;
885
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
886
+ _core.Paper,
887
+ {
888
+ p: "sm",
889
+ withBorder: true,
890
+ style: {
891
+ backgroundColor: "var(--mantine-color-gray-0)",
892
+ borderColor: "var(--mantine-color-gray-3)"
893
+ },
894
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "xs", align: "center", children: [
895
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
896
+ _core.Box,
897
+ {
898
+ w: 24,
899
+ h: 24,
900
+ bg: "var(--mantine-color-gray-1)",
901
+ style: {
902
+ borderRadius: "4px",
903
+ display: "flex",
904
+ alignItems: "center",
905
+ justifyContent: "center",
906
+ fontSize: "12px"
907
+ },
908
+ children: "\u{1F4CE}"
909
+ }
910
+ ),
911
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Box, { style: { flex: 1 }, children: [
912
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", fw: 500, c: "var(--mantine-color-gray-8)", children: file.name || "File" }),
913
+ file.size && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: [
914
+ Math.round(file.size / 1024),
915
+ "KB"
916
+ ] }),
917
+ file.url && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
918
+ _core.Text,
919
+ {
920
+ size: "xs",
921
+ component: "a",
922
+ href: file.url,
923
+ target: "_blank",
924
+ rel: "noopener noreferrer",
925
+ c: "var(--mantine-color-blue-6)",
926
+ td: "none",
927
+ style: { cursor: "pointer" },
928
+ children: "View File"
929
+ }
930
+ )
931
+ ] })
932
+ ] })
933
+ }
934
+ );
935
+ };
936
+ }
937
+ });
938
+
939
+ // src/utils/theme.ts
940
+ function getThemedTextProps(variant = "primary") {
941
+ switch (variant) {
942
+ case "primary":
943
+ return { c: aiThemeColors.primaryText };
944
+ case "secondary":
945
+ return { c: aiThemeColors.secondaryText };
946
+ case "heading":
947
+ return { c: aiThemeColors.headingText, fw: 600 };
948
+ case "muted":
949
+ return { c: "var(--mantine-color-gray-6)" };
950
+ // 深色模式下更清晰
951
+ case "subtitle":
952
+ return { c: "var(--mantine-color-gray-7)", fw: 500 };
953
+ case "caption":
954
+ return { c: "var(--mantine-color-gray-6)" };
955
+ case "success":
956
+ return { c: aiThemeColors.success };
957
+ case "warning":
958
+ return { c: aiThemeColors.warning };
959
+ case "error":
960
+ return { c: aiThemeColors.error };
961
+ case "info":
962
+ return { c: aiThemeColors.info };
963
+ default:
964
+ return { c: aiThemeColors.primaryText };
965
+ }
966
+ }
967
+ var aiThemeColors, componentStyles;
968
+ var init_theme = __esm({
969
+ "src/utils/theme.ts"() {
970
+ "use strict";
971
+ aiThemeColors = {
972
+ // 主要文本颜色 - 使用 Mantine CSS 变量
973
+ primaryText: "var(--mantine-color-text)",
974
+ // 主要文本颜色,自动适配主题
975
+ secondaryText: "var(--mantine-color-dimmed)",
976
+ // 次要文本颜色
977
+ headingText: "var(--mantine-color-text)",
978
+ // 标题文本颜色
979
+ // 语义化文本颜色 - 优化深色模式
980
+ mutedText: "var(--mantine-color-dimmed)",
981
+ // 静音文本,使用dimmed确保深色模式协调
982
+ placeholderText: "var(--mantine-color-placeholder)",
983
+ // 占位符文本
984
+ // 状态颜色 - 使用 Mantine 预定义颜色
985
+ success: "var(--mantine-color-green-filled)",
986
+ warning: "var(--mantine-color-yellow-filled)",
987
+ error: "var(--mantine-color-red-filled)",
988
+ info: "var(--mantine-color-blue-filled)",
989
+ // 浅色状态颜色(用于背景)- 深色模式自动适配
990
+ successLight: "var(--mantine-color-green-light)",
991
+ warningLight: "var(--mantine-color-yellow-light)",
992
+ errorLight: "var(--mantine-color-red-light)",
993
+ infoLight: "var(--mantine-color-blue-light)",
994
+ // 背景颜色 - 深色模式自动切换
995
+ bodyBackground: "var(--mantine-color-body)",
996
+ // 主体背景
997
+ cardBackground: "var(--mantine-color-default)",
998
+ // 卡片背景,使用default确保深色模式协调
999
+ paperBackground: "var(--mantine-color-default)",
1000
+ // 纸张背景
1001
+ codeBackground: "var(--mantine-color-default)",
1002
+ // 代码背景,深色模式下自动变深
1003
+ // 边框和分隔线 - 深色模式自动适配
1004
+ border: "var(--mantine-color-default-border)",
1005
+ // 默认边框
1006
+ borderLight: "var(--mantine-color-default-border)",
1007
+ // 统一使用default-border
1008
+ divider: "var(--mantine-color-default-border)",
1009
+ // 分隔线
1010
+ // 交互状态 - 深色模式友好
1011
+ hoverBackground: "var(--mantine-color-default-hover)",
1012
+ // 悬浮背景,深色模式自动调整
1013
+ selectedBackground: "var(--mantine-color-blue-light)",
1014
+ // 选中背景 - 使用蓝色,深色模式下更清晰
1015
+ selectedText: "var(--mantine-color-blue-filled)",
1016
+ // 选中文本 - 使用蓝色,深色模式下更清晰
1017
+ // 输入组件 - 深色模式协调
1018
+ inputBackground: "var(--mantine-color-default)",
1019
+ // 输入框背景
1020
+ inputBorder: "var(--mantine-color-default-border)",
1021
+ // 输入框边框
1022
+ inputPlaceholder: "var(--mantine-color-placeholder)"
1023
+ // 输入框占位符
1024
+ };
1025
+ componentStyles = {
1026
+ // 共享基础样式
1027
+ cardBackground: aiThemeColors.cardBackground,
1028
+ // 聊天对话框样式 - 深色模式优化
1029
+ chatDialog: {
1030
+ titleColor: aiThemeColors.headingText,
1031
+ descriptionColor: aiThemeColors.secondaryText,
1032
+ cardBackground: aiThemeColors.cardBackground,
1033
+ border: aiThemeColors.border
1034
+ },
1035
+ // 消息气泡样式
1036
+ messageBubble: {
1037
+ userBackground: "var(--mantine-color-blue-filled)",
1038
+ userText: "var(--mantine-color-white)",
1039
+ aiBackground: aiThemeColors.cardBackground,
1040
+ aiText: aiThemeColors.primaryText,
1041
+ border: aiThemeColors.border
1042
+ },
1043
+ // 文件查看器样式
1044
+ fileViewer: {
1045
+ background: aiThemeColors.cardBackground,
1046
+ border: aiThemeColors.borderLight,
1047
+ text: aiThemeColors.primaryText
1048
+ },
1049
+ // 代码背景
1050
+ codeBackground: aiThemeColors.codeBackground,
1051
+ // 工具栏样式
1052
+ toolbar: {
1053
+ background: aiThemeColors.bodyBackground,
1054
+ border: aiThemeColors.border,
1055
+ text: aiThemeColors.primaryText
1056
+ },
1057
+ // 状态样式配置 - 深色模式完美适配
1058
+ status: {
1059
+ error: {
1060
+ background: "var(--mantine-color-red-light)",
1061
+ border: "var(--mantine-color-red-outline)",
1062
+ text: "var(--mantine-color-red-light-color)",
1063
+ textSecondary: "var(--mantine-color-red-light-color)",
1064
+ textLight: "var(--mantine-color-red-light-color)",
1065
+ icon: "var(--mantine-color-red-light-color)",
1066
+ progressColor: "red"
1067
+ },
1068
+ warning: {
1069
+ background: "var(--mantine-color-yellow-light)",
1070
+ border: "var(--mantine-color-yellow-outline)",
1071
+ text: "var(--mantine-color-yellow-light-color)",
1072
+ textSecondary: "var(--mantine-color-yellow-light-color)",
1073
+ textLight: "var(--mantine-color-yellow-light-color)",
1074
+ icon: "var(--mantine-color-yellow-light-color)",
1075
+ progressColor: "yellow"
1076
+ },
1077
+ success: {
1078
+ background: "var(--mantine-color-green-light)",
1079
+ border: "var(--mantine-color-green-outline)",
1080
+ text: "var(--mantine-color-green-light-color)",
1081
+ textSecondary: "var(--mantine-color-green-light-color)",
1082
+ textLight: "var(--mantine-color-green-light-color)",
1083
+ icon: "var(--mantine-color-green-light-color)",
1084
+ progressColor: "green"
1085
+ },
1086
+ info: {
1087
+ background: "var(--mantine-color-blue-light)",
1088
+ border: "var(--mantine-color-blue-outline)",
1089
+ text: "var(--mantine-color-blue-light-color)",
1090
+ textSecondary: "var(--mantine-color-blue-light-color)",
1091
+ textLight: "var(--mantine-color-blue-light-color)",
1092
+ icon: "var(--mantine-color-blue-light-color)",
1093
+ progressColor: "blue"
1094
+ }
1095
+ },
1096
+ // 文字颜色标准化系统 - 深色模式优化
1097
+ text: {
1098
+ // 主要文字级别
1099
+ primary: aiThemeColors.primaryText,
1100
+ // 主标题、重要内容
1101
+ heading: aiThemeColors.headingText,
1102
+ // 页面标题、section标题
1103
+ subtitle: "var(--mantine-color-gray-7)",
1104
+ // 副标题,清晰但次要
1105
+ // 次要文字级别
1106
+ secondary: aiThemeColors.secondaryText,
1107
+ // 正文内容
1108
+ caption: "var(--mantine-color-gray-6)",
1109
+ // 说明文字,比dimmed更清晰
1110
+ label: "var(--mantine-color-gray-7)",
1111
+ // 标签文字
1112
+ // 弱化文字级别
1113
+ muted: "var(--mantine-color-gray-6)",
1114
+ // 静音文字,深色模式优化
1115
+ placeholder: aiThemeColors.placeholderText,
1116
+ // 占位符文字
1117
+ disabled: "var(--mantine-color-gray-5)",
1118
+ // 禁用状态文字
1119
+ // 状态文字
1120
+ success: aiThemeColors.success,
1121
+ warning: aiThemeColors.warning,
1122
+ error: aiThemeColors.error,
1123
+ info: aiThemeColors.info
1124
+ }
1125
+ };
1126
+ }
1127
+ });
1128
+
1129
+ // src/components/ChatDialog/ChatDialog.tsx
1130
+ var _framermotion = require('framer-motion');
1131
+ var _react3 = require('react'); var _react4 = _interopRequireDefault(_react3);
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+ var _lucidereact = require('lucide-react');
1140
+
1141
+
1142
+ function ChatDialog({
1143
+ chatOptions = {},
1144
+ title = "AI Assistant",
1145
+ description = "Chat with your AI assistant",
1146
+ open = false,
1147
+ onOpenChange,
1148
+ placeholder = "Type your message here...",
1149
+ className,
1150
+ showHeader = true,
1151
+ allowFileUpload = true,
1152
+ acceptedFileTypes = ["image/*", "text/*", "application/pdf"],
1153
+ maxFileSize = 10 * 1024 * 1024,
1154
+ // 10MB
1155
+ messageRenderer,
1156
+ theme = "system",
1157
+ // 新增的增强功能选项
1158
+ enableReasoning = true,
1159
+ enableGenerativeUI = true,
1160
+ showReasoningByDefault = false
1161
+ }) {
1162
+ const [frontendToolStatus, setFrontendToolStatus] = _react3.useState.call(void 0, {
1163
+ isProcessing: false,
1164
+ currentTool: void 0,
1165
+ processedTools: /* @__PURE__ */ new Set()
1166
+ // 防止重复处理
1167
+ });
1168
+ const handleError = _react3.useCallback.call(void 0, (err) => {
1169
+ console.error("ChatDialog useChat error:", err);
1170
+ let friendlyError = err;
1171
+ const originalMessage = err.message || "Unknown occurred";
1172
+ if (originalMessage.includes("<!DOCTYPE") || originalMessage.includes("<html>") || originalMessage.includes("<body>")) {
1173
+ friendlyError = new Error("AI\u670D\u52A1\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u5668\u662F\u5426\u6B63\u5728\u8FD0\u884C");
1174
+ friendlyError.name = err.name;
1175
+ } else if (originalMessage.includes("fetch") || originalMessage.includes("NetworkError") || originalMessage.includes("Failed to fetch")) {
1176
+ friendlyError = new Error("AI\u670D\u52A1\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5");
1177
+ friendlyError.name = err.name;
1178
+ } else if (originalMessage.includes("404") || originalMessage.includes("Not Found")) {
1179
+ friendlyError = new Error("AI API\u7AEF\u70B9\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u4FDDAI\u670D\u52A1\u5668\u6B63\u5728\u8FD0\u884C\u5E76\u4E14\u7AEF\u70B9\u914D\u7F6E\u6B63\u786E");
1180
+ friendlyError.name = err.name;
1181
+ } else if (originalMessage.includes("ECONNREFUSED") || originalMessage.includes("Connection refused")) {
1182
+ friendlyError = new Error("AI\u670D\u52A1\u5668\u8FDE\u63A5\u88AB\u62D2\u7EDD");
1183
+ friendlyError.name = err.name;
1184
+ }
1185
+ _optionalChain([chatOptions, 'access', _39 => _39.onError, 'optionalCall', _40 => _40(friendlyError)]);
1186
+ }, [chatOptions]);
1187
+ const {
1188
+ messages,
1189
+ status,
1190
+ error,
1191
+ sendMessage,
1192
+ stop,
1193
+ clearError,
1194
+ resumeStream,
1195
+ addToolResult,
1196
+ setMessages
1197
+ } = useChat({
1198
+ // Use standard properties from chatOptions
1199
+ ...chatOptions,
1200
+ // Standard onFinish callback
1201
+ onFinish: (options) => {
1202
+ setTimeout(() => {
1203
+ _optionalChain([inputRef, 'access', _41 => _41.current, 'optionalAccess', _42 => _42.focus, 'call', _43 => _43()]);
1204
+ }, 100);
1205
+ _optionalChain([chatOptions, 'access', _44 => _44.onFinish, 'optionalCall', _45 => _45(options)]);
1206
+ },
1207
+ onError: handleError,
1208
+ // Standard onToolCall - for listening only, no return value
1209
+ onToolCall: chatOptions.onToolCall
1210
+ });
1211
+ _react3.useEffect.call(void 0, () => {
1212
+ const handleFrontendToolCall = async (toolName, input2) => {
1213
+ const frontendToolNames = [
1214
+ "recordGetValues",
1215
+ "recordSetValues",
1216
+ "recordGetFieldInfo",
1217
+ "recordResetForm",
1218
+ "recordValidateForm"
1219
+ ];
1220
+ if (!frontendToolNames.includes(toolName)) {
1221
+ return;
1222
+ }
1223
+ setFrontendToolStatus((prev) => ({
1224
+ ...prev,
1225
+ isProcessing: true,
1226
+ currentTool: toolName
1227
+ }));
1228
+ const waitId = `frontend-${toolName}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1229
+ try {
1230
+ if (window.__ENTITY_ENGINE_AI_BRIDGE__) {
1231
+ const result = await window.__ENTITY_ENGINE_AI_BRIDGE__.executeViewControllerTool(
1232
+ toolName,
1233
+ input2 || {}
1234
+ );
1235
+ const finalResult = typeof result === "string" ? result : JSON.stringify(result, null, 2);
1236
+ await fetch("/api/ee/servlet/ai/frontend-tool-result", {
1237
+ method: "POST",
1238
+ headers: {
1239
+ "Content-Type": "application/json"
1240
+ },
1241
+ body: JSON.stringify({
1242
+ waitId: `frontend-${toolName}`,
1243
+ // 简化waitId匹配
1244
+ result: finalResult,
1245
+ timestamp: Date.now()
1246
+ })
1247
+ });
1248
+ }
1249
+ } catch (_error) {
1250
+ await fetch("/api/ee/servlet/ai/frontend-tool-result", {
1251
+ method: "POST",
1252
+ headers: {
1253
+ "Content-Type": "application/json"
1254
+ },
1255
+ body: JSON.stringify({
1256
+ waitId: `frontend-${toolName}`,
1257
+ error: error.message,
1258
+ timestamp: Date.now()
1259
+ })
1260
+ });
1261
+ } finally {
1262
+ setFrontendToolStatus((prev) => ({
1263
+ ...prev,
1264
+ isProcessing: false,
1265
+ currentTool: void 0
1266
+ }));
1267
+ }
1268
+ };
1269
+ window.__FRONTEND_TOOL_HANDLER__ = handleFrontendToolCall;
1270
+ return () => {
1271
+ if (window.__FRONTEND_TOOL_HANDLER__) {
1272
+ delete window.__FRONTEND_TOOL_HANDLER__;
1273
+ }
1274
+ };
1275
+ }, []);
1276
+ const [input, setInput] = _react3.useState.call(void 0, "");
1277
+ const [attachedFiles, setAttachedFiles] = _react3.useState.call(void 0, []);
1278
+ const inputRef = _react3.useRef.call(void 0, null);
1279
+ const fileInputRef = _react3.useRef.call(void 0, null);
1280
+ const messagesEndRef = _react3.useRef.call(void 0, null);
1281
+ _react3.useEffect.call(void 0, () => {
1282
+ if (messagesEndRef.current) {
1283
+ messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
1284
+ }
1285
+ }, [messages, status]);
1286
+ _react3.useEffect.call(void 0, () => {
1287
+ if (open && inputRef.current) {
1288
+ const timer = setTimeout(() => {
1289
+ _optionalChain([inputRef, 'access', _46 => _46.current, 'optionalAccess', _47 => _47.focus, 'call', _48 => _48()]);
1290
+ }, 100);
1291
+ return () => clearTimeout(timer);
1292
+ }
1293
+ return void 0;
1294
+ }, [open]);
1295
+ const handleFormSubmit = _react3.useCallback.call(void 0, (e) => {
1296
+ e.preventDefault();
1297
+ if (!input.trim() && attachedFiles.length === 0) return;
1298
+ if (status === "streaming") return;
1299
+ try {
1300
+ if (attachedFiles.length > 0) {
1301
+ sendMessage({
1302
+ text: input.trim(),
1303
+ files: attachedFiles
1304
+ });
1305
+ } else {
1306
+ sendMessage({
1307
+ text: input.trim()
1308
+ });
1309
+ }
1310
+ setInput("");
1311
+ setAttachedFiles([]);
1312
+ if (fileInputRef.current) {
1313
+ fileInputRef.current.value = "";
1314
+ }
1315
+ } catch (sendError) {
1316
+ console.error("Failed to send message:", sendError);
1317
+ }
1318
+ }, [input, attachedFiles, status, sendMessage]);
1319
+ const handleFileUpload = _react3.useCallback.call(void 0, (e) => {
1320
+ const files = e.target.files;
1321
+ if (!files) return;
1322
+ const newFiles = [];
1323
+ Array.from(files).forEach((file, index) => {
1324
+ if (file.size > maxFileSize) {
1325
+ return;
1326
+ }
1327
+ const isAccepted = acceptedFileTypes.some((type) => {
1328
+ if (type.endsWith("/*")) {
1329
+ return file.type.startsWith(type.slice(0, -1));
1330
+ }
1331
+ return file.type === type;
1332
+ });
1333
+ if (!isAccepted) {
1334
+ return;
1335
+ }
1336
+ const fileUrl = URL.createObjectURL(file);
1337
+ newFiles.push({
1338
+ type: "file",
1339
+ filename: file.name,
1340
+ mediaType: file.type,
1341
+ url: fileUrl
1342
+ });
1343
+ });
1344
+ setAttachedFiles((prev) => [...prev, ...newFiles]);
1345
+ }, [maxFileSize, acceptedFileTypes]);
1346
+ const removeFile = _react3.useCallback.call(void 0, (index) => {
1347
+ setAttachedFiles((prev) => {
1348
+ const newFiles = prev.slice();
1349
+ URL.revokeObjectURL(newFiles[index].url);
1350
+ newFiles.splice(index, 1);
1351
+ return newFiles;
1352
+ });
1353
+ }, []);
1354
+ const handleKeyPress = _react3.useCallback.call(void 0, (e) => {
1355
+ if (e.key === "Enter" && !e.shiftKey) {
1356
+ e.preventDefault();
1357
+ handleFormSubmit(e);
1358
+ }
1359
+ }, [handleFormSubmit]);
1360
+ const isLoading = status === "streaming" || status === "submitted";
1361
+ const canSend = !isLoading && (input.trim() || attachedFiles.length > 0);
1362
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1363
+ _core.Box,
1364
+ {
1365
+ style: {
1366
+ height: "100%",
1367
+ width: "100%",
1368
+ display: "flex",
1369
+ flexDirection: "column",
1370
+ position: "relative",
1371
+ zIndex: "auto",
1372
+ minHeight: 0,
1373
+ overflow: "hidden",
1374
+ background: `
1375
+ radial-gradient(
1376
+ circle at 85% 85%,
1377
+ rgba(34, 139, 230, 0.18) 0%,
1378
+ rgba(34, 139, 230, 0.09) 25%,
1379
+ rgba(34, 139, 230, 0.03) 50%,
1380
+ rgba(255, 255, 255, 1) 75%
1381
+ )
1382
+ `
1383
+ },
1384
+ children: [
1385
+ showHeader && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1386
+ _core.Paper,
1387
+ {
1388
+ p: "lg",
1389
+ bg: "white",
1390
+ radius: 0,
1391
+ style: {
1392
+ position: "sticky",
1393
+ top: 0,
1394
+ zIndex: 100
1395
+ },
1396
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { justify: "space-between", align: "center", style: { width: "100%" }, children: [
1397
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "md", style: { flex: 1 }, children: [
1398
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1399
+ _core.Box,
1400
+ {
1401
+ style: {
1402
+ width: "40px",
1403
+ height: "40px",
1404
+ borderRadius: "8px",
1405
+ display: "flex",
1406
+ alignItems: "center",
1407
+ justifyContent: "center",
1408
+ boxShadow: "0 2px 8px rgba(25, 118, 210, 0.3)"
1409
+ },
1410
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SparklesIcon, { size: 24, color: "#1976d2" })
1411
+ }
1412
+ ),
1413
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1414
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Title, { order: 4, c: "var(--mantine-color-gray-9)", mb: 2, children: title }),
1415
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "xs", align: "center", children: [
1416
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1417
+ _core.Badge,
1418
+ {
1419
+ size: "xs",
1420
+ color: error ? "red" : "green",
1421
+ variant: "light",
1422
+ leftSection: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { w: 6, h: 6, bg: error ? "red" : "green", style: { borderRadius: "50%" } }),
1423
+ children: error ? "Offline" : "Online"
1424
+ }
1425
+ ),
1426
+ description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: description })
1427
+ ] })
1428
+ ] })
1429
+ ] }),
1430
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1431
+ _core.ActionIcon,
1432
+ {
1433
+ variant: "subtle",
1434
+ color: "gray",
1435
+ size: "lg",
1436
+ onClick: () => _optionalChain([onOpenChange, 'optionalCall', _49 => _49(false)]),
1437
+ "aria-label": "\u5173\u95ED\u5BF9\u8BDD\u6846",
1438
+ style: { flexShrink: 0 },
1439
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 18 })
1440
+ }
1441
+ )
1442
+ ] })
1443
+ }
1444
+ ),
1445
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.ScrollArea, { style: { flex: 1 }, p: "xl", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Stack, { gap: "md", maw: "none", w: "100%", children: [
1446
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _framermotion.AnimatePresence, { mode: "popLayout", children: messages.map((message, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1447
+ _framermotion.motion.div,
1448
+ {
1449
+ initial: { opacity: 0, y: 20 },
1450
+ animate: { opacity: 1, y: 0 },
1451
+ exit: { opacity: 0, y: -20 },
1452
+ transition: { duration: 0.3, delay: index * 0.1 },
1453
+ children: messageRenderer ? _react4.default.createElement(messageRenderer, { message }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1454
+ MessageBubble,
1455
+ {
1456
+ message,
1457
+ showAvatar: true,
1458
+ showTimestamp: true,
1459
+ enableReasoning,
1460
+ enableGenerativeUI,
1461
+ showReasoningByDefault
1462
+ }
1463
+ )
1464
+ },
1465
+ message.id
1466
+ )) }),
1467
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1468
+ _framermotion.motion.div,
1469
+ {
1470
+ initial: { opacity: 0 },
1471
+ animate: { opacity: 1 },
1472
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "sm", justify: "space-between", children: [
1473
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "sm", children: [
1474
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "xs", children: [
1475
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { w: 8, h: 8, bg: "gray.4", style: { borderRadius: "50%", animation: "bounce 1s infinite" } }),
1476
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { w: 8, h: 8, bg: "gray.4", style: { borderRadius: "50%", animation: "bounce 1s infinite 0.1s" } }),
1477
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { w: 8, h: 8, bg: "gray.4", style: { borderRadius: "50%", animation: "bounce 1s infinite 0.2s" } })
1478
+ ] }),
1479
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "sm", ...getThemedTextProps("muted"), children: "AI is thinking..." })
1480
+ ] }),
1481
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1482
+ _core.ActionIcon,
1483
+ {
1484
+ variant: "subtle",
1485
+ color: "red",
1486
+ onClick: stop,
1487
+ size: "sm",
1488
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Square, { size: 16 })
1489
+ }
1490
+ )
1491
+ ] })
1492
+ }
1493
+ ),
1494
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: messagesEndRef })
1495
+ ] }) }),
1496
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1497
+ _framermotion.motion.div,
1498
+ {
1499
+ initial: { opacity: 0, height: 0 },
1500
+ animate: { opacity: 1, height: "auto" },
1501
+ style: { margin: "1rem" },
1502
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1503
+ _core.Paper,
1504
+ {
1505
+ p: "md",
1506
+ style: {
1507
+ backgroundColor: componentStyles.status.error.background,
1508
+ borderLeft: `4px solid ${componentStyles.status.error.border}`
1509
+ },
1510
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { align: "flex-start", gap: "sm", children: [
1511
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { size: 20, color: componentStyles.status.error.text }),
1512
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Box, { style: { flex: 1 }, children: [
1513
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "sm", fw: 500, c: componentStyles.status.error.text, children: "Connection Error" }),
1514
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "sm", c: componentStyles.status.error.text, mt: "xs", children: error.message }),
1515
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "sm", mt: "md", children: [
1516
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1517
+ _core.Button,
1518
+ {
1519
+ size: "xs",
1520
+ variant: "light",
1521
+ color: "red",
1522
+ onClick: () => clearError(),
1523
+ children: "Dismiss"
1524
+ }
1525
+ ),
1526
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1527
+ _core.Button,
1528
+ {
1529
+ size: "xs",
1530
+ variant: "light",
1531
+ color: "blue",
1532
+ onClick: () => resumeStream(),
1533
+ children: "Retry Connection"
1534
+ }
1535
+ )
1536
+ ] })
1537
+ ] })
1538
+ ] })
1539
+ }
1540
+ )
1541
+ }
1542
+ ),
1543
+ attachedFiles.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1544
+ _core.Paper,
1545
+ {
1546
+ p: "lg",
1547
+ shadow: "xs",
1548
+ style: {
1549
+ borderTop: "1px solid var(--mantine-color-gray-2)",
1550
+ backgroundColor: "var(--mantine-color-gray-0)"
1551
+ },
1552
+ children: [
1553
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "sm", fw: 500, c: "var(--mantine-color-gray-7)", mb: "md", children: "\u{1F4CE} \u9644\u4EF6\u9884\u89C8" }),
1554
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Group, { gap: "md", wrap: "wrap", children: attachedFiles.map((file, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1555
+ _core.Paper,
1556
+ {
1557
+ p: "sm",
1558
+ shadow: "xs",
1559
+ withBorder: true,
1560
+ style: {
1561
+ maxWidth: "280px",
1562
+ backgroundColor: "white",
1563
+ position: "relative"
1564
+ },
1565
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "sm", align: "center", children: [
1566
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1567
+ _core.Box,
1568
+ {
1569
+ w: 32,
1570
+ h: 32,
1571
+ bg: "var(--mantine-color-blue-light)",
1572
+ style: {
1573
+ borderRadius: "6px",
1574
+ display: "flex",
1575
+ alignItems: "center",
1576
+ justifyContent: "center"
1577
+ },
1578
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Paperclip, { size: 16, color: "var(--mantine-color-blue-6)" })
1579
+ }
1580
+ ),
1581
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Box, { style: { flex: 1, minWidth: 0 }, children: [
1582
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "sm", fw: 500, truncate: true, c: "var(--mantine-color-gray-8)", children: file.filename }),
1583
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: file.mediaType })
1584
+ ] }),
1585
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1586
+ _core.ActionIcon,
1587
+ {
1588
+ variant: "subtle",
1589
+ color: "red",
1590
+ size: "sm",
1591
+ onClick: () => removeFile(index),
1592
+ style: { flexShrink: 0 },
1593
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 14 })
1594
+ }
1595
+ )
1596
+ ] })
1597
+ },
1598
+ `${file.filename}-${index}`
1599
+ )) })
1600
+ ]
1601
+ }
1602
+ ),
1603
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1604
+ _core.Paper,
1605
+ {
1606
+ p: "lg",
1607
+ shadow: "md",
1608
+ style: {
1609
+ borderTop: "1px solid var(--mantine-color-gray-2)",
1610
+ backgroundColor: "white",
1611
+ position: "sticky",
1612
+ bottom: 0,
1613
+ zIndex: 50
1614
+ },
1615
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleFormSubmit, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Stack, { gap: "sm", children: [
1616
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { align: "center", gap: "md", children: [
1617
+ allowFileUpload && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Box, { children: [
1618
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1619
+ "input",
1620
+ {
1621
+ ref: fileInputRef,
1622
+ type: "file",
1623
+ multiple: true,
1624
+ accept: acceptedFileTypes.join(","),
1625
+ onChange: handleFileUpload,
1626
+ style: { display: "none" }
1627
+ }
1628
+ ),
1629
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1630
+ _core.ActionIcon,
1631
+ {
1632
+ variant: "light",
1633
+ color: "gray",
1634
+ size: "lg",
1635
+ onClick: () => _optionalChain([fileInputRef, 'access', _50 => _50.current, 'optionalAccess', _51 => _51.click, 'call', _52 => _52()]),
1636
+ disabled: isLoading,
1637
+ style: {
1638
+ border: "2px solid var(--mantine-color-gray-3)",
1639
+ backgroundColor: "var(--mantine-color-gray-0)",
1640
+ transition: "all 0.2s ease"
1641
+ },
1642
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Paperclip, { size: 20 })
1643
+ }
1644
+ )
1645
+ ] }),
1646
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { style: { flex: 1 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1647
+ _core.Textarea,
1648
+ {
1649
+ ref: inputRef,
1650
+ value: input,
1651
+ onChange: (e) => setInput(e.target.value),
1652
+ onKeyDown: handleKeyPress,
1653
+ placeholder,
1654
+ disabled: isLoading,
1655
+ minRows: 1,
1656
+ maxRows: 4,
1657
+ autosize: true,
1658
+ variant: "filled",
1659
+ styles: {
1660
+ input: {
1661
+ backgroundColor: "var(--mantine-color-gray-0)",
1662
+ border: "2px solid var(--mantine-color-gray-2)",
1663
+ borderRadius: "12px",
1664
+ padding: "12px 16px",
1665
+ fontSize: "14px",
1666
+ lineHeight: "1.4",
1667
+ transition: "all 0.2s ease",
1668
+ "&:focus": {
1669
+ backgroundColor: "white",
1670
+ borderColor: "var(--mantine-color-blue-4)",
1671
+ boxShadow: "0 0 0 3px var(--mantine-color-blue-1)"
1672
+ },
1673
+ "&::placeholder": {
1674
+ color: "var(--mantine-color-gray-5)"
1675
+ }
1676
+ }
1677
+ }
1678
+ }
1679
+ ) }),
1680
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1681
+ _core.ActionIcon,
1682
+ {
1683
+ type: "submit",
1684
+ disabled: !canSend,
1685
+ size: "lg",
1686
+ variant: "filled",
1687
+ style: {
1688
+ background: canSend ? "linear-gradient(45deg, var(--mantine-color-blue-6), var(--mantine-color-blue-5))" : "var(--mantine-color-gray-4)",
1689
+ color: "white",
1690
+ border: "none",
1691
+ borderRadius: "12px",
1692
+ boxShadow: canSend ? "0 4px 12px var(--mantine-color-blue-2)" : "none",
1693
+ transform: canSend ? "scale(1)" : "scale(0.95)",
1694
+ transition: "all 0.2s ease",
1695
+ cursor: canSend ? "pointer" : "not-allowed",
1696
+ "&:hover": canSend ? {
1697
+ transform: "scale(1.05)",
1698
+ boxShadow: "0 6px 16px var(--mantine-color-blue-3)"
1699
+ } : {}
1700
+ },
1701
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Send, { size: 20 })
1702
+ }
1703
+ )
1704
+ ] }),
1705
+ input.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { justify: "space-between", align: "center", children: [
1706
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-6)", children: isLoading ? "AI\u6B63\u5728\u56DE\u590D..." : "Enter\u53D1\u9001\uFF0CShift+Enter\u6362\u884C" }),
1707
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { size: "xs", c: "var(--mantine-color-gray-5)", children: [
1708
+ input.length,
1709
+ "/2000"
1710
+ ] })
1711
+ ] })
1712
+ ] }) })
1713
+ }
1714
+ )
1715
+ ]
1716
+ }
1717
+ );
1718
+ }
1719
+ var init_ChatDialog = __esm({
1720
+ "src/components/ChatDialog/ChatDialog.tsx"() {
1721
+ "use strict";
1722
+ init_useChat();
1723
+ init_MessageBubble();
1724
+ init_theme();
1725
+ }
1726
+ });
1727
+
1728
+ // src/components/FileViewer/FileViewer.tsx
1729
+
1730
+
1731
+
1732
+
1733
+
1734
+
1735
+
1736
+
1737
+
1738
+
1739
+
1740
+
1741
+
1742
+
1743
+
1744
+
1745
+ function FileViewer({
1746
+ file,
1747
+ showDownload = false,
1748
+ showRemove = false,
1749
+ onRemove,
1750
+ className
1751
+ }) {
1752
+ const [isPreviewOpen, setIsPreviewOpen] = _react3.useState.call(void 0, false);
1753
+ const [imageLoadError, setImageLoadError] = _react3.useState.call(void 0, false);
1754
+ const [isLoading, setIsLoading] = _react3.useState.call(void 0, false);
1755
+ const fileInfo = _react3.useMemo.call(void 0, () => {
1756
+ const extension = _optionalChain([file, 'access', _53 => _53.filename, 'optionalAccess', _54 => _54.split, 'call', _55 => _55("."), 'access', _56 => _56.pop, 'call', _57 => _57(), 'optionalAccess', _58 => _58.toLowerCase, 'call', _59 => _59()]) || "";
1757
+ const mediaType = file.mediaType || "";
1758
+ let category = "document";
1759
+ let icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.File, { className: "w-5 h-5" });
1760
+ let color = "text-gray-600 dark:text-gray-400";
1761
+ let bgColor = "bg-gray-100 dark:bg-gray-800";
1762
+ if (mediaType.startsWith("image/")) {
1763
+ category = "image";
1764
+ icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Image, { className: "w-5 h-5" });
1765
+ color = "text-blue-600 dark:text-blue-400";
1766
+ bgColor = "bg-blue-50 dark:bg-blue-900/20";
1767
+ } else if (mediaType.startsWith("text/") || ["txt", "md", "json", "xml", "csv"].includes(extension)) {
1768
+ category = "text";
1769
+ icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.FileText, { className: "w-5 h-5" });
1770
+ color = "text-green-600 dark:text-green-400";
1771
+ bgColor = "bg-green-50 dark:bg-green-900/20";
1772
+ } else if (["js", "ts", "jsx", "tsx", "py", "java", "cpp", "c", "html", "css", "php"].includes(extension)) {
1773
+ category = "code";
1774
+ icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Code, { className: "w-5 h-5" });
1775
+ color = "text-purple-600 dark:text-purple-400";
1776
+ bgColor = "bg-purple-50 dark:bg-purple-900/20";
1777
+ } else if (mediaType.startsWith("audio/")) {
1778
+ category = "audio";
1779
+ icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Music, { className: "w-5 h-5" });
1780
+ color = "text-pink-600 dark:text-pink-400";
1781
+ bgColor = "bg-pink-50 dark:bg-pink-900/20";
1782
+ } else if (mediaType.startsWith("video/")) {
1783
+ category = "video";
1784
+ icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Video, { className: "w-5 h-5" });
1785
+ color = "text-red-600 dark:text-red-400";
1786
+ bgColor = "bg-red-50 dark:bg-red-900/20";
1787
+ } else if (["zip", "rar", "7z", "tar", "gz"].includes(extension)) {
1788
+ category = "archive";
1789
+ icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "w-5 h-5" });
1790
+ color = "text-orange-600 dark:text-orange-400";
1791
+ bgColor = "bg-orange-50 dark:bg-orange-900/20";
1792
+ }
1793
+ return {
1794
+ extension,
1795
+ category,
1796
+ icon,
1797
+ color,
1798
+ bgColor,
1799
+ canPreview: ["image", "text"].includes(category),
1800
+ size: formatFileSize2(getFileSizeFromUrl(file.url))
1801
+ };
1802
+ }, [file]);
1803
+ function formatFileSize2(bytes) {
1804
+ if (bytes === 0) return "0 B";
1805
+ const k = 1024;
1806
+ const sizes = ["B", "KB", "MB", "GB"];
1807
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1808
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
1809
+ }
1810
+ function getFileSizeFromUrl(url) {
1811
+ return 0;
1812
+ }
1813
+ const handleDownload = async () => {
1814
+ try {
1815
+ setIsLoading(true);
1816
+ const response = await fetch(file.url);
1817
+ if (!response.ok) throw new Error("Download failed");
1818
+ const blob = await response.blob();
1819
+ const downloadUrl = URL.createObjectURL(blob);
1820
+ const a = document.createElement("a");
1821
+ a.href = downloadUrl;
1822
+ a.download = file.filename || "download";
1823
+ document.body.appendChild(a);
1824
+ a.click();
1825
+ document.body.removeChild(a);
1826
+ URL.revokeObjectURL(downloadUrl);
1827
+ } catch (e2) {
1828
+ } finally {
1829
+ setIsLoading(false);
1830
+ }
1831
+ };
1832
+ const handleRemove = () => {
1833
+ if (onRemove) {
1834
+ onRemove(file);
1835
+ }
1836
+ };
1837
+ const renderPreviewContent = () => {
1838
+ if (fileInfo.category === "image") {
1839
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { style: { display: "flex", alignItems: "center", justifyContent: "center", maxHeight: "24rem" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1840
+ _core.Image,
1841
+ {
1842
+ src: file.url,
1843
+ alt: file.filename,
1844
+ style: { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" },
1845
+ radius: "md",
1846
+ onError: () => setImageLoadError(true)
1847
+ }
1848
+ ) });
1849
+ }
1850
+ if (fileInfo.category === "text") {
1851
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { style: { maxHeight: "24rem", overflow: "auto" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1852
+ "iframe",
1853
+ {
1854
+ src: file.url,
1855
+ style: {
1856
+ width: "100%",
1857
+ height: "20rem",
1858
+ border: `1px solid ${componentStyles.fileViewer.border}`,
1859
+ borderRadius: "0.5rem"
1860
+ },
1861
+ title: file.filename
1862
+ }
1863
+ ) });
1864
+ }
1865
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Stack, { align: "center", justify: "center", style: { padding: "2rem" }, children: [
1866
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertTriangle, { size: 48, color: componentStyles.text.muted }),
1867
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { ...getThemedTextProps("muted"), children: "Preview not available for this file type" }),
1868
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "sm", ...getThemedTextProps("muted"), children: "Click download to view the file" })
1869
+ ] });
1870
+ };
1871
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1872
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1873
+ _framermotion.motion.div,
1874
+ {
1875
+ initial: { opacity: 0, scale: 0.95 },
1876
+ animate: { opacity: 1, scale: 1 },
1877
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1878
+ _core.Paper,
1879
+ {
1880
+ p: "md",
1881
+ style: {
1882
+ position: "relative",
1883
+ border: `1px solid ${componentStyles.fileViewer.border}`,
1884
+ borderRadius: "0.5rem",
1885
+ backgroundColor: componentStyles.fileViewer.background,
1886
+ boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
1887
+ transition: "box-shadow 0.2s"
1888
+ },
1889
+ children: [
1890
+ showRemove && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1891
+ _core.ActionIcon,
1892
+ {
1893
+ size: "sm",
1894
+ color: "red",
1895
+ variant: "filled",
1896
+ onClick: handleRemove,
1897
+ style: {
1898
+ position: "absolute",
1899
+ top: "0.25rem",
1900
+ right: "0.25rem",
1901
+ opacity: 0.7
1902
+ },
1903
+ title: "Remove file",
1904
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 12 })
1905
+ }
1906
+ ),
1907
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { align: "flex-start", gap: "sm", children: [
1908
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { style: { flexShrink: 0 }, children: fileInfo.category === "image" && !imageLoadError ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1909
+ _core.Box,
1910
+ {
1911
+ w: 48,
1912
+ h: 48,
1913
+ style: {
1914
+ borderRadius: "0.25rem",
1915
+ overflow: "hidden",
1916
+ backgroundColor: componentStyles.codeBackground
1917
+ },
1918
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1919
+ _core.Image,
1920
+ {
1921
+ src: file.url,
1922
+ alt: file.filename,
1923
+ style: { width: "100%", height: "100%", objectFit: "cover" },
1924
+ onError: () => setImageLoadError(true)
1925
+ }
1926
+ )
1927
+ }
1928
+ ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1929
+ _core.Box,
1930
+ {
1931
+ w: 48,
1932
+ h: 48,
1933
+ style: {
1934
+ display: "flex",
1935
+ alignItems: "center",
1936
+ justifyContent: "center"
1937
+ },
1938
+ children: fileInfo.icon
1939
+ }
1940
+ ) }),
1941
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Box, { style: { flex: 1, minWidth: 0 }, children: [
1942
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "sm", fw: 500, ...getThemedTextProps("primary"), truncate: true, children: file.filename }),
1943
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "xs", mt: "xs", children: [
1944
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { size: "xs", variant: "light", color: "gray", children: fileInfo.extension || "Unknown" }),
1945
+ fileInfo.size !== "0 B" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", ...getThemedTextProps("muted"), children: fileInfo.size })
1946
+ ] }),
1947
+ file.mediaType && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Text, { size: "xs", ...getThemedTextProps("muted"), mt: "xs", children: file.mediaType })
1948
+ ] })
1949
+ ] }),
1950
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { justify: "flex-end", gap: "xs", mt: "sm", style: { opacity: 0.7 }, children: [
1951
+ fileInfo.canPreview && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1952
+ _core.Button,
1953
+ {
1954
+ variant: "subtle",
1955
+ size: "xs",
1956
+ onClick: () => setIsPreviewOpen(true),
1957
+ leftSection: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Eye, { size: 12 }),
1958
+ children: "Preview"
1959
+ }
1960
+ ),
1961
+ showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1962
+ _core.Button,
1963
+ {
1964
+ variant: "subtle",
1965
+ size: "xs",
1966
+ onClick: handleDownload,
1967
+ disabled: isLoading,
1968
+ leftSection: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { size: 12 }),
1969
+ children: isLoading ? "Downloading..." : "Download"
1970
+ }
1971
+ )
1972
+ ] })
1973
+ ]
1974
+ }
1975
+ )
1976
+ }
1977
+ ),
1978
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _framermotion.AnimatePresence, { children: isPreviewOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1979
+ _core.Modal,
1980
+ {
1981
+ opened: isPreviewOpen,
1982
+ onClose: () => setIsPreviewOpen(false),
1983
+ size: "xl",
1984
+ styles: {
1985
+ content: { maxHeight: "90vh" },
1986
+ body: { overflow: "auto" }
1987
+ },
1988
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1989
+ _framermotion.motion.div,
1990
+ {
1991
+ initial: { opacity: 0, scale: 0.95 },
1992
+ animate: { opacity: 1, scale: 1 },
1993
+ exit: { opacity: 0, scale: 0.95 },
1994
+ transition: { duration: 0.2 },
1995
+ children: [
1996
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { gap: "sm", mb: "md", children: [
1997
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { children: fileInfo.icon }),
1998
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Title, { order: 3, ...getThemedTextProps("heading"), children: file.filename })
1999
+ ] }),
2000
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Box, { mt: "md", children: renderPreviewContent() }),
2001
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Group, { justify: "flex-end", gap: "sm", mt: "md", pt: "md", style: { borderTop: `1px solid ${componentStyles.fileViewer.border}` }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2002
+ _core.Button,
2003
+ {
2004
+ onClick: handleDownload,
2005
+ disabled: isLoading,
2006
+ leftSection: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { size: 16 }),
2007
+ children: isLoading ? "Downloading..." : "Download"
2008
+ }
2009
+ ) })
2010
+ ]
2011
+ }
2012
+ )
2013
+ }
2014
+ ) })
2015
+ ] });
2016
+ }
2017
+ var init_FileViewer = __esm({
2018
+ "src/components/FileViewer/FileViewer.tsx"() {
2019
+ "use strict";
2020
+ init_theme();
2021
+ }
2022
+ });
2023
+
2024
+ // src/components/index.ts
2025
+ var components_exports = {};
2026
+ __export(components_exports, {
2027
+ ChatDialog: () => ChatDialog,
2028
+ FileViewer: () => FileViewer,
2029
+ MessageBubble: () => MessageBubble
2030
+ });
2031
+ var init_components = __esm({
2032
+ "src/components/index.ts"() {
2033
+ "use strict";
2034
+ init_ChatDialog();
2035
+ init_FileViewer();
2036
+ init_MessageBubble();
2037
+ }
2038
+ });
2039
+
2040
+ // src/ui-index.ts
2041
+ init_hooks();
2042
+ init_components();
2043
+ init_PrebuiltComponents();
2044
+ init_DynamicUI();
2045
+
2046
+
2047
+
2048
+
2049
+
2050
+
2051
+
2052
+
2053
+ var _ai = require('ai');
2054
+
2055
+ // src/utils/index.ts
2056
+ function extractMessageText(message) {
2057
+ return message.parts.filter((part) => part.type === "text").map((part) => part.text).join("\n");
2058
+ }
2059
+ function hasToolCalls(message) {
2060
+ return message.parts.some(
2061
+ (part) => part.type.startsWith("tool-") || part.type === "dynamic-tool"
2062
+ );
2063
+ }
2064
+ function getToolCalls(message) {
2065
+ return message.parts.filter((part) => part.type.startsWith("tool-") || part.type === "dynamic-tool").map((part) => ({
2066
+ toolName: part.type === "dynamic-tool" ? part.toolName : part.type.replace("tool-", ""),
2067
+ state: part.state || "unknown",
2068
+ input: part.input,
2069
+ output: part.output
2070
+ }));
2071
+ }
2072
+ function hasFileAttachments(message) {
2073
+ return message.parts.some((part) => part.type === "file");
2074
+ }
2075
+ function getFileAttachments(message) {
2076
+ return message.parts.filter((part) => part.type === "file").map((part) => part);
2077
+ }
2078
+ function formatTimestamp(timestamp, options) {
2079
+ if (!timestamp) return "";
2080
+ const date = new Date(timestamp);
2081
+ const { format = "short", includeDate = false } = options || {};
2082
+ switch (format) {
2083
+ case "short":
2084
+ return date.toLocaleTimeString([], {
2085
+ hour: "2-digit",
2086
+ minute: "2-digit",
2087
+ ...includeDate && {
2088
+ month: "short",
2089
+ day: "numeric"
2090
+ }
2091
+ });
2092
+ case "long":
2093
+ return date.toLocaleString();
2094
+ case "relative":
2095
+ return formatRelativeTime(timestamp);
2096
+ default:
2097
+ return date.toLocaleTimeString();
2098
+ }
2099
+ }
2100
+ function formatRelativeTime(timestamp) {
2101
+ const now = Date.now();
2102
+ const diff = now - timestamp;
2103
+ const minute = 60 * 1e3;
2104
+ const hour = minute * 60;
2105
+ const day = hour * 24;
2106
+ const week = day * 7;
2107
+ const month = day * 30;
2108
+ const year = day * 365;
2109
+ if (diff < minute) {
2110
+ return "Just now";
2111
+ } else if (diff < hour) {
2112
+ const minutes = Math.floor(diff / minute);
2113
+ return `${minutes}m ago`;
2114
+ } else if (diff < day) {
2115
+ const hours = Math.floor(diff / hour);
2116
+ return `${hours}h ago`;
2117
+ } else if (diff < week) {
2118
+ const days = Math.floor(diff / day);
2119
+ return `${days}d ago`;
2120
+ } else if (diff < month) {
2121
+ const weeks = Math.floor(diff / week);
2122
+ return `${weeks}w ago`;
2123
+ } else if (diff < year) {
2124
+ const months = Math.floor(diff / month);
2125
+ return `${months}mo ago`;
2126
+ } else {
2127
+ const years = Math.floor(diff / year);
2128
+ return `${years}y ago`;
2129
+ }
2130
+ }
2131
+ function formatFileSize(bytes) {
2132
+ if (bytes === 0) return "0 B";
2133
+ const k = 1024;
2134
+ const sizes = ["B", "KB", "MB", "GB", "TB"];
2135
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
2136
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
2137
+ }
2138
+ function getFileExtension(filename) {
2139
+ return _optionalChain([filename, 'access', _60 => _60.split, 'call', _61 => _61("."), 'access', _62 => _62.pop, 'call', _63 => _63(), 'optionalAccess', _64 => _64.toLowerCase, 'call', _65 => _65()]) || "";
2140
+ }
2141
+ function isFileTypeAccepted(file, acceptedTypes) {
2142
+ return acceptedTypes.some((type) => {
2143
+ if (type.endsWith("/*")) {
2144
+ return file.type.startsWith(type.slice(0, -1));
2145
+ }
2146
+ return file.type === type;
2147
+ });
2148
+ }
2149
+ function createFileUrl(file) {
2150
+ return URL.createObjectURL(file);
2151
+ }
2152
+ function revokeFileUrl(url) {
2153
+ URL.revokeObjectURL(url);
2154
+ }
2155
+ function truncateText(text, maxLength) {
2156
+ if (text.length <= maxLength) return text;
2157
+ return text.slice(0, maxLength - 3) + "...";
2158
+ }
2159
+ function highlightSearchTerms(text, searchTerms) {
2160
+ if (!searchTerms.length) return text;
2161
+ let highlightedText = text;
2162
+ searchTerms.forEach((term) => {
2163
+ const regex = new RegExp(`(${term})`, "gi");
2164
+ highlightedText = highlightedText.replace(regex, "<mark>$1</mark>");
2165
+ });
2166
+ return highlightedText;
2167
+ }
2168
+ function camelToSpaced(str) {
2169
+ return str.replace(/([A-Z])/g, " $1").trim();
2170
+ }
2171
+ function isValidUrl(string) {
2172
+ try {
2173
+ new URL(string);
2174
+ return true;
2175
+ } catch (e3) {
2176
+ return false;
2177
+ }
2178
+ }
2179
+ function isValidJson(string) {
2180
+ try {
2181
+ JSON.parse(string);
2182
+ return true;
2183
+ } catch (e4) {
2184
+ return false;
2185
+ }
2186
+ }
2187
+ function safeJsonParse(string, fallback) {
2188
+ try {
2189
+ return JSON.parse(string);
2190
+ } catch (e5) {
2191
+ return fallback;
2192
+ }
2193
+ }
2194
+ function cn(...classes) {
2195
+ return classes.filter(Boolean).join(" ");
2196
+ }
2197
+ async function safeAsync(fn, fallback) {
2198
+ try {
2199
+ const data = await fn();
2200
+ return { data };
2201
+ } catch (error) {
2202
+ return {
2203
+ error: error instanceof Error ? error : new Error(String(error)),
2204
+ ...fallback !== void 0 && { data: fallback }
2205
+ };
2206
+ }
2207
+ }
2208
+ function createErrorMessage(error) {
2209
+ if (error instanceof Error) {
2210
+ return error.message;
2211
+ }
2212
+ if (typeof error === "string") {
2213
+ return error;
2214
+ }
2215
+ return "An unknown error occurred";
2216
+ }
2217
+ function debounce(func, delay) {
2218
+ let timeoutId;
2219
+ return function debouncedFunction(...args) {
2220
+ clearTimeout(timeoutId);
2221
+ timeoutId = setTimeout(() => func.apply(this, args), delay);
2222
+ };
2223
+ }
2224
+ function throttle(func, delay) {
2225
+ let inThrottle;
2226
+ return function throttledFunction(...args) {
2227
+ if (!inThrottle) {
2228
+ func.apply(this, args);
2229
+ inThrottle = true;
2230
+ setTimeout(() => inThrottle = false, delay);
2231
+ }
2232
+ };
2233
+ }
2234
+ var storage = {
2235
+ get(key, fallback) {
2236
+ if (typeof window === "undefined") return fallback || null;
2237
+ try {
2238
+ const item = localStorage.getItem(key);
2239
+ return item ? JSON.parse(item) : fallback || null;
2240
+ } catch (e6) {
2241
+ return fallback || null;
2242
+ }
2243
+ },
2244
+ set(key, value) {
2245
+ if (typeof window === "undefined") return false;
2246
+ try {
2247
+ localStorage.setItem(key, JSON.stringify(value));
2248
+ return true;
2249
+ } catch (e7) {
2250
+ return false;
2251
+ }
2252
+ },
2253
+ remove(key) {
2254
+ if (typeof window === "undefined") return false;
2255
+ try {
2256
+ localStorage.removeItem(key);
2257
+ return true;
2258
+ } catch (e8) {
2259
+ return false;
2260
+ }
2261
+ },
2262
+ clear() {
2263
+ if (typeof window === "undefined") return false;
2264
+ try {
2265
+ localStorage.clear();
2266
+ return true;
2267
+ } catch (e9) {
2268
+ return false;
2269
+ }
2270
+ }
2271
+ };
2272
+
2273
+ // src/ui-index.ts
2274
+ var version = "1.0.0";
2275
+ var packageName = "entity-engine-aiui";
2276
+ var EntityEngineAIUI = {
2277
+ // Hooks - imported dynamically to avoid server-side issues
2278
+ get useChat() {
2279
+ return (init_hooks(), __toCommonJS(hooks_exports)).useChat;
2280
+ },
2281
+ get useCompletion() {
2282
+ return (init_hooks(), __toCommonJS(hooks_exports)).useCompletion;
2283
+ },
2284
+ get useObject() {
2285
+ return (init_hooks(), __toCommonJS(hooks_exports)).useObject;
2286
+ },
2287
+ // Components - imported dynamically to avoid server-side React imports
2288
+ get ChatDialog() {
2289
+ return (init_components(), __toCommonJS(components_exports)).ChatDialog;
2290
+ },
2291
+ get MessageBubble() {
2292
+ return (init_components(), __toCommonJS(components_exports)).MessageBubble;
2293
+ },
2294
+ get FileViewer() {
2295
+ return (init_components(), __toCommonJS(components_exports)).FileViewer;
2296
+ },
2297
+ // Version info
2298
+ version,
2299
+ packageName
2300
+ };
2301
+ var ui_index_default = EntityEngineAIUI;
2302
+
2303
+
2304
+
2305
+
2306
+
2307
+
2308
+
2309
+
2310
+
2311
+
2312
+
2313
+
2314
+
2315
+
2316
+
2317
+
2318
+
2319
+
2320
+
2321
+
2322
+
2323
+
2324
+
2325
+
2326
+
2327
+
2328
+
2329
+
2330
+
2331
+
2332
+
2333
+
2334
+
2335
+
2336
+
2337
+
2338
+
2339
+
2340
+
2341
+
2342
+
2343
+
2344
+
2345
+
2346
+
2347
+
2348
+
2349
+
2350
+
2351
+
2352
+
2353
+ exports.ChatDialog = ChatDialog; exports.CodeExecutionComponent = CodeExecutionComponent; exports.DefaultChatTransport = _ai.DefaultChatTransport; exports.DynamicEntityDashboardComponent = DynamicEntityDashboardComponent; exports.DynamicEntityFormComponent = DynamicEntityFormComponent; exports.DynamicEntityGridComponent = DynamicEntityGridComponent; exports.DynamicEntityKanbanComponent = DynamicEntityKanbanComponent; exports.DynamicEntityMastailComponent = DynamicEntityMastailComponent; exports.DynamicToolRenderer = DynamicToolRenderer; exports.ENTITY_DYNAMIC_COMPONENTS = ENTITY_DYNAMIC_COMPONENTS; exports.FileViewer = FileViewer; exports.LocationComponent = LocationComponent; exports.MessageBubble = MessageBubble; exports.TextStreamChatTransport = _ai.TextStreamChatTransport; exports.WeatherComponent = WeatherComponent; exports.camelToSpaced = camelToSpaced; exports.cn = cn; exports.convertToModelMessages = _ai.convertToModelMessages; exports.createErrorMessage = createErrorMessage; exports.createFileUrl = createFileUrl; exports.createUIMessageStream = _ai.createUIMessageStream; exports.createUIMessageStreamResponse = _ai.createUIMessageStreamResponse; exports.debounce = debounce; exports.default = ui_index_default; exports.extractMessageText = extractMessageText; exports.formatFileSize = formatFileSize; exports.formatRelativeTime = formatRelativeTime; exports.formatTimestamp = formatTimestamp; exports.getFileAttachments = getFileAttachments; exports.getFileExtension = getFileExtension; exports.getToolCalls = getToolCalls; exports.hasFileAttachments = hasFileAttachments; exports.hasToolCalls = hasToolCalls; exports.highlightSearchTerms = highlightSearchTerms; exports.isFileTypeAccepted = isFileTypeAccepted; exports.isValidJson = isValidJson; exports.isValidUrl = isValidUrl; exports.lastAssistantMessageIsCompleteWithToolCalls = _ai.lastAssistantMessageIsCompleteWithToolCalls; exports.packageName = packageName; exports.readUIMessageStream = _ai.readUIMessageStream; exports.revokeFileUrl = revokeFileUrl; exports.safeAsync = safeAsync; exports.safeJsonParse = safeJsonParse; exports.storage = storage; exports.throttle = throttle; exports.truncateText = truncateText; exports.useChat = useChat; exports.useCompletion = useCompletion; exports.useObject = useObject; exports.version = version;
2354
+ //# sourceMappingURL=ui-index.js.map