@ash-cloud/ash-ui 0.0.4 → 0.0.5
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.cjs +33 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js +33 -2
- package/dist/index.js.map +1 -1
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +87 -2
- package/dist/types.d.ts +87 -2
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.cts +1 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1742,6 +1742,9 @@ function isToolCallEntry(entry) {
|
|
|
1742
1742
|
function isErrorEntry(entry) {
|
|
1743
1743
|
return entry.type === "error";
|
|
1744
1744
|
}
|
|
1745
|
+
function isWidgetEntry(entry) {
|
|
1746
|
+
return entry.type === "widget";
|
|
1747
|
+
}
|
|
1745
1748
|
var DEFAULT_DISPLAY_CONFIG = {
|
|
1746
1749
|
mode: "inline",
|
|
1747
1750
|
breakEveryNToolCalls: 0,
|
|
@@ -1797,10 +1800,25 @@ function MessageList({
|
|
|
1797
1800
|
streamingContent,
|
|
1798
1801
|
displayConfig: displayConfigProp,
|
|
1799
1802
|
onOptionSelect,
|
|
1803
|
+
renderWidget,
|
|
1804
|
+
onWidgetAction,
|
|
1800
1805
|
className
|
|
1801
1806
|
}) {
|
|
1802
1807
|
const contextConfig = useDisplayConfig();
|
|
1803
1808
|
const config = displayConfigProp || contextConfig;
|
|
1809
|
+
const createWidgetActionHandler = react.useCallback(
|
|
1810
|
+
(entryId, widgetType) => {
|
|
1811
|
+
if (!onWidgetAction) return void 0;
|
|
1812
|
+
return (action) => {
|
|
1813
|
+
onWidgetAction({
|
|
1814
|
+
...action,
|
|
1815
|
+
entryId,
|
|
1816
|
+
widgetType
|
|
1817
|
+
});
|
|
1818
|
+
};
|
|
1819
|
+
},
|
|
1820
|
+
[onWidgetAction]
|
|
1821
|
+
);
|
|
1804
1822
|
const groupedEntries = react.useMemo(() => {
|
|
1805
1823
|
if (config.mode === "inline") {
|
|
1806
1824
|
return entries.map((entry) => ({
|
|
@@ -1814,7 +1832,20 @@ function MessageList({
|
|
|
1814
1832
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex-1 overflow-y-auto p-4 space-y-4 ash-scrollbar", className), children: [
|
|
1815
1833
|
groupedEntries.map((groupedEntry) => {
|
|
1816
1834
|
if (groupedEntry.type === "single") {
|
|
1817
|
-
|
|
1835
|
+
const entry = groupedEntry.entry;
|
|
1836
|
+
if (entry.entryType.type === "widget" && renderWidget) {
|
|
1837
|
+
const widgetEntry = entry.entryType;
|
|
1838
|
+
const widgetContent = renderWidget({
|
|
1839
|
+
entry,
|
|
1840
|
+
widgetType: widgetEntry.widgetType,
|
|
1841
|
+
widgetData: widgetEntry.widgetData,
|
|
1842
|
+
onAction: createWidgetActionHandler(entry.id, widgetEntry.widgetType)
|
|
1843
|
+
});
|
|
1844
|
+
if (widgetContent !== null) {
|
|
1845
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ash-animate-fade-in", children: widgetContent }, entry.id);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MessageEntry, { entry, onOptionSelect }, entry.id);
|
|
1818
1849
|
}
|
|
1819
1850
|
const toolCalls = extractToolCallsFromGroup(groupedEntry.entries);
|
|
1820
1851
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
@@ -3036,6 +3067,7 @@ exports.isTodoWriteAction = isTodoWriteAction;
|
|
|
3036
3067
|
exports.isToolCallEntry = isToolCallEntry;
|
|
3037
3068
|
exports.isWebFetchAction = isWebFetchAction;
|
|
3038
3069
|
exports.isWebSearchAction = isWebSearchAction;
|
|
3070
|
+
exports.isWidgetEntry = isWidgetEntry;
|
|
3039
3071
|
exports.keyframes = keyframes;
|
|
3040
3072
|
exports.keyframesCss = keyframesCss;
|
|
3041
3073
|
exports.mapToolToActionType = mapToolToActionType;
|