Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(ui): the context menu sits at the pointer under the UI zoom, FastH3 skips the turbo LoRA

purple0c81b1347e71
diff --git a/src/api/__tests__/fasth3-is-the-fast-minimax-h3.test.ts b/src/api/__tests__/fasth3-is-the-fast-minimax-h3.test.ts
index 931e4609..c044bf63 100644
--- a/src/api/__tests__/fasth3-is-the-fast-minimax-h3.test.ts
+++ b/src/api/__tests__/fasth3-is-the-fast-minimax-h3.test.ts
@@ -146,6 +146,17 @@ describe('the graph follows the official template', () => {
expect(nodeOf(wf, 'KSamplerSelect')![1].inputs.sampler_name).toBe('res_multistep')
})
+ it('leaves the H3 turbo LoRA out (FastH3 is already distilled) and keeps every other LoRA with its own strength', async () => {
+ const TURBO = 'minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors'
+ const wf = await buildDynamicWorkflow(run(FAST, { lora: [TURBO, 'style.safetensors'], loraStrength: [1, 0.6] }), 'minimaxh3')
+ const loras = Object.values(wf as Record<string, { class_type: string; inputs: Record<string, unknown> }>)
+ .filter((nd) => nd.class_type === 'LoraLoaderModelOnly')
+ expect(loras.map((nd) => [nd.inputs.lora_name, nd.inputs.strength_model])).toEqual([['style.safetensors', 0.6]])
+ // On the base H3 the same stack keeps both.
+ const base = await buildDynamicWorkflow(run(BASE, { lora: [TURBO, 'style.safetensors'], loraStrength: [1, 0.6] }), 'minimaxh3')
+ expect(Object.values(base as Record<string, { class_type: string }>).filter((nd) => nd.class_type === 'LoraLoaderModelOnly').length).toBe(2)
+ })
+
it('keeps the H3 wiring: encode node, joint latent, both decoders, sound muxed', async () => {
const wf = await buildDynamicWorkflow(run(FAST), 'minimaxh3')
const [encId, enc] = nodeOf(wf, 'MiniMaxH3ImageToVideo')!
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 4d91856b..f1d56d44 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -114,6 +114,8 @@ interface StrategyResult {
* 0.35.0, YuE2 in 0.36.0. "Update ComfyUI" in the text is what Create keys the
* one click update on (needsComfyUpdate). */
export const LTX25_NEEDS_UPDATE = 'LTX 2.5 needs ComfyUI 0.32.0 or newer. Update ComfyUI in Settings.'
+/** A step distillation LoRA names its step count (minimax_h3_fl2v_turbo_8step_...). */
+const H3_STEP_LORA = /turbo\D*?(\d+)\s*_?steps?/i
export const FASTH3_NEEDS_UPDATE = 'FastH3 needs ComfyUI 0.35.0 or newer. Update ComfyUI in Settings.'
export const YUE2_NEEDS_UPDATE = 'YuE2 needs ComfyUI 0.36.0 or newer. Update ComfyUI in Settings.'
@@ -1888,8 +1890,14 @@ async function buildMiniMaxH3Workflow(params: VideoParams, seed: number, allNode
// Video LoRAs (the turbo ones included) patch the model only.
let modelSrc = unetId
- const loras = normalizeLoraList(params.lora)
- const strengths = normalizeLoraStrengths(params.loraStrength, loras.length)
+ const stack = normalizeLoraList(params.lora)
+ const stackStrengths = normalizeLoraStrengths(params.loraStrength, stack.length)
+ // FastH3 is already the 8 step distillation. A step LoRA (the H3 turbo one)
+ // on top of it distils twice, so on FastH3 it is left out; every other LoRA
+ // in the stack still patches the model.
+ const keep = stack.map((l) => !(fast && H3_STEP_LORA.test(l)))
+ const loras = stack.filter((_, i) => keep[i])
+ const strengths = stackStrengths.filter((_, i) => keep[i])
loras.forEach((loraName, i) => {
const loraId = String(n++)
workflow[loraId] = {
@@ -1948,7 +1956,7 @@ async function buildMiniMaxH3Workflow(params: VideoParams, seed: number, allNode
// 8step_...), and the official template runs it at exactly that (Discord
// 2026-10-02, checkedlemon788's ComfyUI screenshot: turbo_steps 8). The
// slider's 20 or more would only cost time on a 24 GB model.
- const turbo = loras.map((l) => /turbo\D*?(\d+)\s*_?steps?/i.exec(l)).find((m) => m)
+ const turbo = loras.map((l) => H3_STEP_LORA.exec(l)).find((m) => m)
// FastH3 is the 8 step checkpoint: the template runs exactly 8.
const steps = fast ? 8 : turbo ? Number(turbo[1]) : params.steps
workflow[schedulerId] = { class_type: 'BasicScheduler', inputs: { model: [modelSrc, 0], scheduler: params.scheduler || 'simple', steps, denoise: 1 } }
diff --git a/src/api/mcp/builtin-tools.ts b/src/api/mcp/builtin-tools.ts
index 1e1f06dd..ba8cf8e6 100644
--- a/src/api/mcp/builtin-tools.ts
+++ b/src/api/mcp/builtin-tools.ts
@@ -456,7 +456,7 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [
settings: mediaSettingsSchema({
denoise: { type: 'number', description: 'Image-to-image strength 0.05 to 1.0 (only with inputImage).' },
lora: { type: ['string', 'array'], items: { type: 'string' }, description: 'LoRA filename, or an ARRAY of filenames to stack several (chained in order). Matched against the installed LoRAs, extension optional; an unknown name is rejected with the installed list.' },
- loraStrength: { type: ['number', 'array'], items: { type: 'number' }, description: 'LoRA strength (~0 to 2). One number applies to every LoRA; an array gives one strength per LoRA in the same order.' },
+ loraStrength: { type: ['number', 'array'], items: { type: 'number' }, description: 'LoRA strength, usually 0 to 2, accepted from -10 to 10. One number applies to every LoRA; an array gives one strength per LoRA in the same order.' },
vae: { type: 'string', description: 'Override VAE filename.' },
}),
},
diff --git a/src/components/ui/ContextMenu.tsx b/src/components/ui/ContextMenu.tsx
index 423e79f4..bc8e7593 100644
--- a/src/components/ui/ContextMenu.tsx
+++ b/src/components/ui/ContextMenu.tsx
@@ -22,6 +22,8 @@
import { useEffect, useId, useLayoutEffect, useRef, useState, type KeyboardEvent as ReactKeyboardEvent } from 'react'
import { clampMenuPosition, type MenuAction } from './menu-actions'
import { closeDialog, isTopDialog, nextFocusIndex, openDialog } from './dialog-a11y'
+import { kastenFaktor } from '../../lib/popover-placement'
+import { massstab } from '../../hooks/usePopoverPlatz'
export interface ContextMenuProps {
readonly items: readonly MenuAction[]
@@ -79,7 +81,7 @@ export function ContextMenu({ items, x, y, label, onClose }: ContextMenuProps) {
const [active, setActive] = useState(0)
const [pos, setPos] = useState(() =>
- clampMenuPosition(x, y, { width: EST_WIDTH, height: items.length * EST_ROW + EST_PAD }, viewport()),
+ menuPositionUnderZoom(x, y, { width: EST_WIDTH, height: items.length * EST_ROW + EST_PAD }, viewport(), wurzelZoom(), wurzelZoom()),
)
// (1) Stapel-Anmeldung, vor den Tastatur-Effekten — wie in ui/Modal.
@@ -94,7 +96,8 @@ export function ContextMenu({ items, x, y, label, onClose }: ContextMenuProps) {
const el = menuRef.current
if (!el) return
const r = el.getBoundingClientRect()
- const next = clampMenuPosition(x, y, { width: r.width, height: r.height }, viewport())
+ const m = massstab(el)
+ const next = menuPositionUnderZoom(x, y, { width: r.width, height: r.height }, viewport(), m.zoom, m.verhaeltnis)
setPos(prev => (prev.left === next.left && prev.top === next.top ? prev : next))
}, [x, y, items.length])
@@ -203,6 +206,38 @@ export function ContextMenu({ items, x, y, label, onClose }: ContextMenuProps) {
)
}
+/**
+ * Die App-Wurzel liegt unter `zoom` (--ui-scale). Der Zeiger und das Fenster
+ * kommen in sichtbaren Pixeln, `left`/`top` des Menues zaehlen aber in den
+ * Pixeln der gezoomten Wurzel. Ohne Umrechnung sitzt das Menue um den
+ * Zoomfaktor neben dem Zeiger und klemmt gegen einen Rand, der nicht stimmt
+ * (dieselbe Einheitenmischung wie GitHub #149). Der gemessene Kasten kommt je
+ * nach Engine in der einen oder der anderen Einheit, `kastenFaktor` erkennt es.
+ */
+export function menuPositionUnderZoom(
+ x: number,
+ y: number,
+ box: { width: number; height: number },
+ view: { width: number; height: number },
+ zoom: number,
+ verhaeltnis: number,
+) {
+ const z = zoom > 0 ? zoom : 1
+ const f = kastenFaktor(z, verhaeltnis)
+ return clampMenuPosition(
+ x / z,
+ y / z,
+ { width: box.width / f, height: box.height / f },
+ { width: view.width / z, height: view.height / z },
+ )
+}
+
+/** Zoom der App-Wurzel fuer den ersten Anstrich, bevor das Menue im Baum haengt. */
+function wurzelZoom(): number {
+ const root = document.getElementById('root')
+ return (root && parseFloat(getComputedStyle(root).zoom)) || 1
+}
+
function viewport() {
return { width: window.innerWidth, height: window.innerHeight }
}
diff --git a/src/components/ui/__tests__/context-menu-sits-at-the-pointer.test.ts b/src/components/ui/__tests__/context-menu-sits-at-the-pointer.test.ts
new file mode 100644
index 00000000..3233b570
--- /dev/null
+++ b/src/components/ui/__tests__/context-menu-sits-at-the-pointer.test.ts
@@ -0,0 +1,36 @@
+import { describe, it, expect } from 'vitest'
+import { menuPositionUnderZoom } from '../ContextMenu'
+
+// Die App-Wurzel liegt unter zoom 1.15. `left`/`top` zaehlen in den Pixeln der
+// Wurzel, der Zeiger in sichtbaren Pixeln. Sichtbar ist left * zoom.
+const ZOOM = 1.15
+const VIEW = { width: 1280, height: 800 }
+
+describe('das Rechtsklick-Menue sitzt am Zeiger, auch unter dem Zoom', () => {
+ it('Chromium und neues WebKit (Kasten in sichtbaren Pixeln): die linke obere Ecke liegt sichtbar am Zeiger', () => {
+ const p = menuPositionUnderZoom(400, 300, { width: 176 * ZOOM, height: 120 * ZOOM }, VIEW, ZOOM, ZOOM)
+ expect(p.left * ZOOM).toBeCloseTo(400, 5)
+ expect(p.top * ZOOM).toBeCloseTo(300, 5)
+ })
+
+ it('aelteres WebKitGTK (Kasten in den Pixeln der Wurzel): dieselbe Stelle', () => {
+ const p = menuPositionUnderZoom(400, 300, { width: 176, height: 120 }, VIEW, ZOOM, 1)
+ expect(p.left * ZOOM).toBeCloseTo(400, 5)
+ expect(p.top * ZOOM).toBeCloseTo(300, 5)
+ })
+
+ it('am rechten unteren Rand bleibt das ganze Menue sichtbar im Fenster', () => {
+ for (const verhaeltnis of [ZOOM, 1]) {
+ const f = verhaeltnis === ZOOM ? ZOOM : 1
+ const p = menuPositionUnderZoom(1270, 790, { width: 176 * f, height: 120 * f }, VIEW, ZOOM, verhaeltnis)
+ expect((p.left + 176) * ZOOM).toBeLessThanOrEqual(VIEW.width)
+ expect((p.top + 120) * ZOOM).toBeLessThanOrEqual(VIEW.height)
+ expect(p.left).toBeGreaterThanOrEqual(0)
+ expect(p.top).toBeGreaterThanOrEqual(0)
+ }
+ })
+
+ it('ohne Zoom aendert sich nichts', () => {
+ expect(menuPositionUnderZoom(400, 300, { width: 176, height: 120 }, VIEW, 1, 1)).toEqual({ left: 400, top: 300 })
+ })
+})