[PR #4431] [MERGED] fix(chat): name the inherited source when dropping an already-active lorebook #6378

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4431
Author: @Gunterlie
Created: 8/1/2026
Status: ✅ Merged
Merged: 8/1/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/lorebook-drop-inherited-source


📝 Commits (6)

  • 4298e80 fix(chat): name the inherited source when dropping an already-active lorebook
  • ee1e2d8 Merge branch 'staging' into fix/lorebook-drop-inherited-source
  • 47cde07 fix(chat): resolve lorebook sources against the revalidated registry
  • 7774adc Merge remote-tracking branch 'gunterlie/fix/lorebook-drop-inherited-source' into fix/lorebook-drop-inherited-source
  • 772be70 Merge branch 'staging' into fix/lorebook-drop-inherited-source
  • 1aaf4f4 Merge branch 'staging' into fix/lorebook-drop-inherited-source

📊 Changes

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

View changed files

📝 packages/client/src/components/chat/ChatResourceDropOverlay.tsx (+35 -10)
📝 packages/client/src/lib/chat-resource-drop-capabilities.ts (+33 -4)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 scripts/regressions/chat-resource-drop.regression.ts (+91 -1)

📄 Description

Closes #4430

Why

Dragging a lorebook onto a chat only warned "already active" when the book was pinned directly to the chat. If it was already being injected because it is attached to the chat's character or persona, or is global, the drop succeeded with a generic "Added to chat context" and no sign that its entries were already there.

The two cases genuinely differ — pinning survives swapping the character or persona out — so the fix is to keep allowing the drop and name the source, not to start blocking it.

What changed

  • resolveChatResourceDropAction takes an optional lorebook list and returns inheritedFrom on add-lorebooks: the non-pin sources (Character / Persona / Global / Chat) that already make the dropped book active.
  • The drop overlay hint and the success toast use that to say which source it came from, instead of the generic copy.
  • Reuses the existing deriveActiveLorebookViews resolver — the same one behind the source chips in the chat settings lorebook list — so the drop and that list cannot disagree.
  • Books the user excluded for the chat are not reported, since they are not actually in context.
  • The existing red "already active" block is unchanged: it still fires only for a book pinned directly.

Two new en.json strings; other locales fall back to English.

Test plan

  • pnpm check
  • pnpm regression:chat-resource-drop
  • Manually verify in browser: drag a lorebook attached to the chat's character onto the chat — drop is allowed, hint and toast say "via Character".
  • Manually verify in browser: same for a lorebook attached to the chat's persona, and for a global lorebook.
  • Manually verify in browser: drag a lorebook already pinned to the chat — still shows the red "already active" block.
  • Manually verify in browser: drag a lorebook with no relationship to the chat — hint and toast keep the original wording.
  • Manually verify in browser: a lorebook that is character-attached but excluded for this chat reports no inherited source.
  • Manually verify on mobile: the same drop through the mobile drop dock produces the same toast.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Chat resource drops now recognize visible and hidden lorebooks.
    • Added context labels identifying inherited lorebooks from characters, personas, global settings, or chat context.
    • Improved success messages and drop hints for inherited resources.
    • Excluded or unrelated lorebooks are handled more accurately.
  • Bug Fixes

    • Prevented already-active lorebooks from being added again.
    • Improved consistency when resolving and replacing resource-drop actions.

🔄 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/4431 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 8/1/2026 **Status:** ✅ Merged **Merged:** 8/1/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/lorebook-drop-inherited-source` --- ### 📝 Commits (6) - [`4298e80`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4298e80788c39353bbff0b35b7cb858d0fe56e08) fix(chat): name the inherited source when dropping an already-active lorebook - [`ee1e2d8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ee1e2d86cf8a343eee0f2a8c2f025e252acce87a) Merge branch 'staging' into fix/lorebook-drop-inherited-source - [`47cde07`](https://github.com/Pasta-Devs/Marinara-Engine/commit/47cde07a04fc5881c60dc825219e83185f6812f0) fix(chat): resolve lorebook sources against the revalidated registry - [`7774adc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7774adccbd091bd5977725184587cb63b42e5da7) Merge remote-tracking branch 'gunterlie/fix/lorebook-drop-inherited-source' into fix/lorebook-drop-inherited-source - [`772be70`](https://github.com/Pasta-Devs/Marinara-Engine/commit/772be708f4e57d6a5d8048516ab58084e930b114) Merge branch 'staging' into fix/lorebook-drop-inherited-source - [`1aaf4f4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1aaf4f44360c33d8fb678dd3867d0ed2fa5ed938) Merge branch 'staging' into fix/lorebook-drop-inherited-source ### 📊 Changes **4 files changed** (+161 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatResourceDropOverlay.tsx` (+35 -10) 📝 `packages/client/src/lib/chat-resource-drop-capabilities.ts` (+33 -4) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `scripts/regressions/chat-resource-drop.regression.ts` (+91 -1) </details> ### 📄 Description Closes #4430 ## Why Dragging a lorebook onto a chat only warned "already active" when the book was **pinned directly** to the chat. If it was already being injected because it is attached to the chat's character or persona, or is global, the drop succeeded with a generic "Added to chat context" and no sign that its entries were already there. The two cases genuinely differ — pinning survives swapping the character or persona out — so the fix is to keep allowing the drop and **name the source**, not to start blocking it. ## What changed - `resolveChatResourceDropAction` takes an optional lorebook list and returns `inheritedFrom` on `add-lorebooks`: the non-pin sources (`Character` / `Persona` / `Global` / `Chat`) that already make the dropped book active. - The drop overlay hint and the success toast use that to say which source it came from, instead of the generic copy. - Reuses the existing `deriveActiveLorebookViews` resolver — the same one behind the source chips in the chat settings lorebook list — so the drop and that list cannot disagree. - Books the user excluded for the chat are not reported, since they are not actually in context. - The existing red "already active" block is unchanged: it still fires only for a book pinned directly. Two new `en.json` strings; other locales fall back to English. ## Test plan - [ ] `pnpm check` - [ ] `pnpm regression:chat-resource-drop` - [ ] Manually verify in browser: drag a lorebook attached to the chat's **character** onto the chat — drop is allowed, hint and toast say "via Character". - [ ] Manually verify in browser: same for a lorebook attached to the chat's **persona**, and for a **global** lorebook. - [ ] Manually verify in browser: drag a lorebook already **pinned** to the chat — still shows the red "already active" block. - [ ] Manually verify in browser: drag a lorebook with no relationship to the chat — hint and toast keep the original wording. - [ ] Manually verify in browser: a lorebook that is character-attached but **excluded** for this chat reports no inherited source. - [ ] Manually verify on mobile: the same drop through the mobile drop dock produces the same toast. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Chat resource drops now recognize visible and hidden lorebooks. * Added context labels identifying inherited lorebooks from characters, personas, global settings, or chat context. * Improved success messages and drop hints for inherited resources. * Excluded or unrelated lorebooks are handled more accurately. * **Bug Fixes** * Prevented already-active lorebooks from being added again. * Improved consistency when resolving and replacing resource-drop actions. <!-- 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:09:50 +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#6378
No description provided.