Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

1.3 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0

import { Switch } from "@/components/ui/switch";
import { useT } from "@/i18n";

/** File half of a chat delete; every confirmation must offer opting out of file deletion. */
export function DeleteChatFilesSwitch({
  id,
  checked,
  onCheckedChange,
  description,
  label: labelOverride,
}: {
  id: string;
  checked: boolean;
  onCheckedChange: (next: boolean) => void;
  description?: string;
  label?: string;
}) {
  const t = useT();
  const label = labelOverride ?? t("shell.selection.deleteFilesLabel");
  return (
    <div className="flex items-start justify-between gap-4 rounded-lg border border-border/60 bg-muted/35 px-3 py-2.5 dark:border-transparent">
      <label htmlFor={id} className="min-w-0 space-y-1">
        <span className="block text-sm font-medium text-foreground">
          {label}
        </span>
        <span className="block break-words text-xs leading-5 text-muted-foreground">
          {description ?? t("shell.selection.deleteChatFilesDescription")}
        </span>
      </label>
      <Switch
        className="mt-[var(--ui-title-cap-inset)]"
        id={id}
        checked={checked}
        onCheckedChange={onCheckedChange}
        aria-label={label}
      />
    </div>
  );
}