diff --git a/deployments/ai-stack/openwebui-tools/smart_image_gen.py b/deployments/ai-stack/openwebui-tools/smart_image_gen.py index 2b94ea2..526b0f5 100644 --- a/deployments/ai-stack/openwebui-tools/smart_image_gen.py +++ b/deployments/ai-stack/openwebui-tools/smart_image_gen.py @@ -1,7 +1,7 @@ """ title: Smart Image Generator & Editor (ComfyUI) author: ai-stack -version: 0.7.10 +version: 0.7.11 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 @@ -754,11 +754,17 @@ class Tools: ) -> str: """ Create a NEW image from scratch and show it to the user. Use this - whenever the user asks you to draw, generate, create, make, paint, - render, or imagine any visual content — photographs, portraits, - characters, scenes, illustrations, anime, drawings — and they have - NOT attached an existing image. If they did attach an image and - want it modified, use edit_image instead. + ONLY when there is no existing image in the chat at all and the + user is asking for a fresh image (draw, generate, create, make, + paint, render, imagine) — photographs, portraits, characters, + scenes, illustrations, anime, drawings. If ANY image is already + visible in the chat (either user-attached OR one you generated + earlier in this conversation) and the user is asking to change, + modify, restyle, recolor, add to, remove from, or iterate on it, + use edit_image instead — even if the user's word choice sounds + like a fresh request ("make her hair red", "now show her at + sunset"). Follow-up requests on an existing image are ALMOST + ALWAYS edits, not new generations. Pick `style` to match what the user wants: - "photo" — photorealistic photographs, portraits, cinematic shots. @@ -854,9 +860,13 @@ class Tools: __event_emitter__: Optional[Callable[[dict], Awaitable[None]]] = None, ) -> str: """ - Edit, modify, transform, or restyle an image the user has ATTACHED - to the chat. Use whenever the user uploads an image and asks to - change it. If no image is attached, use generate_image instead. + Edit, modify, transform, or restyle an image already in this + chat — either one the user attached, OR one you (the assistant) + generated earlier in this same conversation via generate_image + or edit_image. Use whenever the user asks to change, modify, + restyle, recolor, add to, remove from, or iterate on an image + that is already visible above in the chat. If no image exists + in the chat at all, use generate_image instead. TWO MODES — choose based on whether the change is local or global: @@ -905,7 +915,8 @@ class Tools: 1.0 with mask_text, 0.7 without. :param negative_prompt: Extra terms to exclude. Usually unneeded. :param seed: 0 to randomize, otherwise specific. - :return: Markdown image of the result, or an error if no image is attached. + :return: Markdown image of the result, or an error if no image + exists anywhere in this chat (user-uploaded or assistant-generated). """ # Resolve style — inheritance DOMINATES for edits. Vision LLMs # misclassify subject types (observed in the wild: juggernaut