diff --git a/deployments/ai-stack/openwebui-tools/smart_image_gen.py b/deployments/ai-stack/openwebui-tools/smart_image_gen.py index 19ef9b8..9e3f515 100644 --- a/deployments/ai-stack/openwebui-tools/smart_image_gen.py +++ b/deployments/ai-stack/openwebui-tools/smart_image_gen.py @@ -20,6 +20,12 @@ from typing import Awaitable, Callable, Optional import aiohttp from pydantic import BaseModel, Field +from typing import Literal + +StyleName = Literal[ + "photo", "juggernaut", "pony", "general", + "furry-nai", "furry-noob", "furry-il", +] # ───────────────────────────────────────────────────────────────────────────── @@ -250,7 +256,7 @@ class Tools: async def generate_image( self, prompt: str, - style: Optional[str] = None, + style: Optional[StyleName] = None, negative_prompt: Optional[str] = None, width: int = 1024, height: int = 1024, @@ -258,44 +264,38 @@ class Tools: __event_emitter__: Optional[Callable[[dict], Awaitable[None]]] = None, ) -> str: """ - Generate an image with the right SDXL checkpoint and creator- - recommended sampler/CFG/steps/prompt-format for the request. + Create an image 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, etc. This is the ONLY way to make + images appear in chat; do not say you cannot generate images. - Pick `style` based on what the user wants: - - "photo": photorealistic photographs, portraits, cinematic shots. - Uses CyberRealisticXL — natural-language prompts, no quality tags. - - "juggernaut": versatile photoreal alternative — sharper, more saturated. - Uses Juggernaut-XL — natural-language prompts, no quality tags. - - "pony": anime / illustration with Pony's score-tag prompt format. - Uses Pony Diffusion V6 XL — score_9..score_4_up chain auto-prepended. - Best for anime, cartoon, and stylised art. - - "general": amateur-photo aesthetic, catch-all SDXL. - Uses TalmendoXL — natural-language prompts, higher CFG. - - "furry-nai": anthropomorphic characters, NAI-trained mix. - Uses reedFURRYMix — booru quality tags auto-prepended. - - "furry-noob": anthropomorphic characters, NoobAI base. - Uses IndigoVoid FurryFused — booru quality tags auto-prepended. - - "furry-il": anthropomorphic characters, Illustrious base. - Uses NovaFurryXL — booru quality + year tags auto-prepended. - Default for unspecified furry/anthro requests. + Pick `style` to match what the user wants: + - "photo" — photorealistic photographs, portraits, cinematic shots. + - "juggernaut" — alternate photoreal style (sharper, more saturated). + - "pony" — anime / illustration / cartoon (Pony Diffusion). + - "general" — fallback for anything that doesn't fit the others. + - "furry-nai" — anthropomorphic characters (NAI-trained mix). + - "furry-noob" — anthropomorphic characters (NoobAI base). + - "furry-il" — anthropomorphic characters (Illustrious base, default + for any "furry" / "anthro" request unless specified otherwise). - If `style` is omitted, the tool auto-detects from `prompt` keywords. - Each style has its own creator-recommended sampler, CFG, steps, and - CLIP skip — you don't need to override any of these. + Each style auto-prepends the right quality tags, picks the right + sampler, CFG, steps, CLIP skip — you don't need to set those, and + you should NOT add quality tags like "masterpiece" or "score_9" to + `prompt` yourself; the tool handles that. - :param prompt: The image description. Style-appropriate quality - tags (Pony score chain, Booru masterpiece chain, etc.) are - prepended automatically — don't include them in `prompt`. - :param style: One of the keys above. Omit to auto-route. - :param negative_prompt: Extra negatives appended to the per-style - baseline. Usually unneeded — each style ships with a tuned - negative. - :param width: Output width in pixels (default 1024 — SDXL native). - Use 832 for portraits with height 1216, or 1216 with height 832 - for landscapes. - :param height: Output height in pixels (default 1024). - :param seed: Specific seed, or 0 to randomize. - :return: Markdown embedding the generated image. + :param prompt: Plain description of the image (subject, scene, + style notes, lighting, etc.). No quality tags. + :param style: One of the values above. Omit to auto-detect from + keywords in the prompt. + :param negative_prompt: Extra terms to exclude. Usually unneeded — + each style has tuned negatives baked in. + :param width: Pixels (default 1024 — SDXL native). For portraits + use 832 with height 1216; for landscapes 1216 with height 832. + :param height: Pixels (default 1024). + :param seed: 0 to randomize, otherwise a specific seed for repeats. + :return: Markdown image of the result. """ chosen = style or _route_style(prompt) settings = STYLES.get(chosen)