89aae012c6
Under 640px the five wiki sections sit in a fixed bar at the bottom with short
labels, instead of a strip that scrolled off the edge. An alias that names a
shape the character takes ("One Eyed Lich form", "Nodulle's body") is now
refused and cleaned up: it marked the words in the text and cast the base
character's portrait for the other shape.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
468 lines
32 KiB
Python
468 lines
32 KiB
Python
"""Language-model calls and the prompts. Providers (MiniMax through Headroom, Ollama Cloud)
|
|
are tried in the order configured in config.LLM_PROVIDERS; requests with an image go to the
|
|
first provider with a vision model. The scene job and the pre-reader share the rules for
|
|
characters, looks and the glossary, so both record story knowledge the same way."""
|
|
import base64
|
|
import io
|
|
import json
|
|
import sys
|
|
import urllib.request
|
|
|
|
from PIL import Image
|
|
|
|
from config import LLM_PROVIDERS
|
|
|
|
|
|
def _anthropic(provider, system, user, image_b64):
|
|
content = user
|
|
if image_b64:
|
|
content = [{"type": "text", "text": user},
|
|
{"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": image_b64}}]
|
|
body = {"model": provider["vision_model"] if image_b64 else provider["text_model"], "system": system,
|
|
"messages": [{"role": "user", "content": content}],
|
|
# M2.7 reasons before it answers and sometimes uses the whole budget doing it,
|
|
# which came back as max_tokens with no text at all; the ceiling leaves room.
|
|
"max_tokens": provider.get("max_tokens", 32768)}
|
|
if provider.get("think") == "off":
|
|
body["thinking"] = {"type": "disabled"}
|
|
req = urllib.request.Request(provider["url"], json.dumps(body).encode(), {
|
|
"x-api-key": provider["key"], "anthropic-version": "2023-06-01", "Content-Type": "application/json"})
|
|
with urllib.request.urlopen(req, timeout=300) as res:
|
|
response = json.load(res)
|
|
return "\n".join(block["text"] for block in response["content"] if block.get("type") == "text")
|
|
|
|
|
|
def _ollama(provider, system, user, image_b64):
|
|
message = {"role": "user", "content": user}
|
|
if image_b64:
|
|
message["images"] = [image_b64]
|
|
body = {"model": provider["vision_model"] if image_b64 else provider["text_model"], "stream": False,
|
|
"think": provider.get("think", "on") != "off",
|
|
"messages": [{"role": "system", "content": system}, message]}
|
|
req = urllib.request.Request(provider["url"], json.dumps(body).encode(), {
|
|
"Authorization": f"Bearer {provider['key']}", "Content-Type": "application/json"})
|
|
with urllib.request.urlopen(req, timeout=300) as res:
|
|
return json.load(res)["message"]["content"]
|
|
|
|
|
|
APIS = {"anthropic": _anthropic, "ollama": _ollama}
|
|
|
|
|
|
def chat(system, user, image_b64=None, retries=2):
|
|
"""One JSON answer from the first configured provider that gives one; each provider gets
|
|
`retries` extra attempts before the next is tried."""
|
|
candidates = [p for p in LLM_PROVIDERS if not image_b64 or p.get("vision_model")]
|
|
if not candidates:
|
|
raise RuntimeError("no configured LLM provider accepts images")
|
|
for n, provider in enumerate(candidates):
|
|
for attempt in range(retries + 1):
|
|
try:
|
|
answer = APIS[provider["api"]](provider, system, user, image_b64)
|
|
# The model may wrap the JSON in prose; take the outermost object.
|
|
return json.loads(answer[answer.find("{"):answer.rfind("}") + 1])
|
|
except (json.JSONDecodeError, OSError, KeyError, TypeError) as e:
|
|
if attempt < retries:
|
|
continue
|
|
if n == len(candidates) - 1:
|
|
raise
|
|
print(f"LLM provider {provider['name']} failed ({type(e).__name__}: {str(e)[:200]}); "
|
|
f"trying {candidates[n + 1]['name']}", file=sys.stderr)
|
|
|
|
|
|
def image_b64(path, width=832):
|
|
"""A JPEG for the vision model: smaller than the PNG/WebP and universally accepted."""
|
|
with Image.open(path) as im:
|
|
im = im.convert("RGB")
|
|
im.thumbnail((width, width))
|
|
buf = io.BytesIO()
|
|
im.save(buf, "JPEG", quality=85)
|
|
return base64.b64encode(buf.getvalue()).decode()
|
|
|
|
|
|
STYLE_SYSTEM = """You describe the art style of a web-novel cover so an image model can reproduce it.
|
|
This text is appended to EVERY illustration of the novel, so describe only HOW things are drawn:
|
|
medium, brushwork or line work, rendering, colour palette and saturation, how light and shadow
|
|
are treated, texture, mood; max 60 words. Never name subject matter: no characters, creatures,
|
|
landscapes, mountains, skies, weather, buildings, objects, energy, auras, glows, particles,
|
|
petals or other effects, and no title text. Each scene supplies its own content.
|
|
Answer only JSON: {"style": "..."}"""
|
|
|
|
LOOK_RULES = """Looks: known characters are listed with their named looks and the look active before this
|
|
chapter. The story may jump in time (regression loops, flashbacks, reincarnation, time resets),
|
|
so decide from the text how each known character looks at the time THIS chapter takes place.
|
|
In "appearances", list every known character who appears in the chapter text (match them
|
|
by any name, title or alias; the same person is often called "Director Kim" early and by their
|
|
full name later) with "aliases": names or titles this chapter uses for them that are not listed
|
|
yet, and "look": the label of the existing look that matches. An alias is what people call them;
|
|
a shape they take ("lich form", "another person's body") is a look, never an alias.
|
|
|
|
A look is how the character LOOKS to an illustrator, never their power, rank or state. These are
|
|
NOT looks: cultivation breakthroughs, realms and stages, titles and positions, moods, auras and
|
|
techniques, wounds that heal, battle damage, a single outfit, and disguises, illusions or
|
|
avatars used briefly. Create a new look (a new short label plus "description": their full lasting
|
|
appearance, same fields as for new characters, max 60 words) only when their lasting visible
|
|
appearance changes: body, face, apparent age, species or form, a permanent mark or lost limb, a
|
|
lasting change of usual attire. Label looks by appearance ("young, long black hair", "dragon
|
|
form", "one-armed"), not by the event. Alternate forms a character switches between (a dragon's
|
|
human form, a beast or true form) are looks: add each form once and reuse it. After a
|
|
regression or time reset, return to the earlier look. Prefer reusing a look; most characters
|
|
need one to three looks in a whole novel. Set "flashback": true when the look only applies to a
|
|
flashback, dream or vision in this chapter."""
|
|
|
|
CHARACTER_RULE = """Characters are specific individuals the story treats as characters: someone with a proper name,
|
|
or a unique epithet the story consistently uses for one particular person or being ("the fox
|
|
ruling the forest", "the hunchbacked old man"). Never list groups ("Byeok Clan elders",
|
|
"cultivator trio"), one-off people described only by appearance ("a bald tattooed cultivator"),
|
|
translators, editors, or authors of notes and afterwords."""
|
|
|
|
CHARACTER_FIELDS = """"description": their lasting appearance from the text (species, sex, apparent age,
|
|
build, face, hair, eyes, usual clothing, distinguishing marks; max 60 words; invent plausible
|
|
details consistent with the story if the text is silent), "aliases": other names or titles the
|
|
text uses for them, and "role": who they are in the story so far, in one sentence that reveals
|
|
nothing beyond this chapter"""
|
|
|
|
GLOSSARY_RULES = """Glossary: in "terms", list up to five proper names of the story's world from this chapter that a
|
|
reader may need explained later (cultivation realms and stages, sects, clans, techniques,
|
|
artifacts, places) and that are NOT in "Known terms", each with "meaning": one neutral sentence
|
|
based only on the text so far. Skip ordinary words and descriptions ("deep sea", "blood
|
|
corpse"), one-off names, and character names. An empty list is fine.
|
|
|
|
Summary: in "summary", what happens in this chapter in at most three plain sentences."""
|
|
|
|
SCENE_SYSTEM_V1 = f"""You design one illustration for a chapter of a web novel.
|
|
Pick the single most visually striking moment of the chapter that does not spoil its ending.
|
|
|
|
The image model draws anatomy, contact and crowds badly, so compose around its weaknesses without
|
|
turning every illustration into a posed character portrait:
|
|
- At most TWO main figures (a creature counts). Anyone else is optional, far in the background,
|
|
small, at most three, never identical to each other; prefer leaving them out.
|
|
- A scene can be environment-only when the place, scale, aftermath or phenomenon is the point of
|
|
the moment. Do not add a character just to fill the frame. A small figure seen from behind or
|
|
in silhouette can show scale when the text supports it.
|
|
- Choose a natural, story-specific viewpoint instead of defaulting to a centered, front-facing
|
|
portrait: a wide establishing view, high or low angle, over-the-shoulder view, side profile,
|
|
rear view, foreground-framed view, or a closer shot when the emotion warrants it. Vary framing
|
|
between illustrations. Characters look toward the person, object, action or distant view that
|
|
matters in the scene, not toward the viewer unless the text gives a reason.
|
|
- Use a grounded, readable pose that fits the moment. A figure may walk, turn, brace, kneel,
|
|
hold one simple object, or perform one clear action. A bow is held or raised, never drawn
|
|
with a nocked arrow (the model breaks the hands and string). Carry drama with staging,
|
|
body direction, gaze, lighting and setting, not complicated contact. Avoid mid-air poses,
|
|
falling, extreme lunges, twisted torsos, flailing limbs, or limbs/hands pointing at the camera.
|
|
- When a figure matters, specify their body orientation, what they are doing, and where they look;
|
|
do not require a visible face or prescribe relaxed arms when the moment calls for another pose.
|
|
Keep limbs clearly separated from bodies and from each other.
|
|
- No contact between figures and at least an arm's length of empty space between them: no
|
|
grappling, hugging, touching, no hand on a shoulder, no reaching toward each other, and no
|
|
object handed or passed between figures (show it held by one of them). Show the tension
|
|
before the action (a standoff, a stare, a turned back) instead of the action itself.
|
|
- Use a wide or environmental composition for vast places, grand visions, journeys, and moments
|
|
where scale matters. For cultivation or other progression fantasy, the chapter's described
|
|
mountains, halls, skies, formations or other setting can dominate the frame, with characters
|
|
small or absent. Do not invent setting details or effects that the chapter does not support.
|
|
- State the camera viewpoint, the focal point, and the figure's placement only as needed for the
|
|
selected composition. Keep one clear focal point and a readable foreground, middle distance,
|
|
and background when the scene benefits from depth.
|
|
- Restrained gore: at most a few drops or a stain. No text, symbols, speech bubbles or UI.
|
|
|
|
Write the image prompt in this order: framing; main figure(s) with appearance, clothing and
|
|
pose; secondary element; setting; lighting. Max 100 words. Ignore translator notes, links and
|
|
author comments.
|
|
|
|
"anchor": 6 to 12 consecutive words copied EXACTLY (same spelling and punctuation) from one
|
|
sentence of the chapter text where the chosen moment happens; the image is placed there.
|
|
|
|
{LOOK_RULES} For a character who is drawn, use the look they have in the illustrated moment.
|
|
|
|
Named characters: when a character with a proper name in the story is drawn, write [[Name]]
|
|
where that figure is introduced, using the canonical name from "Known characters" when it is
|
|
the same person (match aliases too), then describe only pose and expression for them, not their
|
|
looks. List every [[Name]] you used in "characters". List in "distant" every [[Name]] drawn
|
|
small, far away, from behind or in silhouette: they get no reference portrait, which the image
|
|
model would otherwise paste in large as an extra figure. For a character NOT in "Known characters",
|
|
also give {CHARACTER_FIELDS}. {CHARACTER_RULE} Unnamed extras and creatures are described
|
|
inline, never listed, and never written as [[...]].
|
|
|
|
{GLOSSARY_RULES}
|
|
Answer only JSON: {{"moment": "one sentence", "anchor": "...", "prompt": "...",
|
|
"characters": [{{"name": "...", "aliases": ["..."], "role": "...", "description": "..."}}],
|
|
"distant": ["..."],
|
|
"appearances": [{{"name": "...", "aliases": [], "look": "...", "description": "only for a new look", "flashback": false}}],
|
|
"terms": [{{"term": "...", "meaning": "..."}}], "summary": "..."}}"""
|
|
|
|
SCENE_SYSTEM_V2 = f"""You design one illustration for a chapter of a web novel, staged like a page of a top
|
|
action manhwa or comic. Pick the single most visually striking moment of the chapter that does not
|
|
spoil its ending.
|
|
|
|
Hard rules (the image model draws these badly):
|
|
- At most TWO main figures (a creature counts). Anyone else is optional, small and far in the
|
|
background, at most three, never identical to each other; prefer leaving them out.
|
|
- No contact between figures: no grappling, hugging, biting, touching, no blades meeting or
|
|
striking a body. Show the instant before or after (a drawn blade, a reaching hand, a stare-down,
|
|
a recoil) with a visible gap between figures.
|
|
- Keep limbs clearly separated from the body and from each other. Hands simple and readable, or
|
|
hidden behind an object. No limb pointing at the camera, no tumbling, falling, flailing or
|
|
extreme torso twists.
|
|
- Never a lineup: no three or more figures standing side by side facing the viewer, and no two
|
|
figures both facing the camera. Stagger figures at different depths and different angles.
|
|
- Restrained gore: at most a few drops or a stain. No text, symbols, speech bubbles or UI.
|
|
|
|
Staging, which is what makes an illustration dynamic:
|
|
- Name the shot first, chosen to fit the moment and varied between illustrations: low-angle hero
|
|
shot, high-angle shot, over-the-shoulder, medium close-up, side profile, rear three-quarter view,
|
|
wide establishing shot, or a foreground-framed view (through a doorway, branches, a shoulder).
|
|
- Renderable poses to choose from: weight shifted onto one leg, mid-stride with the back heel
|
|
lifted, three-quarter turn, looking back over a shoulder, crouched ready stance with a hand near a
|
|
weapon, kneeling on one knee, leaning on a wall or railing, slumped sitting, drawing a blade from
|
|
its sheath, a weapon held low and angled with a clear silhouette, a raised forearm shielding the
|
|
face, bracing behind a shield, reaching toward something out of reach.
|
|
- For every main figure write exactly one action verb + body direction + gaze target, for example
|
|
"steps forward on the left foot, body turned three-quarters left, eyes on the knight's raised
|
|
sword". Gaze goes to the person, object or event that matters, not to the viewer, unless the
|
|
text gives a reason.
|
|
- Carry the drama with the camera angle, a strong silhouette, diagonal lines, light and setting
|
|
rather than with complicated contact.
|
|
- A scene can be environment-only, or have tiny figures, when the place, scale, aftermath or
|
|
phenomenon is the point (vast places, grand visions, journeys, progression-fantasy mountains,
|
|
halls, skies). Do not add a character just to fill the frame, and do not invent setting details
|
|
or effects the chapter does not support.
|
|
- One clear focal point, with a readable foreground, middle distance and background when depth helps.
|
|
|
|
Write the image prompt in this order: shot and camera angle; main figure(s) with appearance,
|
|
clothing and their action verb + body direction + gaze; secondary element; setting; lighting.
|
|
Max 110 words. Ignore translator notes, links and author comments.
|
|
|
|
"anchor": 6 to 12 consecutive words copied EXACTLY (same spelling and punctuation) from one
|
|
sentence of the chapter text where the chosen moment happens; the image is placed there.
|
|
|
|
{LOOK_RULES} For a character who is drawn, use the look they have in the illustrated moment.
|
|
|
|
Named characters: when a character with a proper name in the story is drawn, write [[Name]]
|
|
where that figure is introduced, using the canonical name from "Known characters" when it is
|
|
the same person (match aliases too), then describe only pose and expression for them, not their
|
|
looks. List every [[Name]] you used in "characters". For a character NOT in "Known characters",
|
|
also give {CHARACTER_FIELDS}. {CHARACTER_RULE} Unnamed extras and creatures are described
|
|
inline, never listed, and never written as [[...]].
|
|
|
|
{GLOSSARY_RULES}
|
|
Answer only JSON: {{"moment": "one sentence", "anchor": "...", "prompt": "...",
|
|
"characters": [{{"name": "...", "aliases": ["..."], "role": "...", "description": "..."}}],
|
|
"appearances": [{{"name": "...", "aliases": [], "look": "...", "description": "only for a new look", "flashback": false}}],
|
|
"terms": [{{"term": "...", "meaning": "..."}}], "summary": "..."}}"""
|
|
|
|
SCENE_SYSTEM = SCENE_SYSTEM_V1 # switched to SCENE_SYSTEM_V2 only if docs/research/bench supports it
|
|
|
|
INDEX_SYSTEM = f"""You read a web novel chapter by chapter and keep its character list and glossary up to date,
|
|
for a reader who sees only what they have already read.
|
|
|
|
New characters: in "characters", list every named character who appears in this chapter (on
|
|
page, not only mentioned in passing) and is NOT in "Known characters", with {CHARACTER_FIELDS}.
|
|
{CHARACTER_RULE}
|
|
Skip characters already known under any name, title or alias: "Director Kim" and
|
|
"Kim Young-hoon" are the same person when the text says so or the context makes it clear.
|
|
|
|
{LOOK_RULES}
|
|
|
|
{GLOSSARY_RULES}
|
|
|
|
Illustration value: "visual" rates from 1 to 10 how much this chapter deserves an illustration:
|
|
10 for a major transformation or new form, the first appearance of an important character or
|
|
creature, a climactic confrontation or a breathtaking new place; 1 for talk, travel or training
|
|
with nothing new to see. Most chapters are 2 to 5. "key_moment": that moment in one sentence.
|
|
Answer only JSON: {{"visual": 5, "key_moment": "...", "characters": [{{"name": "...", "aliases": ["..."], "role": "...", "description": "..."}}],
|
|
"appearances": [{{"name": "...", "aliases": [], "look": "...", "description": "only for a new look", "flashback": false}}],
|
|
"terms": [{{"term": "...", "meaning": "..."}}], "summary": "..."}}"""
|
|
|
|
PORTRAIT_PROMPT = """Character reference image of one single character: full body from head to
|
|
toe, standing in a relaxed neutral pose, facing the viewer at a slight three-quarter angle, arms
|
|
relaxed at the sides, hands visible and simple, calm expression, centered, on a simple softly tinted
|
|
background of one flat muted colour that suits the character (no scenery, no props, no floor
|
|
pattern), even soft lighting, no other figures, no text. {description} Art style: {style}"""
|
|
|
|
# Animals and creatures: no word about arms, hands or posture of a person, which turned a colt
|
|
# into a horse-headed man in a shirt.
|
|
CREATURE_PORTRAIT_PROMPT = """Reference image of one single animal or creature, its whole body visible
|
|
in profile at a slight three-quarter angle: {description} True to its own anatomy, standing calmly on
|
|
all of its own legs in its natural stance, without clothing or any human features unless described.
|
|
Centered, on a simple softly tinted background of one flat muted colour (no scenery, no props, no floor
|
|
pattern), even soft lighting, no other figures, no text. Art style: {style}"""
|
|
|
|
BODY_SYSTEM = """Decide how to draw a story character's reference picture from its description.
|
|
"person": a human or a humanoid that stands upright with arms and hands (elves, dwarves, orcs,
|
|
undead knights, liches, anthropomorphic beings). "creature": an animal or any being without a
|
|
person's upright body (horses, dragons, wolves, birds, griffons, slimes, giant insects).
|
|
Answer only JSON: {"body": "person"} or {"body": "creature"}"""
|
|
|
|
FEATURES_SYSTEM = """Describe the character in this reference image so an artist can redraw them
|
|
consistently: species, sex, apparent age, build, face, hair, eyes, skin or fur, clothing,
|
|
accessories, distinguishing marks. Max 60 words, concrete visual facts only. Describe only the
|
|
character itself: ignore the background, lighting, auras, energy and other effects around them.
|
|
Answer only JSON: {"description": "..."}"""
|
|
|
|
QA_SYSTEM = """You inspect a generated illustration for defects before a reader sees it.
|
|
You get the scene description the image was made from. Reject the image ("ok": false) only for
|
|
clear defects: a figure that is duplicated or cloned; bodies merged or fused together; a human
|
|
with animal or creature parts (or a creature with human parts) that the description does not
|
|
call for; extra, missing or badly twisted limbs; a clearly malformed face or hand in the
|
|
foreground; more main figures than described; visible text, letters or watermarks. Painterly
|
|
roughness, loose brushwork and unclear small background details are fine.
|
|
Answer only JSON: {"ok": true, "problems": ["short description of each defect"]}"""
|
|
|
|
RECAP_SYSTEM = """You write a short "previously on" recap for a reader returning to a web novel after a break.
|
|
Using only the chapter summaries given (in order), recap the most recent events in 4 to 6 plain
|
|
sentences (at most 120 words), most important threads first, ending where the summaries end. Never add anything that
|
|
is not in the summaries. Answer only JSON: {"recap": "..."}"""
|
|
|
|
# ---- interstitials -------------------------------------------------------------
|
|
# One wide establishing shot where the story moves somewhere new, printed between the
|
|
# chapters the way a comic prints a full-page spread at the end of an arc.
|
|
|
|
SPLASH_SYSTEM = """You paint one wide establishing shot for a web novel: the page a comic book
|
|
prints between two arcs, showing where the story has arrived.
|
|
|
|
The place is the subject, not the people:
|
|
- One wide or panoramic view of the setting, from a viewpoint that shows its scale: a ridge
|
|
above a valley, a street seen down its length, a hall from the back of a crowd, a shore from
|
|
the water. Nothing fills the frame edge to edge with a face.
|
|
- At most one figure, small and seen from behind, in silhouette or at a distance, to show the
|
|
scale of the place, and only when the text supports it. Never a close-up, never a portrait.
|
|
- Describe the place with what the text actually says about it: the buildings, ground, sky,
|
|
weather, distance, light, and the sense of size. Do not invent landmarks, banners, monsters
|
|
or weather the text does not mention.
|
|
- Warm, lived-in and specific rather than grand and empty. No text, symbols, speech bubbles,
|
|
borders or panels.
|
|
- No named character is drawn, so no reference images are used and no [[Name]] appears.
|
|
|
|
Write the image prompt in this order: framing and viewpoint; the place in the middle distance;
|
|
the foreground; the sky and light. Max 100 words. Ignore translator notes, links and author
|
|
comments.
|
|
|
|
"moment": one sentence saying what place this is, as a caption for the picture.
|
|
"anchor": 6 to 12 consecutive words copied EXACTLY (same spelling and punctuation) from one
|
|
sentence of the chapter text that describes the place; the image is placed there.
|
|
Answer only JSON: {"moment": "one sentence", "anchor": "...", "prompt": "..."}"""
|
|
|
|
# A place inside the chapter rather than a spread between two: same rules about the subject,
|
|
# but the shot belongs to the moment the text describes it, and it must not repeat the others.
|
|
SCENERY_SYSTEM = SPLASH_SYSTEM.replace(
|
|
"""You paint one wide establishing shot for a web novel: the page a comic book
|
|
prints between two arcs, showing where the story has arrived.""",
|
|
"""You paint one place-only picture for a chapter of a web novel: the panel a comic
|
|
book cuts to for the setting, the weather or an object before the scene goes on. Pick a
|
|
place, weather, object or atmosphere the chapter text actually describes.""").replace(
|
|
"""- At most one figure, small and seen from behind, in silhouette or at a distance, to show the
|
|
scale of the place, and only when the text supports it. Never a close-up, never a portrait.""",
|
|
"""- Leave the people out. Whatever the characters are doing in the text, paint the place they
|
|
are in without them: no guards, no crowds, no one carving or fighting. At most one tiny
|
|
figure far away, in silhouette from behind, and often none. No face is ever visible, and no
|
|
two figures are alike. Never a close-up, never a portrait.""")
|
|
assert "Leave the people out" not in SPLASH_SYSTEM
|
|
|
|
ARC_SYSTEM = """You are the art editor of a web-novel reader. You see the summaries of the
|
|
chapters of one book, in order, each labelled with its chapter number, and you choose where a
|
|
wide establishing illustration belongs: the page a comic prints between two arcs, showing the
|
|
place the story has just arrived at.
|
|
|
|
Choose a chapter when the story visibly changes place or opens a new stretch of its own:
|
|
- a journey arriving somewhere (a village, a city, a capital, a fortress, a dungeon, an island);
|
|
- a new region, kingdom or continent the party enters;
|
|
- the first chapter of a new arc, a new tournament, war, hunt or trial;
|
|
- a place first shown that the story then stays in for a while.
|
|
Do NOT choose a chapter that stays where the last one was, however eventful it is, and do not
|
|
choose two chapters close together: at most one every 4 chapters, and never in the first 2
|
|
chapters given. Prefer a place over an event.
|
|
|
|
Answer only JSON: {"chapters": [chapter numbers, in order, each given in the input]}"""
|
|
|
|
REDRAW_SYSTEM = """You update a character's appearance description for an illustrator.
|
|
Apply the reader's correction to the current description and return the full corrected
|
|
description (species, sex, apparent age, build, face, hair, eyes, usual clothing, distinguishing
|
|
marks; max 60 words). The correction wins wherever it conflicts.
|
|
Answer only JSON: {"description": "..."}"""
|
|
|
|
CONSOLIDATE_SYSTEM = """You tidy a web-novel character's list of looks for an illustrator. Many entries were
|
|
recorded wrongly: power levels, realms, titles, injuries, one-off outfits, brief disguises or
|
|
avatars. A look is only how the character LOOKS: body, face, apparent age, species or form,
|
|
permanent marks, lasting usual attire. Group the given looks (listed with the chapter each was
|
|
first used) into as few real looks as the descriptions justify, usually one to four. Every given
|
|
label must belong to exactly one group. Give each group a short appearance-based "label" and a
|
|
"description" of that lasting appearance (max 60 words: species, sex, apparent age, build, face,
|
|
hair, eyes, usual clothing, distinguishing marks).
|
|
Answer only JSON: {"looks": [{"label": "...", "description": "...", "members": ["old label", "..."]}]}"""
|
|
|
|
PRUNE_SYSTEM = """You clean a web novel's character list. Return the entries that are NOT one specific individual:
|
|
groups ("Byeok Clan elders", "cultivator trio"), one-off people described only by appearance
|
|
or role ("bald tattooed cultivator", "Corpse-like man"), translators, editors and authors of notes
|
|
(e.g. "BlueMangoAde", "TranslatingNovice"), and entries that are not characters at all. Keep
|
|
anyone with a proper name, and beings the story refers to by a unique epithet ("the fox",
|
|
"Black Dragon King", "the hunchbacked old man"); a script keeps recurring ones anyway.
|
|
Answer only JSON: {"remove": ["exact name as given", "..."]}"""
|
|
|
|
DUPLICATE_SYSTEM = """You check a web novel's cast list for people recorded twice. You get one
|
|
entry per line as "name (chapters it appears in): the description recorded for it". Group the
|
|
entries that are the SAME individual written differently: transliteration or word-order variants
|
|
of one name ("Jong-bum Choi" / "Choi Jong Bom"), a name with a title or epithet attached ("Rok
|
|
Elder" / "Elder Rok"), a shortened form ("Karichwi" / "Karichwi the Elder"), a name and the name
|
|
the story later gives them after they are revealed.
|
|
|
|
Never group: a father and a son, or any two people who only share a surname; a person and a place,
|
|
a building, a clan, a group, a title on its own ("Elder", "Emperor", "the High Priest"); an animal
|
|
or monster of a species with the individual ("Wy" / "Wy-3"); two people merely similar-looking.
|
|
When in doubt, leave the names apart: a wrongly merged character loses their own face and history.
|
|
Answer only JSON: {"groups": [["name as given", "other name as given"], ...]} with every name
|
|
copied exactly from the input. Leave out every name that stands alone."""
|
|
|
|
LOOK_SYSTEM = """You match a character's lost look label to the looks that are still on file for them.
|
|
You get the lost label and the remaining looks, one per line as "label: the description recorded
|
|
for it". Answer with the ONE label that describes the same appearance: the lost label is usually
|
|
the same words written differently ("White-flame Chaos Warrior" against "Chaos Warrior form"), or
|
|
the same person's usual form named again ("Lee Hyun base form" against the description of a lean
|
|
twenty-year-old Korean man).
|
|
|
|
Answer "" if none of them is the same appearance, rather than the closest one. Two different
|
|
forms of one person are not interchangeable: a lich, a dragon and the man he was are three looks,
|
|
and sending one chapter's worth of drawings to another's description ruins both.
|
|
Answer only JSON: {"look": "label as given", "why": "one short sentence"}"""
|
|
|
|
STYLE_OPTIONS_SYSTEM = """You are an art director choosing an illustration style for a web novel from a fixed
|
|
library of presets. You get the novel's title, genres, current style, some chapter summaries, and the
|
|
preset list, one per line as "id | name | family | inspired_by".
|
|
Pick the THREE presets that fit the novel's genre, tone and setting best. They must be clearly different
|
|
from each other (different families or looks), and none may equal the current style. Choose by how a preset
|
|
is drawn (line work, rendering, palette, lighting, mood) against what the story needs: for example gritty
|
|
inked looks for grim martial or horror stories, bright cel looks for comedic action, painterly or watercolour
|
|
looks for quiet, epic or pastoral fantasy, clean line looks for adventure. Use ids exactly as listed; never
|
|
invent one. For each give "why": one concrete sentence tying the look to this story. "tweak" is optional: a
|
|
short extra phrase (at most 15 words) describing only HOW things are drawn (palette, lighting, texture), or an
|
|
empty string; never subject matter, characters, objects or effects.
|
|
Answer only JSON: {"options": [{"id": "...", "why": "...", "tweak": ""}, {"id": "...", "why": "...", "tweak": ""},
|
|
{"id": "...", "why": "...", "tweak": ""}]} with exactly three entries."""
|
|
|
|
FEEDBACK_SYSTEM = """You triage a reader's feedback on an illustrated web-novel reader and pick at most one fix.
|
|
You get the feedback, what it is about (an illustration, a character card, a glossary term, or the app in
|
|
general) and the facts the reader saw. Choose the single action that best addresses it, only when the
|
|
feedback clearly asks for it and the needed details are in the facts; never invent names, looks or terms:
|
|
- "repaint": the illustration is wrong (wrong look, pose, setting, mood, a defect, a misread moment).
|
|
"fix" is a precise instruction for the painter, in the reader's sense, e.g. "Kim has short black hair,
|
|
not long white hair". Only for feedback about an illustration.
|
|
- "redraw_portrait": a character's portrait or look is wrong. "name" and "label" must be one of the
|
|
character's looks in the facts; "hint" describes the correction.
|
|
- "edit_character": a character's name, role or aliases are wrong. "name" must exist; give only the
|
|
fields to change: "new_name", "role", "add_aliases" (a list).
|
|
- "merge": two entries are the same person. "name" is the duplicate, "into" the entry to keep; both must exist.
|
|
- "edit_term": a glossary meaning is wrong. "term" must exist; "meaning" is the corrected meaning.
|
|
- "none": anything else (a bug, an idea, praise, unclear or unsafe requests). Someone will review it.
|
|
"reply" is one short, friendly sentence to the reader saying what will happen.
|
|
Answer only JSON: {"action": "...", "fix": "", "name": "", "label": "", "hint": "", "new_name": "",
|
|
"role": "", "add_aliases": [], "into": "", "term": "", "meaning": "", "reply": "..."}"""
|
|
|
|
REVISE_SYSTEM = """You revise an image-generation prompt for a web-novel illustration after reader feedback.
|
|
Keep everything that is not affected (moment, setting, characters, camera, style rules) and change only
|
|
what the feedback asks for, stated positively and concretely. Keep any wording about reference images and
|
|
placeholders exactly as it is.
|
|
Also decide whether the fix is "local": it changes only details of the existing picture (an object, a
|
|
weapon, a hand, an expression, a piece of clothing, a colour, removing one item) without moving, adding or
|
|
removing figures and without changing the camera or the moment. For a local fix write "edit": one
|
|
instruction for an image editor saying exactly what to change in the picture, concretely; otherwise "".
|
|
Answer only JSON: {"prompt": "...", "local": true, "edit": "..."}"""
|