Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Move H3 components to Advanced Options

Bittiedf1cc65fccd
diff --git a/src/components/H3ComponentSettings.test.tsx b/src/components/H3ComponentSettings.test.tsx
index d279231..6bc3440 100644
--- a/src/components/H3ComponentSettings.test.tsx
+++ b/src/components/H3ComponentSettings.test.tsx
@@ -8,20 +8,37 @@ import { loadGeneratorTemplateSettings, saveGeneratorTemplateSettings } from "..
vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));
beforeEach(() => localStorage.clear());
afterEach(cleanup);
-const open = () => {
+const open = (advanced = true) => {
render(<SettingsView onClose={() => undefined} />);
fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));
+ if (advanced) fireEvent.click(screen.getByRole("button", { name: "Advanced Options" }));
};
const pick = (label: string, name: string) => {
fireEvent.click(screen.getByRole("combobox", { name: label }));
fireEvent.click(screen.getByRole("option", { name }));
};
-it("places VAEs and Text Encoders above LoRAs and links only matching VAE types", async () => {
- open();
+it("opens VAEs and Text Encoders from Advanced Options after LoRAs and preserves generator links", async () => {
+ open(false);
+ expect(screen.queryByRole("heading", { name: "VAEs" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("heading", { name: "Text Encoders" })).not.toBeInTheDocument();
+ const advanced = screen.getByRole("button", { name: "Advanced Options" });
+ for (const heading of screen.getAllByRole("heading").filter((heading) => /LoRAs/i.test(heading.textContent ?? ""))) {
+ expect(heading.compareDocumentPosition(advanced) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ }
+ fireEvent.click(advanced);
+ expect(screen.getByRole("heading", { level: 1, name: "Advanced Options" })).toHaveFocus();
const headings = screen.getAllByRole("heading").map((heading) => heading.textContent);
expect(headings.indexOf("VAEs")).toBeLessThan(headings.indexOf("Text Encoders"));
- expect(headings.indexOf("Text Encoders")).toBeLessThan(headings.findIndex((heading) => /LoRAs/i.test(heading ?? "")));
+ expect(headings.some((heading) => /LoRAs/i.test(heading ?? ""))).toBe(false);
+ expect(screen.queryByRole("button", { name: "Edit First/Last Frame generator" })).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Back" }));
+ expect(screen.getByRole("button", { name: "Advanced Options" })).toHaveFocus();
+ fireEvent.click(screen.getByRole("button", { name: "Advanced Options" }));
+ fireEvent.keyDown(screen.getByRole("main", { name: "Settings" }), { key: "Escape" });
+ expect(screen.getByRole("button", { name: "Advanced Options" })).toHaveFocus();
+ fireEvent.click(screen.getByRole("button", { name: "Advanced Options" }));
+ fireEvent.click(within(screen.getByRole("navigation", { name: "Breadcrumb" })).getByRole("button", { name: "MiniMax H3" }));
fireEvent.click(screen.getByRole("button", { name: "Edit First/Last Frame generator" }));
expect(screen.queryByRole("button", { name: "Browse for Text encoder weights" })).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Browse for Video VAE weights" })).not.toBeInTheDocument();
diff --git a/src/components/SettingsView.test.tsx b/src/components/SettingsView.test.tsx
index e750038..035536e 100644
--- a/src/components/SettingsView.test.tsx
+++ b/src/components/SettingsView.test.tsx
@@ -382,6 +382,7 @@ describe("the settings screen", () => {
editDefaultGenerator();
expect(screen.queryByRole("button", { name: "More options for Tokenizer" })).toBeNull();
fireEvent.click(screen.getByRole("button", { name: "Back" }));
+ fireEvent.click(screen.getByRole("button", { name: "Advanced Options" }));
fireEvent.click(screen.getByRole("button", { name: "Edit Qwen3 VL 32B MiniMax H3 text encoder" }));
expect(screen.getByLabelText("Text encoder tokenizer")).toBeTruthy();
});
diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsx
index c5cf0a7..2bd25af 100644
--- a/src/components/SettingsView.tsx
+++ b/src/components/SettingsView.tsx
@@ -324,11 +324,13 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar
const queuedDownloads = useSyncExternalStore(subscribeWeightDownloads, getQueuedWeightDownloads);
const downloadPercent = downloadState ? weightDownloadProgress(downloadState) : 0;
const [modelPage, setModelPage] = useState<string | null>(null);
+ const [h3AdvancedPage, setH3AdvancedPage] = useState(false);
const [editingTemplateId, setEditingTemplateId] = useState<string | null>(null);
const [editingLoraId, setEditingLoraId] = useState<string | null>(null);
useEffect(() => {
if (!navigation) return;
setTab("engine");
+ setH3AdvancedPage(false);
const template = loadGeneratorTemplateSettings().templates.find((template) => template.id === navigation.templateId);
const lora = loadLoras().find((entry) => entry.id === navigation.loraId);
setModelPage(navigation.otherWeightId ? "other" : template?.modelType ?? (lora ? lora.modelType ?? "minimax-h3" : null));
@@ -408,8 +410,9 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar
/* A new page opens at its top; a sub-page takes focus on its title (or on
the name of a generator that was just created), and going back returns
focus to the card that opened it. */
- useEffect(() => { if (body.current) body.current.scrollTop = 0; }, [tab, editingTemplateId, modelPage]);
+ useEffect(() => { if (body.current) body.current.scrollTop = 0; }, [tab, editingTemplateId, modelPage, h3AdvancedPage]);
useEffect(() => {
+ if (h3AdvancedPage) { subpageHeading.current?.focus(); return; }
if (editingTemplateId) {
if (focusName.current) { focusName.current = false; nameField.current?.focus(); nameField.current?.select(); }
else subpageHeading.current?.focus();
@@ -420,11 +423,12 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar
const opener = ref && [...(body.current?.querySelectorAll<HTMLElement>("[data-open-ref]") ?? [])].find((element) => element.dataset.openRef === ref);
if (opener) opener.focus();
else if (modelPage) subpageHeading.current?.focus();
- }, [editingTemplateId, modelPage]);
+ }, [editingTemplateId, modelPage, h3AdvancedPage]);
- const openTemplate = (id: string) => { returnFocus.current = `template:${id}`; setModelPage(templateSettings.templates.find((template) => template.id === id)!.modelType); setEditingTemplateId(id); };
+ const openTemplate = (id: string) => { returnFocus.current = `template:${id}`; setH3AdvancedPage(false); setModelPage(templateSettings.templates.find((template) => template.id === id)!.modelType); setEditingTemplateId(id); };
const leaveTemplate = () => { setModelPage(editingTemplate?.modelType ?? modelPage); setEditingTemplateId(null); };
- const leaveModel = () => { returnFocus.current = `model:${editingTemplate?.modelType ?? modelPage}`; setEditingTemplateId(null); setModelPage(null); };
+ const leaveModel = () => { returnFocus.current = `model:${editingTemplate?.modelType ?? modelPage}`; setH3AdvancedPage(false); setEditingTemplateId(null); setModelPage(null); };
+ const leaveAdvanced = () => { returnFocus.current = "h3-advanced"; setH3AdvancedPage(false); };
const browse = async (field: EnginePathField) => {
setError(null);
@@ -503,11 +507,12 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar
const missing = generatorPathFields(selectedTemplate).filter((field) => field.required && pathState(field, settings[field.id], status) !== "found");
const selectTab = (id: TabId) => {
setTab(id);
+ setH3AdvancedPage(false);
setEditingTemplateId(null);
setEditingLoraId(null);
setModelPage(null);
};
- const back = () => { if (editingTemplateId) leaveTemplate(); else if (tab === "engine" && modelPage) leaveModel(); else onClose(); };
+ const back = () => { if (h3AdvancedPage) leaveAdvanced(); else if (editingTemplateId) leaveTemplate(); else if (tab === "engine" && modelPage) leaveModel(); else onClose(); };
const downloadStatus = downloadState && <DownloadStatus state={downloadState} onError={setError}
templateName={templateSettings.templates.find((template) => template.id === downloadState.templateId)?.name} />;
@@ -663,7 +668,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar
<OpenableCard key={model} icon={model === "other" ? <ModelFile20 /> : generatorModel(model).musicGeneration ? <Audio22 /> : !generatorModel(model).videoGeneration ? <Image20 /> : <Video20 />} header={modelPageLabel(model)}
openLabel={modelPageLabel(model)} openRef={`model:${model}`} description={model === "other" ? "Other weights" : "Generators and LoRAs"} onOpen={() => setModelPage(model)} />)}
</div>
- </> : modelPage === "other" ? <OtherWeightsSettings desktop={desktop} /> : <>
+ </> : modelPage === "other" ? <OtherWeightsSettings desktop={desktop} /> : h3AdvancedPage ? <H3ComponentSettings settings={templateSettings} desktop={desktop} /> : <>
{generatorSections.filter((section) => section.id === "generators" || section.templates.length > 0).map((section) => <SettingsGroup key={section.id} heading={section.title}>
{section.id === "generators" && <GeneratorSharing templates={[]}>{({ importButton }) => <SettingsCard icon={<Add20 />} header="Add a generator" description="Choose the generator used by default, or open one to edit its model setup">
{importButton}
@@ -694,8 +699,10 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar
})}
</div>
</SettingsGroup>)}
- {modelPage === "minimax-h3" && <H3ComponentSettings settings={templateSettings} desktop={desktop} />}
<LoraLibrary key={modelPage} modelType={modelPage} onAdd={() => setEditingLoraId(`lora-${crypto.randomUUID()}`)} onEdit={setEditingLoraId} />
+ {modelPage === "minimax-h3" && <div className="settings-page__actions">
+ <button type="button" className="secondary-button" data-open-ref="h3-advanced" onClick={() => setH3AdvancedPage(true)}><Options20 aria-hidden="true" /> Advanced Options</button>
+ </div>}
</>}
</>;
@@ -762,7 +769,11 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar
<button type="button" className="settings-breadcrumb__link" onClick={leaveTemplate}>{modelPageLabel(editingTemplate.modelType)}</button>
<ChevronRight20 aria-hidden="true" className="settings-breadcrumb__separator" />
</>}
- <h1 id="settings-subpage-heading" ref={subpageHeading} tabIndex={-1} aria-current="page">{editingTemplate ? editingTemplate.name || "Untitled generator" : modelPageLabel(modelPage!)}</h1>
+ {h3AdvancedPage && <>
+ <button type="button" className="settings-breadcrumb__link" onClick={leaveAdvanced}>MiniMax H3</button>
+ <ChevronRight20 aria-hidden="true" className="settings-breadcrumb__separator" />
+ </>}
+ <h1 id="settings-subpage-heading" ref={subpageHeading} tabIndex={-1} aria-current="page">{h3AdvancedPage ? "Advanced Options" : editingTemplate ? editingTemplate.name || "Untitled generator" : modelPageLabel(modelPage!)}</h1>
</nav>
: <h1 id="settings-page-heading" className="settings-page__title">{current.label}</h1>}