@apteva/apteva-kit 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +229 -228
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +164 -163
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1062,6 +1062,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
1062
1062
|
const [fileError, setFileError] = _react.useState.call(void 0, null);
|
|
1063
1063
|
const textareaRef = _react.useRef.call(void 0, null);
|
|
1064
1064
|
const fileInputRef = _react.useRef.call(void 0, null);
|
|
1065
|
+
const menuButtonRef = _react.useRef.call(void 0, null);
|
|
1065
1066
|
const handleKeyDown = (e) => {
|
|
1066
1067
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
1067
1068
|
e.preventDefault();
|
|
@@ -1139,39 +1140,6 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
1139
1140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
1140
1141
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: fileError })
|
|
1141
1142
|
] }) }),
|
|
1142
|
-
showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-10", onClick: () => setShowMenu(false) }),
|
|
1144
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "absolute bottom-full left-4 mb-2 bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-20 min-w-[240px]", children: [
|
|
1145
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1146
|
-
"button",
|
|
1147
|
-
{
|
|
1148
|
-
onClick: () => {
|
|
1149
|
-
_optionalChain([fileInputRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.click, 'call', _21 => _21()]);
|
|
1150
|
-
setShowMenu(false);
|
|
1151
|
-
},
|
|
1152
|
-
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
|
|
1153
|
-
children: [
|
|
1154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
|
|
1155
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
|
|
1156
|
-
]
|
|
1157
|
-
}
|
|
1158
|
-
),
|
|
1159
|
-
onSwitchMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1160
|
-
"button",
|
|
1161
|
-
{
|
|
1162
|
-
onClick: () => {
|
|
1163
|
-
onSwitchMode();
|
|
1164
|
-
setShowMenu(false);
|
|
1165
|
-
},
|
|
1166
|
-
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left border-t border-gray-700 dark:border-gray-600",
|
|
1167
|
-
children: [
|
|
1168
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
|
|
1169
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Switch to command mode" })
|
|
1170
|
-
]
|
|
1171
|
-
}
|
|
1172
|
-
)
|
|
1173
|
-
] })
|
|
1174
|
-
] }),
|
|
1175
1143
|
pendingFiles.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1176
1144
|
"div",
|
|
1177
1145
|
{
|
|
@@ -1195,16 +1163,62 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
|
|
|
1195
1163
|
},
|
|
1196
1164
|
index
|
|
1197
1165
|
)) }),
|
|
1198
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative border-2 border-gray-300 dark:border-gray-700
|
|
1199
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1166
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-composer relative border-2 border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 transition-all duration-300 flex items-center px-3 py-2 gap-3", children: [
|
|
1167
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative flex-shrink-0", children: [
|
|
1168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1169
|
+
"button",
|
|
1170
|
+
{
|
|
1171
|
+
ref: menuButtonRef,
|
|
1172
|
+
onClick: () => setShowMenu(!showMenu),
|
|
1173
|
+
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-gray-700 dark:!text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
1174
|
+
title: "More options",
|
|
1175
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1176
|
+
}
|
|
1177
|
+
),
|
|
1178
|
+
showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1179
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
|
|
1180
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1181
|
+
"div",
|
|
1182
|
+
{
|
|
1183
|
+
className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
|
|
1184
|
+
style: {
|
|
1185
|
+
left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.getBoundingClientRect, 'call', _21 => _21(), 'access', _22 => _22.left]), () => ( 0)),
|
|
1186
|
+
top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.getBoundingClientRect, 'call', _25 => _25(), 'access', _26 => _26.bottom]), () => ( 0))) + 8
|
|
1187
|
+
},
|
|
1188
|
+
children: [
|
|
1189
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1190
|
+
"button",
|
|
1191
|
+
{
|
|
1192
|
+
onClick: () => {
|
|
1193
|
+
_optionalChain([fileInputRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.click, 'call', _29 => _29()]);
|
|
1194
|
+
setShowMenu(false);
|
|
1195
|
+
},
|
|
1196
|
+
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
|
|
1197
|
+
children: [
|
|
1198
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
|
|
1199
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
|
|
1200
|
+
]
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
onSwitchMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1204
|
+
"button",
|
|
1205
|
+
{
|
|
1206
|
+
onClick: () => {
|
|
1207
|
+
onSwitchMode();
|
|
1208
|
+
setShowMenu(false);
|
|
1209
|
+
},
|
|
1210
|
+
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left border-t border-gray-700 dark:border-gray-600",
|
|
1211
|
+
children: [
|
|
1212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
|
|
1213
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Switch to command mode" })
|
|
1214
|
+
]
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1217
|
+
]
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] })
|
|
1221
|
+
] }),
|
|
1208
1222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1209
1223
|
"textarea",
|
|
1210
1224
|
{
|
|
@@ -1286,8 +1300,8 @@ function CommandComposer({
|
|
|
1286
1300
|
}
|
|
1287
1301
|
};
|
|
1288
1302
|
const handleNewCommand = () => {
|
|
1289
|
-
_optionalChain([onReset, 'optionalCall',
|
|
1290
|
-
_optionalChain([inputRef, 'access',
|
|
1303
|
+
_optionalChain([onReset, 'optionalCall', _30 => _30()]);
|
|
1304
|
+
_optionalChain([inputRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.focus, 'call', _33 => _33()]);
|
|
1291
1305
|
};
|
|
1292
1306
|
const handleInputChange = (value) => {
|
|
1293
1307
|
setInput(value);
|
|
@@ -1370,76 +1384,11 @@ function CommandComposer({
|
|
|
1370
1384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-3 h-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
1371
1385
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: fileError })
|
|
1372
1386
|
] }) }),
|
|
1373
|
-
showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
|
|
1375
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1376
|
-
"div",
|
|
1377
|
-
{
|
|
1378
|
-
className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
|
|
1379
|
-
style: {
|
|
1380
|
-
bottom: "auto",
|
|
1381
|
-
left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _26 => _26.current, 'optionalAccess', _27 => _27.getBoundingClientRect, 'call', _28 => _28(), 'access', _29 => _29.left]), () => ( 0)),
|
|
1382
|
-
top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _30 => _30.current, 'optionalAccess', _31 => _31.getBoundingClientRect, 'call', _32 => _32(), 'access', _33 => _33.top]), () => ( 0))) - 8,
|
|
1383
|
-
transform: "translateY(-100%)"
|
|
1384
|
-
},
|
|
1385
|
-
children: [
|
|
1386
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1387
|
-
"button",
|
|
1388
|
-
{
|
|
1389
|
-
onClick: () => {
|
|
1390
|
-
_optionalChain([fileInputRef, 'access', _34 => _34.current, 'optionalAccess', _35 => _35.click, 'call', _36 => _36()]);
|
|
1391
|
-
setShowMenu(false);
|
|
1392
|
-
},
|
|
1393
|
-
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
|
|
1394
|
-
children: [
|
|
1395
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
|
|
1396
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
|
|
1397
|
-
]
|
|
1398
|
-
}
|
|
1399
|
-
),
|
|
1400
|
-
onExpand && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1401
|
-
"button",
|
|
1402
|
-
{
|
|
1403
|
-
onClick: () => {
|
|
1404
|
-
onExpand();
|
|
1405
|
-
setShowMenu(false);
|
|
1406
|
-
},
|
|
1407
|
-
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left border-t border-gray-700 dark:border-gray-600",
|
|
1408
|
-
children: [
|
|
1409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
|
|
1410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Expand to chat" })
|
|
1411
|
-
]
|
|
1412
|
-
}
|
|
1413
|
-
)
|
|
1414
|
-
]
|
|
1415
|
-
}
|
|
1416
|
-
)
|
|
1417
|
-
] }),
|
|
1418
|
-
pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-2 flex flex-wrap gap-2", children: pendingFiles.map((pf, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1419
|
-
"div",
|
|
1420
|
-
{
|
|
1421
|
-
className: "relative group flex items-center gap-2 px-2 py-1.5 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg",
|
|
1422
|
-
children: [
|
|
1423
|
-
pf.preview ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover rounded" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-6 h-6 flex items-center justify-center bg-gray-200 dark:bg-gray-700 rounded !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
|
|
1424
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs font-medium !text-gray-700 dark:!text-gray-300 truncate max-w-[100px]", children: pf.file.name }),
|
|
1425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1426
|
-
"button",
|
|
1427
|
-
{
|
|
1428
|
-
onClick: () => removeFile(index),
|
|
1429
|
-
className: "w-4 h-4 bg-gray-500 hover:bg-red-500 text-white rounded-full flex items-center justify-center",
|
|
1430
|
-
title: "Remove file",
|
|
1431
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-2.5 h-2.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1432
|
-
}
|
|
1433
|
-
)
|
|
1434
|
-
]
|
|
1435
|
-
},
|
|
1436
|
-
index
|
|
1437
|
-
)) }),
|
|
1438
1387
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1439
1388
|
"div",
|
|
1440
1389
|
{
|
|
1441
1390
|
className: cn(
|
|
1442
|
-
"flex items-center gap-2 px-3 py-2 border-2
|
|
1391
|
+
"apteva-composer flex items-center gap-2 px-3 py-2 border-2 bg-white dark:bg-gray-900 transition-all duration-200",
|
|
1443
1392
|
state === "idle" && "border-gray-200 dark:border-gray-700",
|
|
1444
1393
|
state === "loading" && "border-blue-400 dark:border-blue-500",
|
|
1445
1394
|
state === "plan-pending" && "border-amber-400 dark:border-amber-500",
|
|
@@ -1447,18 +1396,85 @@ function CommandComposer({
|
|
|
1447
1396
|
state === "error" && "border-red-400 dark:border-red-500"
|
|
1448
1397
|
),
|
|
1449
1398
|
children: [
|
|
1450
|
-
|
|
1451
|
-
"
|
|
1399
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: [
|
|
1400
|
+
state === "idle" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
|
|
1401
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1402
|
+
"button",
|
|
1403
|
+
{
|
|
1404
|
+
ref: menuButtonRef,
|
|
1405
|
+
onClick: () => setShowMenu(!showMenu),
|
|
1406
|
+
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-gray-500 dark:!text-gray-400 hover:!text-gray-700 dark:hover:!text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
1407
|
+
title: "More options",
|
|
1408
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1409
|
+
}
|
|
1410
|
+
),
|
|
1411
|
+
showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1412
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-[9998]", onClick: () => setShowMenu(false) }),
|
|
1413
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1414
|
+
"div",
|
|
1415
|
+
{
|
|
1416
|
+
className: "fixed bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
|
|
1417
|
+
style: {
|
|
1418
|
+
left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _34 => _34.current, 'optionalAccess', _35 => _35.getBoundingClientRect, 'call', _36 => _36(), 'access', _37 => _37.left]), () => ( 0)),
|
|
1419
|
+
top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _38 => _38.current, 'optionalAccess', _39 => _39.getBoundingClientRect, 'call', _40 => _40(), 'access', _41 => _41.bottom]), () => ( 0))) + 8
|
|
1420
|
+
},
|
|
1421
|
+
children: [
|
|
1422
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1423
|
+
"button",
|
|
1424
|
+
{
|
|
1425
|
+
onClick: () => {
|
|
1426
|
+
_optionalChain([fileInputRef, 'access', _42 => _42.current, 'optionalAccess', _43 => _43.click, 'call', _44 => _44()]);
|
|
1427
|
+
setShowMenu(false);
|
|
1428
|
+
},
|
|
1429
|
+
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
|
|
1430
|
+
children: [
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
|
|
1432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
|
|
1433
|
+
]
|
|
1434
|
+
}
|
|
1435
|
+
),
|
|
1436
|
+
onExpand && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1437
|
+
"button",
|
|
1438
|
+
{
|
|
1439
|
+
onClick: () => {
|
|
1440
|
+
onExpand();
|
|
1441
|
+
setShowMenu(false);
|
|
1442
|
+
},
|
|
1443
|
+
className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left border-t border-gray-700 dark:border-gray-600",
|
|
1444
|
+
children: [
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4.5 h-4.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Expand to chat" })
|
|
1447
|
+
]
|
|
1448
|
+
}
|
|
1449
|
+
)
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
)
|
|
1453
|
+
] })
|
|
1454
|
+
] }),
|
|
1455
|
+
state === "loading" && !toolName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin" }),
|
|
1456
|
+
state === "loading" && toolName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-2 h-2 rounded-full bg-blue-500 animate-pulse" })
|
|
1457
|
+
] }),
|
|
1458
|
+
pendingFiles.length > 0 && state === "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1 flex-shrink-0", children: pendingFiles.map((pf, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1459
|
+
"div",
|
|
1452
1460
|
{
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1461
|
+
className: "relative group flex items-center justify-center w-6 h-6 bg-gray-100 dark:bg-gray-800 rounded overflow-hidden",
|
|
1462
|
+
title: pf.file.name,
|
|
1463
|
+
children: [
|
|
1464
|
+
pf.preview ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: pf.preview, alt: pf.file.name, className: "w-6 h-6 object-cover" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs !text-gray-500 dark:!text-gray-400", children: getFileIcon(pf.file.type) }),
|
|
1465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1466
|
+
"button",
|
|
1467
|
+
{
|
|
1468
|
+
onClick: () => removeFile(index),
|
|
1469
|
+
className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity",
|
|
1470
|
+
title: "Remove",
|
|
1471
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1472
|
+
}
|
|
1473
|
+
)
|
|
1474
|
+
]
|
|
1475
|
+
},
|
|
1476
|
+
index
|
|
1477
|
+
)) }),
|
|
1462
1478
|
state === "idle" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1463
1479
|
"textarea",
|
|
1464
1480
|
{
|
|
@@ -1466,7 +1482,7 @@ function CommandComposer({
|
|
|
1466
1482
|
value: input,
|
|
1467
1483
|
onChange: (e) => handleInputChange(e.target.value),
|
|
1468
1484
|
onKeyDown: handleKeyDown,
|
|
1469
|
-
placeholder,
|
|
1485
|
+
placeholder: pendingFiles.length > 0 ? "Add a message..." : placeholder,
|
|
1470
1486
|
disabled,
|
|
1471
1487
|
rows: 1,
|
|
1472
1488
|
className: cn(
|
|
@@ -1494,25 +1510,24 @@ function CommandComposer({
|
|
|
1494
1510
|
] }) : displayContent
|
|
1495
1511
|
}
|
|
1496
1512
|
),
|
|
1497
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
] }),
|
|
1513
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-8 h-8 flex items-center justify-center flex-shrink-0", children: state === "plan-pending" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1", children: [
|
|
1514
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1515
|
+
"button",
|
|
1516
|
+
{
|
|
1517
|
+
onClick: onApprove,
|
|
1518
|
+
className: "px-2 py-1 bg-amber-500 text-white rounded-lg hover:bg-amber-600 transition-colors text-xs font-medium",
|
|
1519
|
+
children: "Approve"
|
|
1520
|
+
}
|
|
1521
|
+
),
|
|
1522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1523
|
+
"button",
|
|
1524
|
+
{
|
|
1525
|
+
onClick: onReject,
|
|
1526
|
+
className: "px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors text-xs font-medium",
|
|
1527
|
+
children: "Modify"
|
|
1528
|
+
}
|
|
1529
|
+
)
|
|
1530
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1516
1531
|
(state === "success" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1517
1532
|
"button",
|
|
1518
1533
|
{
|
|
@@ -1537,32 +1552,10 @@ function CommandComposer({
|
|
|
1537
1552
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 12h14M12 5l7 7-7 7" }) })
|
|
1538
1553
|
}
|
|
1539
1554
|
)
|
|
1540
|
-
] })
|
|
1555
|
+
] }) })
|
|
1541
1556
|
]
|
|
1542
1557
|
}
|
|
1543
1558
|
),
|
|
1544
|
-
state === "success" && _optionalChain([response, 'optionalAccess', _37 => _37.includes, 'call', _38 => _38("weather")]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-3 p-3 bg-gradient-to-r from-blue-50 to-cyan-50 dark:from-blue-900/20 dark:to-cyan-900/20 border border-blue-200 dark:border-blue-800 rounded-xl", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-3", children: [
|
|
1545
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-3xl", children: "\u2600\uFE0F" }),
|
|
1546
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
1547
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm font-medium text-gray-900 dark:text-white", children: "Paris, France" }),
|
|
1548
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Sunny, 22\xB0C" })
|
|
1549
|
-
] }),
|
|
1550
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "px-3 py-1 text-xs bg-blue-500 text-white rounded-lg hover:bg-blue-600", children: "Details" })
|
|
1551
|
-
] }) }),
|
|
1552
|
-
state === "success" && _optionalChain([response, 'optionalAccess', _39 => _39.includes, 'call', _40 => _40("trip")]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl shadow-sm", children: [
|
|
1553
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: "https://images.unsplash.com/photo-1502602898657-3e91760cbb34?w=400&h=150&fit=crop", alt: "Paris", className: "w-full h-24 object-cover rounded-lg mb-2" }),
|
|
1554
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm font-medium text-gray-900 dark:text-white", children: "Paris Weekend Getaway" }),
|
|
1555
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs text-gray-500 dark:text-gray-400 mb-2", children: "3 days \xB7 $850" }),
|
|
1556
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
1557
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "flex-1 px-2 py-1 text-xs bg-blue-500 text-white rounded-lg hover:bg-blue-600", children: "Book" }),
|
|
1558
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "flex-1 px-2 py-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600", children: "Details" })
|
|
1559
|
-
] })
|
|
1560
|
-
] }),
|
|
1561
|
-
state === "success" && _optionalChain([response, 'optionalAccess', _41 => _41.includes, 'call', _42 => _42("task")]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-3 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden", children: ["Review PR #123", "Update documentation", "Fix login bug"].map((task, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex items-center gap-2 px-3 py-2 ${i > 0 ? "border-t border-gray-100 dark:border-gray-800" : ""}`, children: [
|
|
1562
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `w-2 h-2 rounded-full ${i === 0 ? "bg-green-500" : i === 1 ? "bg-yellow-500" : "bg-red-500"}` }),
|
|
1563
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex-1 text-sm text-gray-700 dark:text-gray-300", children: task }),
|
|
1564
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "text-xs text-blue-500 hover:text-blue-600", children: "View" })
|
|
1565
|
-
] }, i)) }),
|
|
1566
1559
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1567
1560
|
"input",
|
|
1568
1561
|
{
|
|
@@ -1662,7 +1655,7 @@ var AptevaClient = class {
|
|
|
1662
1655
|
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
1663
1656
|
throw new Error(error.error || `Request failed with status ${response.status}`);
|
|
1664
1657
|
}
|
|
1665
|
-
const reader = _optionalChain([response, 'access',
|
|
1658
|
+
const reader = _optionalChain([response, 'access', _45 => _45.body, 'optionalAccess', _46 => _46.getReader, 'call', _47 => _47()]);
|
|
1666
1659
|
if (!reader) {
|
|
1667
1660
|
throw new Error("Response body is not readable");
|
|
1668
1661
|
}
|
|
@@ -1680,7 +1673,7 @@ var AptevaClient = class {
|
|
|
1680
1673
|
if (line.startsWith("data: ")) {
|
|
1681
1674
|
const data = line.slice(6);
|
|
1682
1675
|
if (data === "[DONE]") {
|
|
1683
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
1676
|
+
_optionalChain([onComplete, 'optionalCall', _48 => _48(threadId)]);
|
|
1684
1677
|
return;
|
|
1685
1678
|
}
|
|
1686
1679
|
try {
|
|
@@ -1695,10 +1688,10 @@ var AptevaClient = class {
|
|
|
1695
1688
|
}
|
|
1696
1689
|
}
|
|
1697
1690
|
}
|
|
1698
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
1691
|
+
_optionalChain([onComplete, 'optionalCall', _49 => _49(threadId)]);
|
|
1699
1692
|
} catch (error) {
|
|
1700
1693
|
const err = error instanceof Error ? error : new Error("Unknown error");
|
|
1701
|
-
_optionalChain([onError, 'optionalCall',
|
|
1694
|
+
_optionalChain([onError, 'optionalCall', _50 => _50(err)]);
|
|
1702
1695
|
throw err;
|
|
1703
1696
|
}
|
|
1704
1697
|
}
|
|
@@ -1775,6 +1768,7 @@ function Chat({
|
|
|
1775
1768
|
onFileUpload,
|
|
1776
1769
|
onComplete,
|
|
1777
1770
|
onError,
|
|
1771
|
+
onToolResult,
|
|
1778
1772
|
// UI
|
|
1779
1773
|
placeholder,
|
|
1780
1774
|
showHeader = true,
|
|
@@ -1807,7 +1801,7 @@ function Chat({
|
|
|
1807
1801
|
}, [apiUrl, apiKey]);
|
|
1808
1802
|
_react.useEffect.call(void 0, () => {
|
|
1809
1803
|
if (threadId) {
|
|
1810
|
-
_optionalChain([onThreadChange, 'optionalCall',
|
|
1804
|
+
_optionalChain([onThreadChange, 'optionalCall', _51 => _51(threadId)]);
|
|
1811
1805
|
}
|
|
1812
1806
|
}, [threadId, onThreadChange]);
|
|
1813
1807
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1825,7 +1819,7 @@ function Chat({
|
|
|
1825
1819
|
}, [showSettingsMenu]);
|
|
1826
1820
|
const handleModeChange = (newMode) => {
|
|
1827
1821
|
setMode(newMode);
|
|
1828
|
-
_optionalChain([onModeChange, 'optionalCall',
|
|
1822
|
+
_optionalChain([onModeChange, 'optionalCall', _52 => _52(newMode)]);
|
|
1829
1823
|
if (newMode === "command") {
|
|
1830
1824
|
setCommandState("idle");
|
|
1831
1825
|
setCommandResult(null);
|
|
@@ -1845,7 +1839,7 @@ function Chat({
|
|
|
1845
1839
|
metadata: hasFiles ? { attachments: fileNames } : void 0
|
|
1846
1840
|
};
|
|
1847
1841
|
setMessages((prev) => [...prev, userMessage]);
|
|
1848
|
-
_optionalChain([onMessageSent, 'optionalCall',
|
|
1842
|
+
_optionalChain([onMessageSent, 'optionalCall', _53 => _53(userMessage)]);
|
|
1849
1843
|
setIsLoading(true);
|
|
1850
1844
|
try {
|
|
1851
1845
|
const messagePayload = await buildMessageWithAttachments(text, files);
|
|
@@ -1910,7 +1904,7 @@ function Chat({
|
|
|
1910
1904
|
responseThreadId = chunk.thread_id;
|
|
1911
1905
|
if (!currentThreadId) {
|
|
1912
1906
|
setCurrentThreadId(chunk.thread_id);
|
|
1913
|
-
_optionalChain([onThreadChange, 'optionalCall',
|
|
1907
|
+
_optionalChain([onThreadChange, 'optionalCall', _54 => _54(chunk.thread_id)]);
|
|
1914
1908
|
}
|
|
1915
1909
|
}
|
|
1916
1910
|
break;
|
|
@@ -1942,6 +1936,7 @@ function Chat({
|
|
|
1942
1936
|
const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === chunk.tool_id);
|
|
1943
1937
|
if (toolSegment) {
|
|
1944
1938
|
toolSegment.result = chunk.content;
|
|
1939
|
+
_optionalChain([onToolResult, 'optionalCall', _55 => _55(toolSegment.name, chunk.content)]);
|
|
1945
1940
|
}
|
|
1946
1941
|
updateMessage();
|
|
1947
1942
|
}
|
|
@@ -1983,7 +1978,7 @@ function Chat({
|
|
|
1983
1978
|
});
|
|
1984
1979
|
if (threadId2 && threadId2 !== currentThreadId) {
|
|
1985
1980
|
setCurrentThreadId(threadId2);
|
|
1986
|
-
_optionalChain([onThreadChange, 'optionalCall',
|
|
1981
|
+
_optionalChain([onThreadChange, 'optionalCall', _56 => _56(threadId2)]);
|
|
1987
1982
|
}
|
|
1988
1983
|
setIsLoading(false);
|
|
1989
1984
|
},
|
|
@@ -2003,7 +1998,7 @@ function Chat({
|
|
|
2003
1998
|
return [...prev, errorMessage];
|
|
2004
1999
|
});
|
|
2005
2000
|
setIsLoading(false);
|
|
2006
|
-
_optionalChain([onError, 'optionalCall',
|
|
2001
|
+
_optionalChain([onError, 'optionalCall', _57 => _57(error)]);
|
|
2007
2002
|
}
|
|
2008
2003
|
);
|
|
2009
2004
|
}
|
|
@@ -2016,7 +2011,7 @@ function Chat({
|
|
|
2016
2011
|
metadata: { error: true }
|
|
2017
2012
|
};
|
|
2018
2013
|
setMessages((prev) => [...prev, errorMessage]);
|
|
2019
|
-
_optionalChain([onError, 'optionalCall',
|
|
2014
|
+
_optionalChain([onError, 'optionalCall', _58 => _58(error instanceof Error ? error : new Error("Unknown error"))]);
|
|
2020
2015
|
} finally {
|
|
2021
2016
|
setIsLoading(false);
|
|
2022
2017
|
}
|
|
@@ -2061,7 +2056,7 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2061
2056
|
const error = err instanceof Error ? err : new Error("Failed to generate plan");
|
|
2062
2057
|
setCommandError(error);
|
|
2063
2058
|
setCommandState("error");
|
|
2064
|
-
_optionalChain([onError, 'optionalCall',
|
|
2059
|
+
_optionalChain([onError, 'optionalCall', _59 => _59(error)]);
|
|
2065
2060
|
}
|
|
2066
2061
|
}
|
|
2067
2062
|
return;
|
|
@@ -2094,12 +2089,12 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2094
2089
|
setCommandResult(result);
|
|
2095
2090
|
setCommandState("success");
|
|
2096
2091
|
setProgress(100);
|
|
2097
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2092
|
+
_optionalChain([onComplete, 'optionalCall', _60 => _60(result)]);
|
|
2098
2093
|
},
|
|
2099
2094
|
(error) => {
|
|
2100
2095
|
setCommandError(error);
|
|
2101
2096
|
setCommandState("error");
|
|
2102
|
-
_optionalChain([onError, 'optionalCall',
|
|
2097
|
+
_optionalChain([onError, 'optionalCall', _61 => _61(error)]);
|
|
2103
2098
|
}
|
|
2104
2099
|
);
|
|
2105
2100
|
} else {
|
|
@@ -2112,7 +2107,7 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2112
2107
|
setCommandResult(result);
|
|
2113
2108
|
setCommandState("success");
|
|
2114
2109
|
setProgress(100);
|
|
2115
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2110
|
+
_optionalChain([onComplete, 'optionalCall', _62 => _62(result)]);
|
|
2116
2111
|
}
|
|
2117
2112
|
} else {
|
|
2118
2113
|
const commandInstruction = `CRITICAL COMMAND MODE: Maximum 10 words per response. Execute the command immediately. Make reasonable assumptions based on context. Use sensible defaults for missing details. DO NOT ask questions unless something is truly impossible without user input (e.g., missing required password). State what you're doing or the result. Examples: "Analyzing customer data from last quarter..." or "Created 5 new database entries successfully" or "Search complete: found 12 matching results". NO greetings, NO filler words, NO clarification requests. Action/result only.`;
|
|
@@ -2122,6 +2117,7 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2122
2117
|
const messagePayload = files && files.length > 0 ? await buildMessageWithAttachments(currentCommand, files) : currentCommand;
|
|
2123
2118
|
if (enableStreaming) {
|
|
2124
2119
|
let accumulatedContent = "";
|
|
2120
|
+
let lastToolName = "";
|
|
2125
2121
|
await aptevaClient.chatStream(
|
|
2126
2122
|
{
|
|
2127
2123
|
agent_id: agentId,
|
|
@@ -2138,15 +2134,17 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2138
2134
|
const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
|
|
2139
2135
|
setProgress(estimatedProgress);
|
|
2140
2136
|
} else if (chunk.type === "tool_call" && chunk.tool_name) {
|
|
2137
|
+
lastToolName = chunk.tool_name;
|
|
2141
2138
|
setCurrentToolName(chunk.tool_name);
|
|
2142
2139
|
accumulatedContent = "";
|
|
2143
2140
|
setStreamedContent("");
|
|
2144
2141
|
} else if (chunk.type === "tool_result") {
|
|
2142
|
+
_optionalChain([onToolResult, 'optionalCall', _63 => _63(lastToolName, chunk.content)]);
|
|
2145
2143
|
setCurrentToolName(null);
|
|
2146
2144
|
} else if (chunk.type === "thread_id" && chunk.thread_id) {
|
|
2147
2145
|
if (!currentThreadId) {
|
|
2148
2146
|
setCurrentThreadId(chunk.thread_id);
|
|
2149
|
-
_optionalChain([onThreadChange, 'optionalCall',
|
|
2147
|
+
_optionalChain([onThreadChange, 'optionalCall', _64 => _64(chunk.thread_id)]);
|
|
2150
2148
|
}
|
|
2151
2149
|
}
|
|
2152
2150
|
},
|
|
@@ -2159,12 +2157,12 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2159
2157
|
setCommandResult(result);
|
|
2160
2158
|
setCommandState("success");
|
|
2161
2159
|
setProgress(100);
|
|
2162
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2160
|
+
_optionalChain([onComplete, 'optionalCall', _65 => _65(result)]);
|
|
2163
2161
|
},
|
|
2164
2162
|
(error) => {
|
|
2165
2163
|
setCommandError(error);
|
|
2166
2164
|
setCommandState("error");
|
|
2167
|
-
_optionalChain([onError, 'optionalCall',
|
|
2165
|
+
_optionalChain([onError, 'optionalCall', _66 => _66(error)]);
|
|
2168
2166
|
}
|
|
2169
2167
|
);
|
|
2170
2168
|
} else {
|
|
@@ -2184,14 +2182,14 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2184
2182
|
setCommandResult(result);
|
|
2185
2183
|
setCommandState("success");
|
|
2186
2184
|
setProgress(100);
|
|
2187
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2185
|
+
_optionalChain([onComplete, 'optionalCall', _67 => _67(result)]);
|
|
2188
2186
|
}
|
|
2189
2187
|
}
|
|
2190
2188
|
} catch (err) {
|
|
2191
2189
|
const error = err instanceof Error ? err : new Error("Unknown error");
|
|
2192
2190
|
setCommandError(error);
|
|
2193
2191
|
setCommandState("error");
|
|
2194
|
-
_optionalChain([onError, 'optionalCall',
|
|
2192
|
+
_optionalChain([onError, 'optionalCall', _68 => _68(error)]);
|
|
2195
2193
|
}
|
|
2196
2194
|
};
|
|
2197
2195
|
const resetCommand = () => {
|
|
@@ -2257,8 +2255,8 @@ ${planToExecute}`;
|
|
|
2257
2255
|
executeCommand(text, files);
|
|
2258
2256
|
},
|
|
2259
2257
|
state: commandState,
|
|
2260
|
-
response: _optionalChain([commandResult, 'optionalAccess',
|
|
2261
|
-
error: _optionalChain([commandError, 'optionalAccess',
|
|
2258
|
+
response: _optionalChain([commandResult, 'optionalAccess', _69 => _69.data, 'optionalAccess', _70 => _70.summary]) || _optionalChain([commandResult, 'optionalAccess', _71 => _71.message]),
|
|
2259
|
+
error: _optionalChain([commandError, 'optionalAccess', _72 => _72.message]),
|
|
2262
2260
|
plan,
|
|
2263
2261
|
streamedContent,
|
|
2264
2262
|
toolName: currentToolName,
|
|
@@ -2278,6 +2276,9 @@ ${planToExecute}`;
|
|
|
2278
2276
|
.animate-pulse-border {
|
|
2279
2277
|
animation: pulse-border 2s ease-in-out infinite;
|
|
2280
2278
|
}
|
|
2279
|
+
.apteva-composer {
|
|
2280
|
+
border-radius: var(--apteva-border-radius, 1rem) !important;
|
|
2281
|
+
}
|
|
2281
2282
|
`
|
|
2282
2283
|
} })
|
|
2283
2284
|
] });
|
|
@@ -2422,13 +2423,13 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2422
2423
|
const error2 = err instanceof Error ? err : new Error("Failed to generate plan");
|
|
2423
2424
|
setError(error2);
|
|
2424
2425
|
setState("error");
|
|
2425
|
-
_optionalChain([onError, 'optionalCall',
|
|
2426
|
+
_optionalChain([onError, 'optionalCall', _73 => _73(error2)]);
|
|
2426
2427
|
});
|
|
2427
2428
|
} catch (err) {
|
|
2428
2429
|
const error2 = err instanceof Error ? err : new Error("Failed to generate plan");
|
|
2429
2430
|
setError(error2);
|
|
2430
2431
|
setState("error");
|
|
2431
|
-
_optionalChain([onError, 'optionalCall',
|
|
2432
|
+
_optionalChain([onError, 'optionalCall', _74 => _74(error2)]);
|
|
2432
2433
|
}
|
|
2433
2434
|
}
|
|
2434
2435
|
return;
|
|
@@ -2439,7 +2440,7 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2439
2440
|
setStreamedContent("");
|
|
2440
2441
|
setCommand("");
|
|
2441
2442
|
setUploadedFiles([]);
|
|
2442
|
-
_optionalChain([onStart, 'optionalCall',
|
|
2443
|
+
_optionalChain([onStart, 'optionalCall', _75 => _75()]);
|
|
2443
2444
|
try {
|
|
2444
2445
|
if (useMock) {
|
|
2445
2446
|
if (enableStreaming) {
|
|
@@ -2450,16 +2451,16 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2450
2451
|
if (chunk.type === "token" && chunk.content) {
|
|
2451
2452
|
accumulatedContent += chunk.content;
|
|
2452
2453
|
setStreamedContent(accumulatedContent);
|
|
2453
|
-
_optionalChain([onChunk, 'optionalCall',
|
|
2454
|
+
_optionalChain([onChunk, 'optionalCall', _76 => _76(chunk.content)]);
|
|
2454
2455
|
const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
|
|
2455
2456
|
setProgress(estimatedProgress);
|
|
2456
|
-
_optionalChain([onProgress, 'optionalCall',
|
|
2457
|
+
_optionalChain([onProgress, 'optionalCall', _77 => _77(estimatedProgress)]);
|
|
2457
2458
|
} else if (chunk.type === "widget" && chunk.widget) {
|
|
2458
2459
|
const widget = chunk.widget;
|
|
2459
2460
|
setResult((prev) => ({
|
|
2460
2461
|
success: true,
|
|
2461
|
-
data: _optionalChain([prev, 'optionalAccess',
|
|
2462
|
-
widgets: [..._optionalChain([prev, 'optionalAccess',
|
|
2462
|
+
data: _optionalChain([prev, 'optionalAccess', _78 => _78.data]) || {},
|
|
2463
|
+
widgets: [..._optionalChain([prev, 'optionalAccess', _79 => _79.widgets]) || [], widget],
|
|
2463
2464
|
message: accumulatedContent || "Command executed successfully"
|
|
2464
2465
|
}));
|
|
2465
2466
|
}
|
|
@@ -2479,19 +2480,19 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2479
2480
|
setResult(result2);
|
|
2480
2481
|
setState("success");
|
|
2481
2482
|
setProgress(100);
|
|
2482
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2483
|
+
_optionalChain([onComplete, 'optionalCall', _80 => _80(result2)]);
|
|
2483
2484
|
},
|
|
2484
2485
|
(error2) => {
|
|
2485
2486
|
setError(error2);
|
|
2486
2487
|
setState("error");
|
|
2487
|
-
_optionalChain([onError, 'optionalCall',
|
|
2488
|
+
_optionalChain([onError, 'optionalCall', _81 => _81(error2)]);
|
|
2488
2489
|
}
|
|
2489
2490
|
);
|
|
2490
2491
|
} else {
|
|
2491
2492
|
const progressInterval = setInterval(() => {
|
|
2492
2493
|
setProgress((prev) => {
|
|
2493
2494
|
const next = Math.min(prev + 10, 90);
|
|
2494
|
-
_optionalChain([onProgress, 'optionalCall',
|
|
2495
|
+
_optionalChain([onProgress, 'optionalCall', _82 => _82(next)]);
|
|
2495
2496
|
return next;
|
|
2496
2497
|
});
|
|
2497
2498
|
}, 200);
|
|
@@ -2515,7 +2516,7 @@ ${planningInstruction}` : planningInstruction;
|
|
|
2515
2516
|
setResult(result2);
|
|
2516
2517
|
setState("success");
|
|
2517
2518
|
setProgress(100);
|
|
2518
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2519
|
+
_optionalChain([onComplete, 'optionalCall', _83 => _83(result2)]);
|
|
2519
2520
|
}
|
|
2520
2521
|
} else {
|
|
2521
2522
|
if (enableStreaming) {
|
|
@@ -2561,16 +2562,16 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2561
2562
|
if (chunk.type === "token" && chunk.content) {
|
|
2562
2563
|
accumulatedContent += chunk.content;
|
|
2563
2564
|
setStreamedContent(accumulatedContent);
|
|
2564
|
-
_optionalChain([onChunk, 'optionalCall',
|
|
2565
|
+
_optionalChain([onChunk, 'optionalCall', _84 => _84(chunk.content)]);
|
|
2565
2566
|
const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
|
|
2566
2567
|
setProgress(estimatedProgress);
|
|
2567
|
-
_optionalChain([onProgress, 'optionalCall',
|
|
2568
|
+
_optionalChain([onProgress, 'optionalCall', _85 => _85(estimatedProgress)]);
|
|
2568
2569
|
} else if (chunk.type === "widget" && chunk.widget) {
|
|
2569
2570
|
const widget = chunk.widget;
|
|
2570
2571
|
setResult((prev) => ({
|
|
2571
2572
|
success: true,
|
|
2572
|
-
data: _optionalChain([prev, 'optionalAccess',
|
|
2573
|
-
widgets: [..._optionalChain([prev, 'optionalAccess',
|
|
2573
|
+
data: _optionalChain([prev, 'optionalAccess', _86 => _86.data]) || {},
|
|
2574
|
+
widgets: [..._optionalChain([prev, 'optionalAccess', _87 => _87.widgets]) || [], widget],
|
|
2574
2575
|
message: accumulatedContent || "Command executed successfully"
|
|
2575
2576
|
}));
|
|
2576
2577
|
}
|
|
@@ -2590,20 +2591,20 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2590
2591
|
setResult(result2);
|
|
2591
2592
|
setState("success");
|
|
2592
2593
|
setProgress(100);
|
|
2593
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2594
|
+
_optionalChain([onComplete, 'optionalCall', _88 => _88(result2)]);
|
|
2594
2595
|
},
|
|
2595
2596
|
(error2) => {
|
|
2596
2597
|
const err = error2 instanceof Error ? error2 : new Error("Unknown error");
|
|
2597
2598
|
setError(err);
|
|
2598
2599
|
setState("error");
|
|
2599
|
-
_optionalChain([onError, 'optionalCall',
|
|
2600
|
+
_optionalChain([onError, 'optionalCall', _89 => _89(err)]);
|
|
2600
2601
|
}
|
|
2601
2602
|
);
|
|
2602
2603
|
} else {
|
|
2603
2604
|
const progressInterval = setInterval(() => {
|
|
2604
2605
|
setProgress((prev) => {
|
|
2605
2606
|
const next = Math.min(prev + 10, 90);
|
|
2606
|
-
_optionalChain([onProgress, 'optionalCall',
|
|
2607
|
+
_optionalChain([onProgress, 'optionalCall', _90 => _90(next)]);
|
|
2607
2608
|
return next;
|
|
2608
2609
|
});
|
|
2609
2610
|
}, 200);
|
|
@@ -2659,14 +2660,14 @@ ${commandInstruction}` : commandInstruction;
|
|
|
2659
2660
|
setResult(result2);
|
|
2660
2661
|
setState("success");
|
|
2661
2662
|
setProgress(100);
|
|
2662
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
2663
|
+
_optionalChain([onComplete, 'optionalCall', _91 => _91(result2)]);
|
|
2663
2664
|
}
|
|
2664
2665
|
}
|
|
2665
2666
|
} catch (err) {
|
|
2666
2667
|
const error2 = err instanceof Error ? err : new Error("Unknown error");
|
|
2667
2668
|
setError(error2);
|
|
2668
2669
|
setState("error");
|
|
2669
|
-
_optionalChain([onError, 'optionalCall',
|
|
2670
|
+
_optionalChain([onError, 'optionalCall', _92 => _92(error2)]);
|
|
2670
2671
|
}
|
|
2671
2672
|
};
|
|
2672
2673
|
const resetCommand = () => {
|
|
@@ -2699,14 +2700,14 @@ ${planToExecute}`;
|
|
|
2699
2700
|
};
|
|
2700
2701
|
const handleFileSelect = async (e) => {
|
|
2701
2702
|
if (e.target.files && e.target.files.length > 0) {
|
|
2702
|
-
_optionalChain([onFileUpload, 'optionalCall',
|
|
2703
|
+
_optionalChain([onFileUpload, 'optionalCall', _93 => _93(e.target.files)]);
|
|
2703
2704
|
const files = [];
|
|
2704
2705
|
for (let i = 0; i < e.target.files.length; i++) {
|
|
2705
2706
|
const file = e.target.files[i];
|
|
2706
2707
|
const reader = new FileReader();
|
|
2707
2708
|
await new Promise((resolve) => {
|
|
2708
2709
|
reader.onload = (event) => {
|
|
2709
|
-
if (_optionalChain([event, 'access',
|
|
2710
|
+
if (_optionalChain([event, 'access', _94 => _94.target, 'optionalAccess', _95 => _95.result])) {
|
|
2710
2711
|
const fullDataUrl = event.target.result;
|
|
2711
2712
|
const base64Data = fullDataUrl.split(",")[1];
|
|
2712
2713
|
if (file.type.startsWith("image/")) {
|
|
@@ -2800,7 +2801,7 @@ ${planToExecute}`;
|
|
|
2800
2801
|
enableFileUpload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2801
2802
|
"button",
|
|
2802
2803
|
{
|
|
2803
|
-
onClick: () => _optionalChain([fileInputRef, 'access',
|
|
2804
|
+
onClick: () => _optionalChain([fileInputRef, 'access', _96 => _96.current, 'optionalAccess', _97 => _97.click, 'call', _98 => _98()]),
|
|
2804
2805
|
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
2805
2806
|
title: "Attach file",
|
|
2806
2807
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
|
|
@@ -3019,7 +3020,7 @@ ${planToExecute}`;
|
|
|
3019
3020
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-5 h-5 text-red-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
3020
3021
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
3021
3022
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
|
|
3022
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess',
|
|
3023
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _99 => _99.message]) })
|
|
3023
3024
|
] })
|
|
3024
3025
|
] }) }),
|
|
3025
3026
|
allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3047,7 +3048,7 @@ ${planToExecute}`;
|
|
|
3047
3048
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
|
|
3048
3049
|
] })
|
|
3049
3050
|
] }),
|
|
3050
|
-
_optionalChain([result, 'access',
|
|
3051
|
+
_optionalChain([result, 'access', _100 => _100.data, 'optionalAccess', _101 => _101.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
|
|
3051
3052
|
result.widgets && result.widgets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3052
3053
|
WidgetRenderer,
|
|
3053
3054
|
{
|
|
@@ -3098,7 +3099,7 @@ ${planToExecute}`;
|
|
|
3098
3099
|
enableFileUpload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3099
3100
|
"button",
|
|
3100
3101
|
{
|
|
3101
|
-
onClick: () => _optionalChain([fileInputRef, 'access',
|
|
3102
|
+
onClick: () => _optionalChain([fileInputRef, 'access', _102 => _102.current, 'optionalAccess', _103 => _103.click, 'call', _104 => _104()]),
|
|
3102
3103
|
className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
3103
3104
|
title: "Attach file",
|
|
3104
3105
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
|
|
@@ -3284,25 +3285,25 @@ function Prompt({
|
|
|
3284
3285
|
const newValue = e.target.value;
|
|
3285
3286
|
if (!maxLength || newValue.length <= maxLength) {
|
|
3286
3287
|
setValue(newValue);
|
|
3287
|
-
_optionalChain([onChange, 'optionalCall',
|
|
3288
|
+
_optionalChain([onChange, 'optionalCall', _105 => _105(newValue)]);
|
|
3288
3289
|
}
|
|
3289
3290
|
};
|
|
3290
3291
|
const handleSubmit = async () => {
|
|
3291
3292
|
if (value.length < minLength) return;
|
|
3292
|
-
_optionalChain([onSubmit, 'optionalCall',
|
|
3293
|
+
_optionalChain([onSubmit, 'optionalCall', _106 => _106(value)]);
|
|
3293
3294
|
setIsLoading(true);
|
|
3294
3295
|
try {
|
|
3295
3296
|
if (useMock) {
|
|
3296
3297
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
3297
3298
|
const mockResult = `Enhanced version: ${value} [AI-generated content]`;
|
|
3298
|
-
_optionalChain([onResult, 'optionalCall',
|
|
3299
|
+
_optionalChain([onResult, 'optionalCall', _107 => _107(mockResult)]);
|
|
3299
3300
|
setValue("");
|
|
3300
3301
|
} else {
|
|
3301
3302
|
const response = await aptevaClient.chat({
|
|
3302
3303
|
agent_id: agentId,
|
|
3303
3304
|
message: value
|
|
3304
3305
|
});
|
|
3305
|
-
_optionalChain([onResult, 'optionalCall',
|
|
3306
|
+
_optionalChain([onResult, 'optionalCall', _108 => _108(response.message)]);
|
|
3306
3307
|
setValue("");
|
|
3307
3308
|
}
|
|
3308
3309
|
} catch (error) {
|
|
@@ -3397,7 +3398,7 @@ function Stream({
|
|
|
3397
3398
|
}, [autoStart]);
|
|
3398
3399
|
const startStreaming = async () => {
|
|
3399
3400
|
setIsStreaming(true);
|
|
3400
|
-
_optionalChain([onStart, 'optionalCall',
|
|
3401
|
+
_optionalChain([onStart, 'optionalCall', _109 => _109()]);
|
|
3401
3402
|
try {
|
|
3402
3403
|
if (useMock) {
|
|
3403
3404
|
const mockText = "This is a simulated streaming response from the AI agent. In a real implementation, this would stream data from your backend API. The text appears word by word to simulate the streaming effect. You can customize the typing speed and styling based on your needs.";
|
|
@@ -3405,13 +3406,13 @@ function Stream({
|
|
|
3405
3406
|
mockText,
|
|
3406
3407
|
(chunk) => {
|
|
3407
3408
|
setText((prev) => prev + chunk);
|
|
3408
|
-
_optionalChain([onChunk, 'optionalCall',
|
|
3409
|
+
_optionalChain([onChunk, 'optionalCall', _110 => _110(chunk)]);
|
|
3409
3410
|
},
|
|
3410
3411
|
typingSpeed
|
|
3411
3412
|
);
|
|
3412
3413
|
setIsComplete(true);
|
|
3413
3414
|
setIsStreaming(false);
|
|
3414
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
3415
|
+
_optionalChain([onComplete, 'optionalCall', _111 => _111(text + mockText)]);
|
|
3415
3416
|
} else {
|
|
3416
3417
|
let accumulatedText = "";
|
|
3417
3418
|
await aptevaClient.chatStream(
|
|
@@ -3424,24 +3425,24 @@ function Stream({
|
|
|
3424
3425
|
if (chunk.type === "token" && chunk.content) {
|
|
3425
3426
|
accumulatedText += chunk.content;
|
|
3426
3427
|
setText(accumulatedText);
|
|
3427
|
-
_optionalChain([onChunk, 'optionalCall',
|
|
3428
|
+
_optionalChain([onChunk, 'optionalCall', _112 => _112(chunk.content)]);
|
|
3428
3429
|
}
|
|
3429
3430
|
},
|
|
3430
3431
|
() => {
|
|
3431
3432
|
setIsComplete(true);
|
|
3432
3433
|
setIsStreaming(false);
|
|
3433
|
-
_optionalChain([onComplete, 'optionalCall',
|
|
3434
|
+
_optionalChain([onComplete, 'optionalCall', _113 => _113(accumulatedText)]);
|
|
3434
3435
|
},
|
|
3435
3436
|
(error) => {
|
|
3436
3437
|
const err = error instanceof Error ? error : new Error("Streaming error");
|
|
3437
|
-
_optionalChain([onError, 'optionalCall',
|
|
3438
|
+
_optionalChain([onError, 'optionalCall', _114 => _114(err)]);
|
|
3438
3439
|
setIsStreaming(false);
|
|
3439
3440
|
}
|
|
3440
3441
|
);
|
|
3441
3442
|
}
|
|
3442
3443
|
} catch (error) {
|
|
3443
3444
|
const err = error instanceof Error ? error : new Error("Streaming error");
|
|
3444
|
-
_optionalChain([onError, 'optionalCall',
|
|
3445
|
+
_optionalChain([onError, 'optionalCall', _115 => _115(err)]);
|
|
3445
3446
|
setIsStreaming(false);
|
|
3446
3447
|
}
|
|
3447
3448
|
};
|
|
@@ -3533,7 +3534,7 @@ function ThreadList({
|
|
|
3533
3534
|
}) {
|
|
3534
3535
|
const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
|
|
3535
3536
|
const filteredThreads = threads.filter(
|
|
3536
|
-
(thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access',
|
|
3537
|
+
(thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _116 => _116.preview, 'optionalAccess', _117 => _117.toLowerCase, 'call', _118 => _118(), 'access', _119 => _119.includes, 'call', _120 => _120(searchQuery.toLowerCase())])
|
|
3537
3538
|
);
|
|
3538
3539
|
const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
|
|
3539
3540
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col h-full", children: [
|
|
@@ -3555,8 +3556,8 @@ function ThreadList({
|
|
|
3555
3556
|
{
|
|
3556
3557
|
thread,
|
|
3557
3558
|
isActive: thread.id === currentThreadId,
|
|
3558
|
-
onSelect: () => _optionalChain([onThreadSelect, 'optionalCall',
|
|
3559
|
-
onDelete: () => _optionalChain([onThreadDelete, 'optionalCall',
|
|
3559
|
+
onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _121 => _121(thread.id)]),
|
|
3560
|
+
onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _122 => _122(thread.id)])
|
|
3560
3561
|
},
|
|
3561
3562
|
thread.id
|
|
3562
3563
|
))
|
|
@@ -3618,7 +3619,7 @@ function Threads({
|
|
|
3618
3619
|
threads.slice(0, 5).map((thread) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3619
3620
|
"button",
|
|
3620
3621
|
{
|
|
3621
|
-
onClick: () => _optionalChain([onThreadSelect, 'optionalCall',
|
|
3622
|
+
onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _123 => _123(thread.id)]),
|
|
3622
3623
|
className: cn(
|
|
3623
3624
|
"px-4 py-2 whitespace-nowrap font-medium transition-colors",
|
|
3624
3625
|
thread.id === currentThreadId ? "border-b-2 border-apteva-500 text-apteva-500" : "text-gray-600 hover:text-gray-900"
|