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
fix(create): enhancer time limit lives with its line, so mocks of the run keep working (B41)
purple66efc0aeaf42
diff --git a/src/api/qwen-enhancer.ts b/src/api/qwen-enhancer.tsindex ff212892..6cee8b28 100644--- a/src/api/qwen-enhancer.ts+++ b/src/api/qwen-enhancer.ts@@ -21,7 +21,7 @@ import { getAllNodeInfo } from './comfyui-nodes'import { submitWorkflow, getHistory, freeMemory, abandonPrompt } from './comfyui'import { comfyWS, type ComfyWSEvent } from './comfyui-ws'import { WorkflowUnavailableError } from './dynamic-workflow'-import { enhancedOutcome, type EnhancerPhase, type QwenEnhancerMode } from '../lib/render/qwen-enhancer'+import { enhancedOutcome, QWEN_ENHANCER_LIMIT_MINUTES, type EnhancerPhase, type QwenEnhancerMode } from '../lib/render/qwen-enhancer'import type { ImproveOutcome } from '../lib/render/improve-prompt'import { QWEN_PE_I2I_SYSTEM_PROMPT, QWEN_PE_T2I_SYSTEM_PROMPT } from './qwen-enhancer-prompts'@@ -39,9 +39,8 @@ export const QWEN_ENHANCER_MAX_LENGTH = 4096/** How long the rewrite may take, loading the 9 GB file included. After this* the job is taken out of the queue and the run goes on with the user's prompt.* B41 (3.0.9): was 15 minutes, and a user gave up after 530 s of a line that- * only counted. The box needs 70 s for a new picture and 175 s for an edit- * on a 12 GB card; eight minutes leaves a slower card room and no more. */-export const QWEN_ENHANCER_TIMEOUT_MS = 8 * 60_000+ * only counted (lib/render/qwen-enhancer QWEN_ENHANCER_LIMIT_MINUTES). */+export const QWEN_ENHANCER_TIMEOUT_MS = QWEN_ENHANCER_LIMIT_MINUTES * 60_000/** How long the enhancer may go without a word from ComfyUI once it has* started reporting: no token, no node. A stuck job ends here instead of atdiff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.tsindex a45688f2..f4b71dd9 100644--- a/src/hooks/useCreate.ts+++ b/src/hooks/useCreate.ts@@ -81,7 +81,7 @@ import { elapsedLine } from '../lib/elapsed-line'import { improvePrompt } from '../lib/render/improve-prompt-run'import { currentChatModelList, currentHelperModel } from '../lib/cloud-helper-model'import { enhancerLine, enhancerNames, pickQwenEnhancer, rewrittenByName, type ImproveWriter } from '../lib/render/qwen-enhancer'-import { buildQwenEnhancerWorkflow, runQwenEnhancer, QWEN_ENHANCER_TIMEOUT_MS } from '../api/qwen-enhancer'+import { buildQwenEnhancerWorkflow, runQwenEnhancer } from '../api/qwen-enhancer'import { enhancePromptOnMac } from '../api/mlx-enhancer'import { extraReferenceSlots, referenceSide } from '../lib/edit-references'import { canonicalImageRefs } from '../lib/image-ref-names'@@ -1781,11 +1781,10 @@ export function useCreate() {const improving = elapsedLine((text) => setProgress(3, text), IMPROVING_PROMPT)// B41: the line says which part runs and, while it writes, how many// tokens it has and how fast, from ComfyUI's own progress stream.- const limitMinutes = Math.round(QWEN_ENHANCER_TIMEOUT_MS / 60_000)const out = await runQwenEnhancer(enhancerGraph, scenePrompt, {clientId: CLIENT_ID,signal,- onProgress: (p) => improving.setLabel(enhancerLine(p, qwenEnhancer.mode, limitMinutes)),+ onProgress: (p) => improving.setLabel(enhancerLine(p, qwenEnhancer.mode)),}).finally(improving.stop)if (signal?.aborted) throw new Error('Cancelled')takeRewrite(out, qwenEnhancer.variant)diff --git a/src/lib/render/qwen-enhancer.ts b/src/lib/render/qwen-enhancer.tsindex 29293411..2ab51a80 100644--- a/src/lib/render/qwen-enhancer.ts+++ b/src/lib/render/qwen-enhancer.ts@@ -228,6 +228,12 @@ export function enhancerNames(return where.mlxModel ? macEnhancers : []}+/** How long the Qwen enhancer may take on ComfyUI, in minutes, loading+ * included (B41, 3.0.9: was 15). The box needs 70 s for a new picture and+ * 175 s for an edit on a 12 GB card; eight minutes leaves a slower card room+ * and no more. Used by the run (api/qwen-enhancer.ts) and said on the line. */+export const QWEN_ENHANCER_LIMIT_MINUTES = 8+/** What the Qwen enhancer's progress looks like here; the run reports it* (api/qwen-enhancer.ts `EnhancerProgress`). */export type EnhancerPhase =@@ -244,7 +250,7 @@ export type EnhancerPhase =* at once, instead of after minutes. `max` is the limit, not a goal: the* enhancer stops at its own end, usually long before.*/-export function enhancerLine(p: EnhancerPhase, mode: QwenEnhancerMode, limitMinutes: number): string {+export function enhancerLine(p: EnhancerPhase, mode: QwenEnhancerMode, limitMinutes = QWEN_ENHANCER_LIMIT_MINUTES): string {switch (p.phase) {case 'queued':return 'Improving your prompt: waiting for ComfyUI…'