@ant-design/pro-chat
Version:
a solution for ai chat
30 lines • 1.18 kB
JavaScript
var useCustomChatListAction = function useCustomChatListAction(_ref) {
var _actionsProps$moreAct, _actionsProps$actions;
var dropdownMenu = _ref.dropdownMenu,
items = _ref.items,
actionsProps = _ref.actionsProps;
if (!actionsProps) {
// 没有自定义内容的时候使用默认
return {
dropdownMenu: dropdownMenu,
items: items
};
}
return {
dropdownMenu: (actionsProps === null || actionsProps === void 0 || (_actionsProps$moreAct = actionsProps.moreActions) === null || _actionsProps$moreAct === void 0 ? void 0 : _actionsProps$moreAct.map(function (item) {
return dropdownMenu.find(function (i) {
return i.key === item;
});
}).filter(function (v) {
return !!v;
})) || [],
items: (actionsProps === null || actionsProps === void 0 || (_actionsProps$actions = actionsProps.actions) === null || _actionsProps$actions === void 0 ? void 0 : _actionsProps$actions.map(function (item) {
return items.find(function (i) {
return i.key === item;
});
}).filter(function (v) {
return !!v && v.key !== 'divider';
})) || []
};
};
export default useCustomChatListAction;