[PR #3950] [MERGED] Fix Roleplay Gallery Animate narration source #6173

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3950
Author: @thetopham
Created: 7/22/2026
Status: ✅ Merged
Merged: 7/22/2026
Merged by: @SpicyMarinara

Base: staging ← Head: dev/fix-roleplay-gallery-narration-source


📝 Commits (3)

  • d095483 Fix gallery animation narration source
  • 470810c Merge branch 'staging' into dev/fix-roleplay-gallery-narration-source
  • 62d30a3 Address gallery narration review feedback

📊 Changes

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

View changed files

📝 packages/server/src/routes/gallery.routes.ts (+8 -15)
📝 packages/server/src/services/storage/chats.storage.ts (+12 -0)
📝 packages/server/src/services/video/prompt-context.ts (+69 -0)
📝 scripts/regressions/prompt.regression.ts (+64 -0)

📄 Description

Linked issue

Closes #3949

Why this change

  • Animating an older Roleplay Gallery image currently uses narration from the latest assistant turn, even when the selected image belongs to an earlier message or swipe.
  • Once the conversation has moved to another scene, that mismatch gives the video model unrelated motion and action direction for the selected first frame.

What changed

  • Resolve gallery animation narration from the swipe attachment whose galleryId matches the selected image, then from the matching active message attachment.
  • Add a batched swipe lookup so Gallery Animate can inspect all source swipe metadata with one file-store scan.
  • Preserve the existing latest-assistant-message fallback for legacy gallery images without source attachment metadata, while excluding later system and narrator events.
  • Document why the file-native store uses one table scan plus Set membership instead of chunked inArray queries.
  • Add focused regression coverage for swipe sources, active-message sources, malformed metadata, non-assistant events, and legacy fallback behavior.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Automated checks completed:

  • pnpm check — blocked before lint/build because the Impeccable context loader did not return valid JSON.
  • pnpm lint — passed.
  • pnpm build — passed.
  • pnpm regression:prompt — passed, including the new selected-image narration-source regression.
  • git diff --check — passed.

Manual browser verification still required:

  • Animate an older Roleplay Gallery image after the conversation moves to a later scene and confirm the prompt uses the selected image's source narration.
  • Verify both active-message and inactive-swipe image sources.
  • Verify a legacy upload without source metadata still uses the latest assistant narration fallback.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No documentation or version metadata changed.

UI evidence (if applicable)

No screenshots included. This changes server-side prompt-source selection; the manual browser checks above remain for a human contributor.


🔄 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/3950 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 7/22/2026 **Status:** ✅ Merged **Merged:** 7/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `dev/fix-roleplay-gallery-narration-source` --- ### 📝 Commits (3) - [`d095483`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d0954833994b8e31e65e94b7ff4c91e400c2898e) Fix gallery animation narration source - [`470810c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/470810c5119fc83624183adf72c47ab87c31774d) Merge branch 'staging' into dev/fix-roleplay-gallery-narration-source - [`62d30a3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/62d30a395da66d74af796a5a8c09ecbaa9c8d208) Address gallery narration review feedback ### 📊 Changes **4 files changed** (+153 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/gallery.routes.ts` (+8 -15) 📝 `packages/server/src/services/storage/chats.storage.ts` (+12 -0) 📝 `packages/server/src/services/video/prompt-context.ts` (+69 -0) 📝 `scripts/regressions/prompt.regression.ts` (+64 -0) </details> ### 📄 Description ## Linked issue Closes #3949 ## Why this change - Animating an older Roleplay Gallery image currently uses narration from the latest assistant turn, even when the selected image belongs to an earlier message or swipe. - Once the conversation has moved to another scene, that mismatch gives the video model unrelated motion and action direction for the selected first frame. ## What changed - Resolve gallery animation narration from the swipe attachment whose `galleryId` matches the selected image, then from the matching active message attachment. - Add a batched swipe lookup so Gallery Animate can inspect all source swipe metadata with one file-store scan. - Preserve the existing latest-assistant-message fallback for legacy gallery images without source attachment metadata, while excluding later system and narrator events. - Document why the file-native store uses one table scan plus `Set` membership instead of chunked `inArray` queries. - Add focused regression coverage for swipe sources, active-message sources, malformed metadata, non-assistant events, and legacy fallback behavior. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Automated checks completed: - `pnpm check` — blocked before lint/build because the Impeccable context loader did not return valid JSON. - `pnpm lint` — passed. - `pnpm build` — passed. - `pnpm regression:prompt` — passed, including the new selected-image narration-source regression. - `git diff --check` — passed. Manual browser verification still required: - Animate an older Roleplay Gallery image after the conversation moves to a later scene and confirm the prompt uses the selected image's source narration. - Verify both active-message and inactive-swipe image sources. - Verify a legacy upload without source metadata still uses the latest assistant narration fallback. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No documentation or version metadata changed. ## UI evidence (if applicable) No screenshots included. This changes server-side prompt-source selection; the manual browser checks above remain for a human contributor. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:07:48 +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#6173
No description provided.