🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { ActionIcon } from '@lobehub/ui';
import { LayoutPanelTop, LogsIcon, LucideBug, LucideBugOff, Trash2 } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { usePermission } from '@/hooks/usePermission';
import { useConversationStore } from '../../../../store';
import Settings from './Settings';
interface ActionsProps {
assistantMessageId: string;
canToggleCustomToolRender?: boolean;
identifier: string;
setShowCustomToolRender?: (show: boolean) => void;
setShowDebug?: (show: boolean) => void;
showCustomToolRender?: boolean;
showDebug?: boolean;
/** When set, trash removes only this tool from the message instead of deleting the assistant message */
toolRemoval?: { messageId: string; toolCallId: string };
}
const Actions = memo<ActionsProps>(
({
assistantMessageId,
canToggleCustomToolRender,
identifier,
setShowCustomToolRender,
setShowDebug,
showCustomToolRender,
showDebug,
toolRemoval,
}) => {
const { t } = useTranslation('plugin');
const { allowed: canEdit } = usePermission('edit_own_content');
const [deleteAssistantMessage, removeToolFromMessage] = useConversationStore((s) => [
s.deleteAssistantMessage,
s.removeToolFromMessage,
]);
return (
<>
{canToggleCustomToolRender && (
<ActionIcon
icon={showCustomToolRender ? LogsIcon : LayoutPanelTop}
size={'small'}
title={showCustomToolRender ? t('inspector.args') : t('inspector.pluginRender')}
onClick={() => {
setShowCustomToolRender?.(!showCustomToolRender);
}}
/>
)}
<ActionIcon
active={showDebug}
icon={showDebug ? LucideBugOff : LucideBug}
size={'small'}
title={t(showDebug ? 'debug.off' : 'debug.on')}
onClick={() => setShowDebug?.(!showDebug)}
/>
{canEdit && (
<>
<Settings id={identifier} />
<ActionIcon
danger
icon={Trash2}
size={'small'}
title={t('inspector.delete')}
onClick={() => {
if (toolRemoval) {
void removeToolFromMessage(toolRemoval.messageId, toolRemoval.toolCallId);
} else {
void deleteAssistantMessage(assistantMessageId);
}
}}
/>
</>
)}
</>
);
},
);
Actions.displayName = 'ToolActions';
export default Actions;