Repository navigation
Keep character identity consistent in expressions and AI writing - #3
Merged
Merged
Conversation
Reviewer's GuideThe PR makes character identity and writing context explicit: expressions use the selected portrait through a required face adapter with no unconditioned fallback, while AI edits use persisted per-field context selections and priority voice direction; UI controls, deletion/Undo flows, documentation, and verification coverage were updated accordingly. Sequence diagram for identity-preserving expression generationsequenceDiagram
participant Author
participant PicturesUI
participant paintSprites
participant ComfyUI
participant Project
Author->>PicturesUI: Generate one expression
PicturesUI->>paintSprites: paintSprites(reference, identity, labels)
paintSprites->>ComfyUI: buildIdentityExpression(reference, adapter)
ComfyUI-->>paintSprites: Generated expression or adapter error
alt generation succeeds
paintSprites->>Project: saveCharacterPicture(referenceMediaId, method)
Project-->>PicturesUI: Saved expression
else adapter or model failure
paintSprites-->>PicturesUI: Error, stop without fallback
end
Sequence diagram for priority voice direction in AI writingsequenceDiagram
participant Author
participant VoiceEditor
participant AIPipeline
participant WritingTask
participant CharacterCard
Author->>VoiceEditor: Set voiceDirection
VoiceEditor->>CharacterCard: Save voiceDirection outside card export
Author->>AIPipeline: Generate dialogue or opening
AIPipeline->>CharacterCard: Read voiceDirection and selected context
AIPipeline->>WritingTask: Build task with voiceInstruction(voiceDirection)
WritingTask-->>AIPipeline: Voice-prioritized generated text
AIPipeline-->>Author: Apply or review generated result
Flow diagram for explicit AI writing contextflowchart TD
A[Author opens Ask AI] --> B[Select earlier fields]
B --> C[Persist choices per character and target field]
C --> D[selectedContextFields]
D --> E[fieldContextText]
E --> F[Include full selected earlier fields]
F --> G[Include current field and author instruction]
G --> H[Exclude unchecked and later fields]
H --> I[Generate rewrite, additive edit, or 3 takes]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved writing and layout issues, together with unvalidated real-backend FaceID generation, require fixes and human verification.
2 open issues
1 file not reviewed
src/ui/guide.js: Generated file
What changed in this PR
This PR strengthens character consistency in expression generation and AI-assisted writing.
Changes:
- Conditions expressions on the selected portrait, with adapter selection and failure feedback.
- Adds persistent field-context choices and priority voice guidance.
- Adds direct deletion controls and updates documentation and tests.
| File | Description |
|---|---|
| tests/field-context.test.js | Tests context selection, persistence, and voice guidance. |
| tests/comfy.test.js | Tests adapter workflows and failure handling. |
| style.css | Styles context, expression, and deletion controls. |
| src/ui/media.js | Saves expression reference metadata. |
| src/ui/image-setup.js | Updates adapter setup guidance. |
| src/ui/guide.js | Updates in-app help. |
| src/ui/field-context.js | Adds context controls and current-value retrieval. |
| src/ui/deletion.js | Adds picture and character deletion buttons. |
| src/ui/character-pictures.js | Adds portrait-conditioned expression controls. |
| src/ui/areas/media.js | Adds direct library deletion controls. |
| src/ui/areas/characters.js | Integrates context selection and voice direction. |
| src/ui/ai-assist.js | Preserves typed instructions in quick directions. |
| src/st/comfy.js | Runs identity-conditioned expression jobs. |
| src/core/field-context.js | Defines field order and context filtering. |
| src/core/comfy.js | Builds face-adapter expression workflows. |
| src/ai/tasks.js | Incorporates selected context and voice guidance. |
| src/ai/pipeline.js | Passes writing preferences into generation steps. |
| README.md | Documents updated workflows. |
| docs/STATUS.md | Records validation results and limitations. |
| docs/QUICKSTART.md | Explains the new controls. |
Review effort: Balanced
| // Filling gaps in an existing card: ask only for what is empty instead of rewriting everything and discarding it. | ||
| const gaps = s.fillOnly ? CORE_CARD_FIELDS.filter(k => (Array.isArray(card?.data[k]) ? !card.data[k].length : !String(card?.data[k] ?? '').trim())) : []; | ||
| return { concept: { ...s.concept, story: brief(s) }, card, style: styleFrom(dials), ...(gaps.length ? { only: gaps } : {}) }; | ||
| return { concept: { ...s.concept, story: brief(s) }, card, voiceDirection: char(p, s)?.voiceDirection, style: styleFrom(dials), ...(gaps.length ? { only: gaps } : {}) }; |
| ${!gallery.length && html`<p class="cs-muted">Your generated and uploaded pictures will appear here.</p>`} | ||
| <div class="cs-gallery">${[...gallery].reverse().map(m => html`<figure key=${m.id} class="cs-gallery-item"> | ||
| <a href=${m.url} target="_blank" rel="noopener"><img src=${m.url} alt=${m.name} title=${m.prompt ?? m.name} loading="lazy" /></a> | ||
| <figcaption>${m.purpose ?? ''} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Character expressions could repaint an unrelated person, and field edits received a shortened whole-card digest with no control over which details influenced the result. This update makes the reference and writing context explicit.
Validation: 181 tests pass. Local SillyTavern at 127.0.0.1:8123 was checked at 1440x1000 and 390x844 with no browser exceptions or horizontal overflow. Real ComfyUI joy/anger jobs used Plus Face and retained the reference's hair, clothing and pose; mood changes were subtle. Background removal was disabled for those jobs. FaceID generation was not run because its matching LoRA was absent; a mocked model failure verified the stop/error path. Writing requests were captured with mocked model replies to verify context exclusions, voice priority, additive edits, three takes and alternate openings. Preferences survived reload. Deletion/cancellation/Undo were exercised, temporary fixtures were removed and original local project data/settings restored. No remote SillyTavern instance was used.
Summary by Sourcery
Keep character identity and writing context consistent by conditioning expressions on the selected portrait and making AI field context and voice direction explicit.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: