[PR #5837] [CLOSED] fix(avatars): drop the prose lead sentence for tag-grammar style profiles #6962

Closed
opened 2026-10-23 04:15:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5837
Author: @stonebystone
Created: 9/4/2026
Status: ❌ Closed

Base: staging ← Head: fix/avatar-tag-grammar-lead-prompt


📝 Commits (2)

  • 92ddc27 fix(avatars): drop the prose lead sentence for tag-grammar style profiles
  • b161913 fix(avatars): import the ImageStyleProfile type used by the avatar prompt builder

📊 Changes

4 files changed (+91 additions, -15 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/characters.routes.ts (+18 -15)
➕ packages/server/src/services/image/avatar-generation-prompt.ts (+23 -0)
➕ scripts/regressions/avatar-lead-prompt.regression.ts (+49 -0)

📄 Description

Closes #5836

Why

The avatar "Generate with AI" path has no prompt-writing LLM: it builds a fixed lead sentence and the compiler keeps it verbatim, since avatar prompts are never compacted. With a Danbooru or tag-grammar profile (Illustrious, Pony, NovelAI) that sentence, "Create a polished character avatar portrait for .", becomes a prose clause inside a comma-separated tag prompt. Tag models treat it as noise, and the profile's avatar subject tags already say what the image is.

What changed

  • New services/image/avatar-generation-prompt.ts with a pure buildAvatarPortraitLeadPrompt that picks the lead by prompt grammar: tag grammars get no sentence when the profile has avatar subject tags and a tag-only composition fallback when it has none; natural and hybrid grammars keep the existing sentences unchanged.
  • characters.routes.ts resolves the style profile once per request and passes it to the avatar prompt builder instead of only its subject tags. Character sheets still use their own prompt template and are unaffected.
  • CHANGELOG entry.

Validation

  • pnpm check
  • node scripts/run-regressions.mjs --filter avatar-lead (new regression covering both tag grammars with and without subject tags, both prose grammars, and the blank-name fallback)
  • Manually verify in the browser: with a Danbooru profile, open a character, choose Generate with AI for the avatar, and confirm the review or debug prompt starts with the profile's subject tags followed by the appearance text, with no "Create a polished character avatar portrait" sentence
  • Manually verify the same with a natural-language profile still shows the sentence
  • Manually verify a character sheet generation is unchanged

🤖 Generated with Claude Code

https://claude.ai/code/session_01VGCLPpohNDc1uPX8HcKJ9v

Summary by CodeRabbit

  • Bug Fixes
    • Improved Avatar “Generate with AI” prompts for Danbooru and tag-based style profiles.
    • Avatar prompts now use the profile’s subject tags for composition instead of adding an introductory prose sentence.
    • Added a tag-formatted fallback when tag-based profiles have no subject tags.
    • Prose and hybrid style profiles retain their existing prompt behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5837 **Author:** [@stonebystone](https://github.com/stonebystone) **Created:** 9/4/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `fix/avatar-tag-grammar-lead-prompt` --- ### 📝 Commits (2) - [`92ddc27`](https://github.com/Pasta-Devs/Marinara-Engine/commit/92ddc27416c90103c55335953dcf2cb2c02aa94e) fix(avatars): drop the prose lead sentence for tag-grammar style profiles - [`b161913`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b1619134cee8a9ded562335e1bf74ac947123d2a) fix(avatars): import the ImageStyleProfile type used by the avatar prompt builder ### 📊 Changes **4 files changed** (+91 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/characters.routes.ts` (+18 -15) ➕ `packages/server/src/services/image/avatar-generation-prompt.ts` (+23 -0) ➕ `scripts/regressions/avatar-lead-prompt.regression.ts` (+49 -0) </details> ### 📄 Description Closes #5836 ## Why The avatar "Generate with AI" path has no prompt-writing LLM: it builds a fixed lead sentence and the compiler keeps it verbatim, since avatar prompts are never compacted. With a Danbooru or tag-grammar profile (Illustrious, Pony, NovelAI) that sentence, "Create a polished character avatar portrait for <name>.", becomes a prose clause inside a comma-separated tag prompt. Tag models treat it as noise, and the profile's avatar subject tags already say what the image is. ## What changed - New `services/image/avatar-generation-prompt.ts` with a pure `buildAvatarPortraitLeadPrompt` that picks the lead by prompt grammar: tag grammars get no sentence when the profile has avatar subject tags and a tag-only composition fallback when it has none; natural and hybrid grammars keep the existing sentences unchanged. - `characters.routes.ts` resolves the style profile once per request and passes it to the avatar prompt builder instead of only its subject tags. Character sheets still use their own prompt template and are unaffected. - CHANGELOG entry. ## Validation - [ ] `pnpm check` - [ ] `node scripts/run-regressions.mjs --filter avatar-lead` (new regression covering both tag grammars with and without subject tags, both prose grammars, and the blank-name fallback) - [ ] Manually verify in the browser: with a Danbooru profile, open a character, choose Generate with AI for the avatar, and confirm the review or debug prompt starts with the profile's subject tags followed by the appearance text, with no "Create a polished character avatar portrait" sentence - [ ] Manually verify the same with a natural-language profile still shows the sentence - [ ] Manually verify a character sheet generation is unchanged 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VGCLPpohNDc1uPX8HcKJ9v <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved Avatar “Generate with AI” prompts for Danbooru and tag-based style profiles. - Avatar prompts now use the profile’s subject tags for composition instead of adding an introductory prose sentence. - Added a tag-formatted fallback when tag-based profiles have no subject tags. - Prose and hybrid style profiles retain their existing prompt behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:15:16 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6962
No description provided.