2024-08-06 22:18:07 -04:00
|
|
|
import { memo } from 'react';
|
2024-09-10 10:11:39 -09:00
|
|
|
import { PermissionTypes, Permissions } from 'librechat-data-provider';
|
2024-09-09 16:29:24 -04:00
|
|
|
import HoverCardSettings from '~/components/Nav/SettingsTabs/HoverCardSettings';
|
|
|
|
|
import { useLocalize, useHasAccess } from '~/hooks';
|
2024-08-06 22:18:07 -04:00
|
|
|
import SlashCommandSwitch from './SlashCommandSwitch';
|
|
|
|
|
import PlusCommandSwitch from './PlusCommandSwitch';
|
|
|
|
|
import AtCommandSwitch from './AtCommandSwitch';
|
|
|
|
|
|
|
|
|
|
function Commands() {
|
2024-09-09 16:29:24 -04:00
|
|
|
const localize = useLocalize();
|
|
|
|
|
|
|
|
|
|
const hasAccessToPrompts = useHasAccess({
|
|
|
|
|
permissionType: PermissionTypes.PROMPTS,
|
|
|
|
|
permission: Permissions.USE,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const hasAccessToMultiConvo = useHasAccess({
|
|
|
|
|
permissionType: PermissionTypes.MULTI_CONVO,
|
|
|
|
|
permission: Permissions.USE,
|
|
|
|
|
});
|
|
|
|
|
|
2024-08-06 22:18:07 -04:00
|
|
|
return (
|
2024-09-10 10:11:39 -09:00
|
|
|
<div className="space-y-4 p-1">
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<h3 className="text-lg font-medium text-text-primary">
|
|
|
|
|
{localize('com_nav_chat_commands')}
|
|
|
|
|
</h3>
|
|
|
|
|
<HoverCardSettings side="bottom" text="com_nav_chat_commands_info" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex flex-col gap-3 text-sm text-text-primary">
|
2024-09-22 04:45:50 +02:00
|
|
|
<div className="border-b border-border-light pb-3 last-of-type:border-b-0">
|
2024-09-10 10:11:39 -09:00
|
|
|
<AtCommandSwitch />
|
2024-08-06 22:18:07 -04:00
|
|
|
</div>
|
2024-09-10 10:11:39 -09:00
|
|
|
{hasAccessToMultiConvo === true && (
|
2024-09-22 04:45:50 +02:00
|
|
|
<div className="border-b border-border-light pb-3 last-of-type:border-b-0">
|
2024-09-10 10:11:39 -09:00
|
|
|
<PlusCommandSwitch />
|
2024-09-09 16:29:24 -04:00
|
|
|
</div>
|
2024-09-10 10:11:39 -09:00
|
|
|
)}
|
|
|
|
|
{hasAccessToPrompts === true && (
|
2024-09-22 04:45:50 +02:00
|
|
|
<div className="border-b border-border-light pb-3 last-of-type:border-b-0">
|
2024-09-10 10:11:39 -09:00
|
|
|
<SlashCommandSwitch />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2024-08-06 22:18:07 -04:00
|
|
|
</div>
|
2024-09-10 10:11:39 -09:00
|
|
|
</div>
|
2024-08-06 22:18:07 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default memo(Commands);
|