Skip to content

armgit / Edge0

Public Imported from GitHub
0

Run 35B MoE models in ~2.5 GB of RAM. Weights stream from SSD; a trained router predicts loads a step ahead. Mac, iPhone, Android, Windows supported

Python
1.1 KB
Raw Blame
import { useState } from "react";
import { useTranslation } from "react-i18next";

import { GEN_TEMPERATURE, setGen, storedGen, type GenPreset } from "../../lib/generation";

const PRESETS: GenPreset[] = ["precise", "balanced", "creative"];

export function GenPill() {
  const { t } = useTranslation();
  const [gen, setGenState] = useState<GenPreset>(() => storedGen());
  return (
    <div
      className="flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-surface2 px-1 py-0.5"
      data-testid="gen-pill"
      title={t("gen.hint")}
    >
      {PRESETS.map((p) => (
        <button
          key={p}
          type="button"
          data-testid={`gen-${p}`}
          data-state={gen === p ? "on" : "off"}
          aria-pressed={gen === p}
          onClick={() => {
            setGen(p);
            setGenState(p);
          }}
          className="rounded-full px-2 py-0.5 text-[11px] text-muted transition-colors hover:text-fg data-[state=on]:bg-accent data-[state=on]:text-accentink"
          title={`${t(`gen.${p}`)} - ${GEN_TEMPERATURE[p]}`}
        >
          {t(`gen.${p}`)}
        </button>
      ))}
    </div>
  );
}