smart_image_gen v0.7.7: enforce style inheritance for edit_image
Vision-capable LLMs misclassify rendered subjects when picking a style — observed: model called juggernaut for an edit on a furry-il generation because the rendered character looked 'photoreal-ish' to its vision encoder. Each visual judgment is independent so styles flip mid-chat. Flipped resolution order in edit_image so inheritance from the prior generate_image / edit_image call DOMINATES the LLM's explicit style arg. The LLM's choice only wins when there's nothing to inherit (first edit in a chat, fresh user upload). Workaround for legitimate style changes is starting a new chat. System prompt updated to match: tells the LLM that style inheritance is enforced, that passing style on follow-up calls is ignored, and that user requests for style change require a new chat. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
title: Smart Image Generator & Editor (ComfyUI)
|
||||
author: ai-stack
|
||||
version: 0.7.6
|
||||
version: 0.7.7
|
||||
description: Generate or edit images via ComfyUI with automatic SDXL
|
||||
checkpoint routing. Two methods — generate_image (txt2img) and
|
||||
edit_image (img2img on the user's most recently attached image). The
|
||||
@@ -872,12 +872,15 @@ class Tools:
|
||||
|
||||
Pick `style` for the DESIRED OUTPUT, not the input image.
|
||||
|
||||
Style resolution order: explicit `style` arg → inherited from the
|
||||
most recent prior generate_image / edit_image call in this
|
||||
conversation → keyword detection on `prompt`. Omit `style` to
|
||||
let the tool inherit from the previous call automatically — it
|
||||
usually picks the right thing for follow-up edits on an image
|
||||
the LLM just generated.
|
||||
Style resolution order: inherited from the most recent prior
|
||||
generate_image / edit_image call in this conversation (DOMINANT)
|
||||
→ explicit `style` arg → keyword detection on `prompt`.
|
||||
Inheritance dominates because vision LLMs misclassify subjects
|
||||
in the rendered output (e.g. picking 'juggernaut' on a
|
||||
'furry-il' source). For follow-up edits on an image you
|
||||
generated earlier, omit `style` entirely — the tool reuses the
|
||||
established style automatically. The user can start a new chat
|
||||
if they want a different style.
|
||||
|
||||
:param prompt: What the changed area should look like.
|
||||
Tool auto-prepends quality tags — don't include those.
|
||||
@@ -892,12 +895,13 @@ class Tools:
|
||||
:param seed: 0 to randomize, otherwise specific.
|
||||
:return: Markdown image of the result, or an error if no image is attached.
|
||||
"""
|
||||
# Resolve style with explicit > inherited-from-prior-call > keyword.
|
||||
# Inheritance covers the common case where the LLM is editing an
|
||||
# image it already generated and forgets to set style — without it,
|
||||
# neutral edit prompts ("bigger", "glowing eyes") fall through to
|
||||
# the keyword router and get the wrong checkpoint.
|
||||
chosen = style or _inherited_style(__messages__) or _route_style(prompt)
|
||||
# Resolve style — inheritance DOMINATES for edits. Vision LLMs
|
||||
# misclassify subject types (observed in the wild: juggernaut
|
||||
# picked for a furry-il source because the model thought the
|
||||
# rendered character looked "photoreal-ish"). When there's a
|
||||
# prior tool call in this chat, use the same style; the user's
|
||||
# workaround for genuine style changes is a fresh chat.
|
||||
chosen = _inherited_style(__messages__) or style or _route_style(prompt)
|
||||
settings = STYLES.get(chosen)
|
||||
if not settings:
|
||||
return f"Unknown style '{chosen}'. Available: {', '.join(STYLES.keys())}"
|
||||
|
||||
Reference in New Issue
Block a user