Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x | // Libs
import { useCopilotChat } from '@copilotkit/react-core';
// Utils
import { combineClasses } from '@shared/utils';
// Icons
import StopCircleIcon from '@shared/icons/StopCircleIcon';
// Constants
import { CANCEL_ACTION_LABEL } from '@/constants';
const StopGenerate = ({
label = CANCEL_ACTION_LABEL,
className,
}: {
label?: string;
className?: string;
}) => {
const { stopGeneration } = useCopilotChat();
return (
<div className="flex justify-center mb-2">
<button
data-testid="stop-generate"
type="button"
onClick={stopGeneration}
className={combineClasses(
'inline-flex items-center justify-center gap-1 w-full',
'px-3 py-2 mx-5 text-3xs leading-none text-muted-foreground font-medium',
'rounded-md border border-secondary-300 bg-white hover:cursor-pointer dark:text-background dark:bg-gray-800',
className,
)}
>
<StopCircleIcon className="w-4 h-4 dark:text-background" />
<span>{label}</span>
</button>
</div>
);
};
export default StopGenerate;
|