[PR #3186] [MERGED] [codex] Fix lorebook revectorization and scene streaming polish #5834

Closed
opened 2026-10-22 04:19:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: codex/smooth-roleplay-typewriter


📝 Commits (6)

  • 08f461b Fix lorebook revectorization and scene streaming polish
  • 4832028 Theme music players for light mode
  • 0881a0c Merge branch 'staging' into codex/smooth-roleplay-typewriter
  • 2ca68e0 Recover mobile backgrounded generations
  • dda26b0 Open chats at latest message
  • 2a9ac3f Address CodeRabbit review for PR 3186

📊 Changes

13 files changed (+274 additions, -73 deletions)

View changed files

📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+1 -1)
📝 packages/client/src/components/chat/ConversationView.tsx (+45 -4)
📝 packages/client/src/components/chat/LocalMusicPlayer.tsx (+15 -12)
📝 packages/client/src/components/chat/YouTubePlayer.tsx (+16 -13)
📝 packages/client/src/components/lorebooks/LorebookEditor.tsx (+55 -14)
📝 packages/client/src/components/music/MusicSourceButton.tsx (+1 -1)
📝 packages/client/src/components/spotify/SpotifyMiniPlayer.tsx (+14 -13)
📝 packages/client/src/hooks/use-generate.ts (+75 -6)
📝 packages/client/src/styles/globals.css (+31 -3)
📝 packages/server/src/routes/generate.routes.ts (+15 -2)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+2 -2)
📝 packages/server/src/routes/lorebooks.routes.ts (+1 -1)
📝 packages/server/src/routes/scene.routes.ts (+3 -1)

📄 Description

Why

Closes #3182.
Closes #3185.

Changing embedding models can leave existing lorebook vectors with dimensions that do not match newly generated vectors. The server already rejects missing-only vectorization in that state, but the editor did not expose a direct way to re-vectorize every entry.

Mobile browsers can also suspend or cut the generation stream when the user switches apps. In Roleplay mode that passive disconnect aborted the server-side generation and surfaced a network error when the user returned.

Restored chats should reopen at the latest visible message instead of landing at the top of the loaded history window.

What Changed

  • Added an explicit Re-vectorize all action when a lorebook has both stored vectors and entries missing vectors.
  • Kept missing-only vectorization available for the normal “new entries added” case, with separate loading states for each vectorization mode.
  • Updated the server dimension-mismatch error to point users at the new re-vectorize-all action.
  • Smoothed Roleplay typewriter streaming by capping per-frame reveals and resetting stale paint timing between bursts.
  • Made conversation-created scene chats start with None for prompt preset so generated scene instructions do not clash with inherited presets.
  • Themed Spotify, YouTube, and Custom Music players through shared light/dark music-player tokens.
  • Improved light-mode visibility for mini-player buttons, icon controls, tiles, progress tracks, and volume thumb outlines.
  • Let normal chat generations continue server-side after passive client disconnects, while explicit impersonation disconnects still abort.
  • Added /api/generate/status/:chatId so the client can recover from mobile background stream drops by waiting for the server generation to finish, then refreshing messages without showing a false network error.
  • Restored conversation and roleplay chats to the latest rendered message on initial open while preserving load-older scroll behavior.

Validation

  • git diff --check
  • pnpm --filter @marinara-engine/server lint
  • pnpm --filter @marinara-engine/client lint
  • pnpm --filter @marinara-engine/client build
  • pnpm check
  • After rebasing on the updated PR branch: pnpm --filter @marinara-engine/server lint
  • After rebasing on the updated PR branch: pnpm --filter @marinara-engine/client lint

Manual Verification Needed

  • Manually verify changing an embedding model on a partially vectorized lorebook offers and completes Re-vectorize all.
  • Manually verify Roleplay streaming still feels smooth with streaming speed set around 30.
  • Manually verify chats created from a conversation scene show prompt preset None.
  • Manually verify Spotify, YouTube, and Custom Music mini players in both light and dark mode.
  • Manually verify on mobile: send a Roleplay message, switch apps while it generates, return, and confirm the reply appears without a network-error toast.
  • Manually verify reopening ME on a previously active conversation or roleplay chat starts at the latest message, and that loading older history still preserves position.

Summary by CodeRabbit

  • New Features

    • Added a clearer vectorization flow for lorebooks, including separate actions for missing entries and re-vectorizing all entries.
    • Improved generation recovery in background tabs so chats can finish reliably even after a disconnect.
  • Bug Fixes

    • Music players now use refreshed theme styling for more consistent light/dark appearance.
    • Volume sliders and mini-player tiles now render more consistent progress and ring styles.
    • Scene creation now starts without inheriting the origin chat’s preset, avoiding instruction conflicts.

