@apteva/apteva-kit 0.1.107 → 0.1.108
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.js +100 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3972,6 +3972,30 @@ ${widgetContext}` : widgetContext;
|
|
|
3972
3972
|
}
|
|
3973
3973
|
};
|
|
3974
3974
|
const defaultPlaceholder = mode === "chat" ? "Type a message..." : "Enter your command...";
|
|
3975
|
+
const handleWidgetAction = useCallback2((action) => {
|
|
3976
|
+
onAction?.(action);
|
|
3977
|
+
if (action.type === "submit" && action.payload?.formData) {
|
|
3978
|
+
const formData = action.payload.formData;
|
|
3979
|
+
const lines = [];
|
|
3980
|
+
for (const [key, value] of Object.entries(formData)) {
|
|
3981
|
+
if (Array.isArray(value) && value.length > 0 && value[0] instanceof File) {
|
|
3982
|
+
const fileNames = value.map((f) => f.name).join(", ");
|
|
3983
|
+
lines.push(`${key}: ${fileNames}`);
|
|
3984
|
+
} else if (value !== "" && value !== false && value != null) {
|
|
3985
|
+
lines.push(`${key}: ${value}`);
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
if (lines.length > 0 && handleSendMessageRef.current) {
|
|
3989
|
+
const files = [];
|
|
3990
|
+
for (const value of Object.values(formData)) {
|
|
3991
|
+
if (Array.isArray(value) && value.length > 0 && value[0] instanceof File) {
|
|
3992
|
+
files.push(...value);
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
handleSendMessageRef.current(lines.join("\n"), files.length > 0 ? files : void 0);
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
}, [onAction]);
|
|
3975
3999
|
const handleSendMessage = async (text, files, isSystem) => {
|
|
3976
4000
|
const hasFiles = files && files.length > 0;
|
|
3977
4001
|
const attachments = hasFiles ? files.map((f) => ({
|
|
@@ -4474,12 +4498,12 @@ ${planToExecute}`;
|
|
|
4474
4498
|
] })
|
|
4475
4499
|
] }) }),
|
|
4476
4500
|
mode === "chat" && /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
4477
|
-
persistentWidgetList.length > 0 && /* @__PURE__ */ jsx26(PersistentWidgetPanel, { widgets: persistentWidgetList, onAction }),
|
|
4501
|
+
persistentWidgetList.length > 0 && /* @__PURE__ */ jsx26(PersistentWidgetPanel, { widgets: persistentWidgetList, onAction: handleWidgetAction }),
|
|
4478
4502
|
/* @__PURE__ */ jsx26(
|
|
4479
4503
|
MessageList,
|
|
4480
4504
|
{
|
|
4481
4505
|
messages,
|
|
4482
|
-
onAction,
|
|
4506
|
+
onAction: handleWidgetAction,
|
|
4483
4507
|
welcomeTitle,
|
|
4484
4508
|
welcomeSubtitle,
|
|
4485
4509
|
welcomeIcon,
|