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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
v2.5.0 X7+X8+X9: F2 LoRA picker, F3 extended ComfyUI params, B4 logger
purplebbaf43b6b447
diff --git a/src/api/comfyui.ts b/src/api/comfyui.tsindex 8df7eec3..df9a8fc4 100644--- a/src/api/comfyui.ts+++ b/src/api/comfyui.ts@@ -1,4 +1,5 @@import { comfyuiUrl, localFetch } from "./backend"+import { log } from "../lib/logger"// ─── Types ───@@ -16,6 +17,18 @@ export interface GenerateParams {batchSize: numberinputImage?: string // I2I source image filename (uploaded to ComfyUI)denoise?: number // I2I denoise strength (0.0–1.0, default 1.0 = full txt2img)+ // F2 (cinemazverev GH#4): a single LoRA slot. Empty = no LoRA.+ // `loraStrength` mirrors LoraLoader's `strength_model` (0..2 typical).+ lora?: string+ loraStrength?: number+ // F3 (vanja-san GH#4): override the checkpoint's bundled VAE with an+ // explicit VAELoader. 'auto' / undefined / empty = keep the+ // checkpoint VAE.+ vae?: string+ // F3: optional CLIPSetLastLayer injection. 0 = no skip (the+ // checkpoint default). Common values: 1 for SD1.5/SDXL,+ // 2 for some abliterated finetunes.+ clipSkip?: number}export interface VideoParams extends GenerateParams {@@ -371,7 +384,7 @@ export async function getVAEModels(): Promise<string[]> {const data = await res.json()return data?.VAELoader?.input?.required?.vae_name?.[0] ?? []} catch (err) {- console.warn('[ComfyUI] Failed to fetch VAE models:', err)+ log.warn('comfyui.fetch_vae_failed', { err })return []}}@@ -383,7 +396,25 @@ export async function getCLIPModels(): Promise<string[]> {const data = await res.json()return data?.CLIPLoader?.input?.required?.clip_name?.[0] ?? []} catch (err) {- console.warn('[ComfyUI] Failed to fetch CLIP models:', err)+ log.warn('comfyui.fetch_clip_failed', { err })+ return []+ }+}++/**+ * F2 (cinemazverev GH#4): list LoRA files ComfyUI knows about. Pulls+ * the same enum LoraLoader's `lora_name` dropdown shows — anything the+ * user dropped into `<comfyui>/models/loras/`. Soft-fails to `[]` when+ * the LoraLoader node isn't registered (custom-node ComfyUI distros).+ */+export async function getLoraModels(): Promise<string[]> {+ try {+ const res = await localFetch(comfyuiUrl('/object_info/LoraLoader'))+ if (!res.ok) return []+ const data = await res.json()+ return data?.LoraLoader?.input?.required?.lora_name?.[0] ?? []+ } catch (err) {+ log.warn('comfyui.fetch_lora_failed', { err })return []}}diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.tsindex d565c238..f0a9bf0e 100644--- a/src/api/dynamic-workflow.ts+++ b/src/api/dynamic-workflow.ts@@ -394,6 +394,62 @@ export async function buildDynamicWorkflow(samplerModelId = evolvedId}+ // ─── Phase 1b: Optional LoRA + VAE + Skip-CLIP injection (F2 + F3) ───+ //+ // Single LoRA slot (cinemazverev GH#4): LoraLoader takes (model, clip)+ // and outputs new (model, clip) — we rewire both refs so the rest of+ // the pipeline sees the LoRA-modified versions.+ //+ // VAE override (vanja-san GH#4): VAELoader replaces vaeSourceId. The+ // checkpoint's bundled VAE stays unused.+ //+ // Skip CLIP (vanja-san GH#4): CLIPSetLastLayer takes a negative+ // `stop_at_clip_layer` index — passing -clipSkip mirrors A1111 /+ // ComfyUI conventions.+ //+ // All three are skipped (no extra nodes) when the corresponding+ // param is unset, so workflows without F2/F3 enabled stay byte-+ // identical to the previous behaviour.+ if (params.lora) {+ const loraId = String(n++)+ workflow[loraId] = {+ class_type: 'LoraLoader',+ inputs: {+ lora_name: params.lora,+ strength_model: params.loraStrength ?? 0.8,+ strength_clip: params.loraStrength ?? 0.8,+ model: [samplerModelId, 0],+ clip: [clipSourceId, clipOutputSlot],+ },+ }+ samplerModelId = loraId+ clipSourceId = loraId+ clipOutputSlot = 1+ }++ if (params.vae && params.vae !== 'auto') {+ const vaeId = String(n++)+ workflow[vaeId] = {+ class_type: 'VAELoader',+ inputs: { vae_name: params.vae },+ }+ vaeSourceId = vaeId+ vaeOutputSlot = 0+ }++ if (params.clipSkip && params.clipSkip > 0) {+ const skipId = String(n++)+ workflow[skipId] = {+ class_type: 'CLIPSetLastLayer',+ inputs: {+ stop_at_clip_layer: -Math.abs(params.clipSkip),+ clip: [clipSourceId, clipOutputSlot],+ },+ }+ clipSourceId = skipId+ clipOutputSlot = 0+ }+// ─── Phase 2: Text Encoding ───const posId = String(n++)diff --git a/src/components/create/ParamPanel.tsx b/src/components/create/ParamPanel.tsxindex 01a37b0d..de0f7949 100644--- a/src/components/create/ParamPanel.tsx+++ b/src/components/create/ParamPanel.tsx@@ -4,7 +4,7 @@ import { SliderControl } from '../settings/SliderControl'import { WorkflowFinder } from './WorkflowFinder'import { Dice5, Info, AlertTriangle, Film, ImageIcon, ImagePlus } from 'lucide-react'import type { ClassifiedModel, ModelType } from '../../api/comfyui'-import { snapToVideoGrid, isI2VModel } from '../../api/comfyui'+import { snapToVideoGrid, isI2VModel, getLoraModels, getVAEModels } from '../../api/comfyui'interface Props {imageModels: ClassifiedModel[]@@ -234,6 +234,15 @@ export function ParamPanel({ imageModels, videoModels, samplerList, schedulerLis<SliderControl label="Denoise" value={store.denoise} min={0.05} max={1.0} step={0.05} onChange={store.setDenoise} />)}+ {/* F2 (cinemazverev GH#4) + F3 (vanja-san GH#4) — extended params.+ LoRA / VAE / Skip CLIP only matter for image generation; we+ hide them for video to keep the panel terse. The LoRA list is+ fetched lazily from ComfyUI's LoraLoader node enum the first+ time the panel mounts. */}+ {!isVideo && (+ <ExtendedComfyParams />+ )}+{/* Size */}<div><label className={lbl}>Size ({store.width}x{store.height})</label>@@ -314,3 +323,92 @@ export function ParamPanel({ imageModels, videoModels, samplerList, schedulerLis</div>)}++// ── F2 + F3 extended params (image generation only) ──────────────+//+// Lazy-loads the LoRA + VAE enum from ComfyUI's `/object_info/...` once+// per mount. Both lists silently fall back to empty when the node isn't+// registered — F2/F3 then degrade to "no LoRA" / "VAE: auto".++function ExtendedComfyParams() {+ const store = useCreateStore()+ const [loras, setLoras] = useState<string[]>([])+ const [vaes, setVaes] = useState<string[]>([])+ const [loaded, setLoaded] = useState(false)++ useEffect(() => {+ let cancelled = false+ void Promise.all([getLoraModels(), getVAEModels()]).then(([l, v]) => {+ if (cancelled) return+ setLoras(l)+ setVaes(v)+ setLoaded(true)+ })+ return () => {+ cancelled = true+ }+ }, [])++ const sel = 'w-full px-2 py-1 rounded bg-gray-50 dark:bg-white/[0.04] border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-800 dark:text-gray-200 focus:outline-none focus:border-blue-400/40'+ const lbl = 'text-[0.55rem] text-gray-500 mb-1 block'++ return (+ <div className="space-y-2 pt-1 border-t border-gray-200 dark:border-white/5">+ <div className="text-[0.55rem] uppercase tracking-widest text-gray-500">Extended</div>++ {/* LoRA (F2) — single slot, no chain. Empty option = no LoRA. */}+ <div>+ <label className={lbl}>LoRA {!loaded && <span className="text-gray-400">(loading…)</span>}</label>+ <select+ value={store.selectedLora}+ onChange={(e) => store.setSelectedLora(e.target.value)}+ className={sel}+ disabled={!loaded}+ >+ <option value="">— none —</option>+ {loras.map((l) => (+ <option key={l} value={l}>{l}</option>+ ))}+ </select>+ {store.selectedLora && (+ <SliderControl+ label="LoRA strength"+ value={store.loraStrength}+ min={0}+ max={2}+ step={0.05}+ onChange={store.setLoraStrength}+ />+ )}+ </div>++ {/* VAE override (F3) */}+ <div>+ <label className={lbl}>VAE</label>+ <select+ value={store.selectedVae}+ onChange={(e) => store.setSelectedVae(e.target.value)}+ className={sel}+ disabled={!loaded}+ >+ <option value="auto">auto (use checkpoint VAE)</option>+ {vaes.map((v) => (+ <option key={v} value={v}>{v}</option>+ ))}+ </select>+ </div>++ {/* Skip CLIP (F3) — 0 = none. 1-2 is the SD1.5 / SDXL sweet spot+ for some abliterated finetunes. >2 only makes sense for very+ specialised use. */}+ <SliderControl+ label="Skip CLIP layers"+ value={store.clipSkip}+ min={0}+ max={12}+ step={1}+ onChange={store.setClipSkip}+ />+ </div>+ )+}diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.tsindex aca9e3da..fe0e3fa4 100644--- a/src/hooks/useCodex.ts+++ b/src/hooks/useCodex.ts@@ -20,6 +20,7 @@ import { fetchRepoMap, renderRepoMapSection } from '../api/agents/repo-map'import { isLocalModelByName } from '../api/agents/model-locality'import { useStagedChangesStore } from '../stores/stagedChangesStore'import { computeUnifiedDiff } from '../lib/diff'+import { log } from '../lib/logger'import type { CodexEvent } from '../types/codex'import type { AgentBlock, AgentToolCall } from '../types/agent-mode'import { selectRelevantTools } from '../lib/tool-selection'@@ -377,8 +378,10 @@ export function useCodex() {useChatStore.getState().updateMessageAgentBlocks(convId, assistantMsg.id, [...blocks])}} catch (e) {- // Architect is advisory — never blocks the editor loop.- console.warn('[codex] architect pass failed:', (e as Error)?.message)+ // Architect is advisory — never blocks the editor loop. Use+ // the structured logger so the redaction layer scrubs any+ // accidental secrets in the error context.+ log.warn('codex.architect_pass_failed', { err: e })}}}@@ -403,7 +406,7 @@ export function useCodex() {useChatStore.getState().updateMessageAgentBlocks(convId, assistantMsg.id, [...blocks])}} catch (e) {- console.warn('[codex] repo-map pre-fetch failed:', (e as Error)?.message)+ log.warn('codex.repo_map_fetch_failed', { err: e })}}diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.tsindex f22633b9..08a37140 100644--- a/src/hooks/useCreate.ts+++ b/src/hooks/useCreate.ts@@ -240,6 +240,11 @@ export function useCreate() {const {mode, prompt, negativePrompt, imageModel, videoModel,sampler, scheduler, steps, cfgScale, width, height, seed, batchSize, frames, fps, denoise, i2iImage, i2vImage,+ // F2 + F3 (cinemazverev / vanja-san GH#4) — extended params surfaced+ // in ParamPanel. selectedLora === '' / clipSkip === 0 / vae === 'auto'+ // are the "do nothing extra" defaults; the workflow builder skips+ // adding nodes for those values.+ selectedLora, loraStrength, selectedVae, clipSkip,setIsGenerating, setProgress, setCurrentPromptId, setError, addToGallery, addToPromptHistory,} = state@@ -279,6 +284,11 @@ export function useCreate() {const baseParams = {prompt, negativePrompt, model: activeModel, sampler, scheduler, steps, cfgScale, width, height, seed, batchSize,...(isI2I && i2iImage ? { inputImage: i2iImage, denoise } : {}),+ // F2/F3 — only thread the param when the user actually picked one.+ // Empty / 'auto' / 0 means "skip this node".+ ...(selectedLora ? { lora: selectedLora, loraStrength } : {}),+ ...(selectedVae && selectedVae !== 'auto' ? { vae: selectedVae } : {}),+ ...(clipSkip > 0 ? { clipSkip } : {}),}let workflow: Record<string, any>diff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex f80a931a..8a568066 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -66,6 +66,15 @@ interface CreateState {frames: numberfps: numberdenoise: number // Denoise strength for I2I (0.0–1.0)+ // F2 (cinemazverev GH#4) — 1 LoRA slot. Empty string = none.+ selectedLora: string+ loraStrength: number // 0..2, mirrors LoraLoader's `strength_model` slider+ // F3 (vanja-san GH#4) — top extended ComfyUI params surfaced in+ // the param panel. selectedVae = 'auto' lets the checkpoint's+ // bundled VAE win; an explicit pick overrides with a VAELoader.+ // clipSkip = 0 means no Skip-CLIP layer is injected.+ selectedVae: string+ clipSkip: numberi2iImage: string | null // Uploaded image filename for I2Ii2vImage: string | null // Uploaded image filename for I2V models (SVD, FramePack)isGenerating: boolean@@ -109,6 +118,10 @@ interface CreateState {setFrames: (frames: number) => voidsetFps: (fps: number) => voidsetDenoise: (denoise: number) => void+ setSelectedLora: (name: string) => void+ setLoraStrength: (strength: number) => void+ setSelectedVae: (name: string) => void+ setClipSkip: (skip: number) => voidsetI2iImage: (image: string | null) => voidsetI2vImage: (image: string | null) => voidsetIsGenerating: (generating: boolean) => void@@ -148,6 +161,10 @@ export const useCreateStore = create<CreateState>()(frames: 24,fps: 8,denoise: 0.7,+ selectedLora: '',+ loraStrength: 0.8,+ selectedVae: 'auto',+ clipSkip: 0,i2iImage: null,i2vImage: null,isGenerating: false,@@ -231,6 +248,10 @@ export const useCreateStore = create<CreateState>()(setFrames: (frames) => set({ frames: Math.max(1, Math.min(120, Math.floor(frames))) }),setFps: (fps) => set({ fps: Math.max(1, Math.min(60, Math.floor(fps))) }),setDenoise: (denoise) => set({ denoise: Math.max(0, Math.min(1, denoise)) }),+ setSelectedLora: (name) => set({ selectedLora: name || '' }),+ setLoraStrength: (strength) => set({ loraStrength: Math.max(0, Math.min(2, strength)) }),+ setSelectedVae: (name) => set({ selectedVae: name || 'auto' }),+ setClipSkip: (skip) => set({ clipSkip: Math.max(0, Math.min(12, Math.floor(skip))) }),setI2iImage: (image) => set({ i2iImage: image }),setI2vImage: (image) => set({ i2vImage: image }),setIsGenerating: (generating) => set({ isGenerating: generating, ...(generating ? {} : { progressPhase: 'idle' as ProgressPhase }) }),