🔄 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/3186 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/3/2026 **Status:** ✅ Merged **Merged:** 7/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/smooth-roleplay-typewriter` --- ### 📝 Commits (6) - [`08f461b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/08f461b5a7bfea0d49362340747d25c867cbef84) Fix lorebook revectorization and scene streaming polish - [`4832028`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4832028ec28e43546021e27f6aaf89613f4d40f5) Theme music players for light mode - [`0881a0c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0881a0c4e89d811a3198ad9e689818f9e329bbe4) Merge branch 'staging' into codex/smooth-roleplay-typewriter - [`2ca68e0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2ca68e09280c79f3fe17ae39b466fd8e60699179) Recover mobile backgrounded generations - [`dda26b0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dda26b0c6cdd134c3ab6b21212a5cb783cc73022) Open chats at latest message - [`2a9ac3f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2a9ac3f9f609c4862f723ad72f29b4a877a31730) Address CodeRabbit review for PR 3186 ### 📊 Changes **13 files changed** (+274 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+45 -4) 📝 `packages/client/src/components/chat/LocalMusicPlayer.tsx` (+15 -12) 📝 `packages/client/src/components/chat/YouTubePlayer.tsx` (+16 -13) 📝 `packages/client/src/components/lorebooks/LorebookEditor.tsx` (+55 -14) 📝 `packages/client/src/components/music/MusicSourceButton.tsx` (+1 -1) 📝 `packages/client/src/components/spotify/SpotifyMiniPlayer.tsx` (+14 -13) 📝 `packages/client/src/hooks/use-generate.ts` (+75 -6) 📝 `packages/client/src/styles/globals.css` (+31 -3) 📝 `packages/server/src/routes/generate.routes.ts` (+15 -2) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+2 -2) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+1 -1) 📝 `packages/server/src/routes/scene.routes.ts` (+3 -1) </details> ### 📄 Description ## Why Closes #3182. Closes #3185. Changing embedding models can leave existing lorebook vectors with dimensions that do not match newly generated vectors. The server already rejects missing-only vectorization in that state, but the editor did not expose a direct way to re-vectorize every entry. Mobile browsers can also suspend or cut the generation stream when the user switches apps. In Roleplay mode that passive disconnect aborted the server-side generation and surfaced a network error when the user returned. Restored chats should reopen at the latest visible message instead of landing at the top of the loaded history window. ## What Changed - Added an explicit `Re-vectorize all` action when a lorebook has both stored vectors and entries missing vectors. - Kept missing-only vectorization available for the normal “new entries added” case, with separate loading states for each vectorization mode. - Updated the server dimension-mismatch error to point users at the new re-vectorize-all action. - Smoothed Roleplay typewriter streaming by capping per-frame reveals and resetting stale paint timing between bursts. - Made conversation-created scene chats start with `None` for prompt preset so generated scene instructions do not clash with inherited presets. - Themed Spotify, YouTube, and Custom Music players through shared light/dark music-player tokens. - Improved light-mode visibility for mini-player buttons, icon controls, tiles, progress tracks, and volume thumb outlines. - Let normal chat generations continue server-side after passive client disconnects, while explicit impersonation disconnects still abort. - Added `/api/generate/status/:chatId` so the client can recover from mobile background stream drops by waiting for the server generation to finish, then refreshing messages without showing a false network error. - Restored conversation and roleplay chats to the latest rendered message on initial open while preserving load-older scroll behavior. ## Validation - `git diff --check` - `pnpm --filter @marinara-engine/server lint` - `pnpm --filter @marinara-engine/client lint` - `pnpm --filter @marinara-engine/client build` - `pnpm check` - After rebasing on the updated PR branch: `pnpm --filter @marinara-engine/server lint` - After rebasing on the updated PR branch: `pnpm --filter @marinara-engine/client lint` ## Manual Verification Needed - Manually verify changing an embedding model on a partially vectorized lorebook offers and completes `Re-vectorize all`. - Manually verify Roleplay streaming still feels smooth with streaming speed set around 30. - Manually verify chats created from a conversation scene show prompt preset `None`. - Manually verify Spotify, YouTube, and Custom Music mini players in both light and dark mode. - Manually verify on mobile: send a Roleplay message, switch apps while it generates, return, and confirm the reply appears without a network-error toast. - Manually verify reopening ME on a previously active conversation or roleplay chat starts at the latest message, and that loading older history still preserves position. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a clearer vectorization flow for lorebooks, including separate actions for missing entries and re-vectorizing all entries. * Improved generation recovery in background tabs so chats can finish reliably even after a disconnect. * **Bug Fixes** * Music players now use refreshed theme styling for more consistent light/dark appearance. * Volume sliders and mini-player tiles now render more consistent progress and ring styles. * Scene creation now starts without inheriting the origin chat’s preset, avoiding instruction conflicts. <!-- 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-22 04:19:59 +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#5834
No description provided.