[PR #586] [MERGED] Add /hide and /unhide slash commands for bulk AI context control #4687

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/586
Author: @kevin-ho
Created: 5/9/2026
Status: ✅ Merged
Merged: 5/9/2026
Merged by: @Romuromylus

Base: main ← Head: feature/bulk-hide-slash-command


📝 Commits (3)

  • ffc8f06 feat: add /hide and /unhide slash commands for bulk AI context control
  • 3062dc0 fix: address CodeRabbit review feedback on PR #586
  • 854a44f Merge branch 'main' into feature/bulk-hide-slash-command

📊 Changes

3 files changed (+168 additions, -0 deletions)

View changed files

📝 packages/client/src/lib/slash-commands.ts (+132 -0)
📝 packages/server/src/routes/chats.routes.ts (+16 -0)
📝 packages/server/src/services/storage/chats.storage.ts (+20 -0)

📄 Description

Linked issue

Closes #585

Why this change

Users in long roleplay conversations (200+ messages) often want to exclude large stretches from the AI's context — hiding old plot arcs, OOC exchanges, or redundant messages to reclaim token budget. The per-message UI eye icon makes bulk management impractical. Adding slash commands lets users type /hide 1-200 instead of clicking 200 times.

What changed

Client (packages/client/src/lib/slash-commands.ts, +~80 lines):

  • /hide and /unhide slash commands with argument parser supporting single indices (5), ranges (3-8), comma-separated (2,5,9), and mixed (2-5,8,12-14)
  • Each calls a single PATCH /:chatId/messages/bulk-hidden instead of hundreds of per-message requests
  • Toast feedback: "Hidden 12 messages from AI context" / "Restored 12 messages to AI context"
  • Both commands appear in /help autocomplete

Server (packages/server/src/routes/chats.routes.ts + chats.storage.ts, +~20 lines):

  • New PATCH /:chatId/messages/bulk-hidden endpoint accepting messageIds: string[], hidden: boolean }
  • bulkSetHiddenFromAI() loops the existing updateMessageExtra() — same proven code path as the single-message UI toggle (read-parse-merge-write + swipe sync)
  • Validates messageIds is a non-empty array and hidden is a boolean
  • No new database columns, no migrations

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

  • pnpm check — all workspace lint/type checks pass, production build successful
  • Tested in-app: /hide 207 (single), /hide 206-207 (range), /hide 1-207 (bulk 207 messages) — all succeeded with correct toast feedback, messages dimmed after invalidation
  • Tested /unhide 1-207 — all messages restored, toast reads "Restored 207 messages to AI context"
  • Verified bulk endpoint via curl: PATCH /api/chats/:chatId/messages/bulk-hidden returns updated: N } correctly for both hide and unhide
  • Verified existing per-message PATCH .../extra endpoint still functions correctly (no regression)
  • Out-of-range index produces clear error toast with total message count
  • Edge cases not covered: dark/light mode (slash command has no visual component — text input only), mobile viewport (not tested), empty args returns usage hint
  • Container build not tested — Docker environment not available in this workspace

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 docs or release metadata changes included. Slash commands are self-documenting via /help.

Summary by CodeRabbit

  • New Features
    • Added /hide and /unhide slash commands to control which messages the AI considers.
    • Supports flexible message index syntax: single numbers, ranges (e.g., 3-8), and comma-separated values.
    • Performs bulk updates so multiple messages (and their associated content) can be toggled at once.
    • Shows toast notifications reporting how many messages were affected and validates requested indexes.

🔄 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/586 **Author:** [@kevin-ho](https://github.com/kevin-ho) **Created:** 5/9/2026 **Status:** ✅ Merged **Merged:** 5/9/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `main` ← **Head:** `feature/bulk-hide-slash-command` --- ### 📝 Commits (3) - [`ffc8f06`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ffc8f069cf4b23480fb35869a2502df1c45770d1) feat: add /hide and /unhide slash commands for bulk AI context control - [`3062dc0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3062dc0d3640b793198d299c6056d4efbd28e261) fix: address CodeRabbit review feedback on PR #586 - [`854a44f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/854a44f282e0cd715e4f489067639ffa7bc11aae) Merge branch 'main' into feature/bulk-hide-slash-command ### 📊 Changes **3 files changed** (+168 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/lib/slash-commands.ts` (+132 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+16 -0) 📝 `packages/server/src/services/storage/chats.storage.ts` (+20 -0) </details> ### 📄 Description ## Linked issue Closes #585 ## Why this change Users in long roleplay conversations (200+ messages) often want to exclude large stretches from the AI's context — hiding old plot arcs, OOC exchanges, or redundant messages to reclaim token budget. The per-message UI eye icon makes bulk management impractical. Adding slash commands lets users type `/hide 1-200` instead of clicking 200 times. ## What changed **Client** (`packages/client/src/lib/slash-commands.ts`, +~80 lines): - `/hide` and `/unhide` slash commands with argument parser supporting single indices (`5`), ranges (`3-8`), comma-separated (`2,5,9`), and mixed (`2-5,8,12-14`) - Each calls a single `PATCH /:chatId/messages/bulk-hidden` instead of hundreds of per-message requests - Toast feedback: "Hidden 12 messages from AI context" / "Restored 12 messages to AI context" - Both commands appear in `/help` autocomplete **Server** (`packages/server/src/routes/chats.routes.ts` + `chats.storage.ts`, +~20 lines): - New `PATCH /:chatId/messages/bulk-hidden` endpoint accepting ` messageIds: string[], hidden: boolean }` - `bulkSetHiddenFromAI()` loops the existing `updateMessageExtra()` — same proven code path as the single-message UI toggle (read-parse-merge-write + swipe sync) - Validates `messageIds` is a non-empty array and `hidden` is a boolean - No new database columns, no migrations ## 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) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm check` — all workspace lint/type checks pass, production build successful - Tested in-app: `/hide 207` (single), `/hide 206-207` (range), `/hide 1-207` (bulk 207 messages) — all succeeded with correct toast feedback, messages dimmed after invalidation - Tested `/unhide 1-207` — all messages restored, toast reads "Restored 207 messages to AI context" - Verified bulk endpoint via curl: `PATCH /api/chats/:chatId/messages/bulk-hidden` returns ` updated: N }` correctly for both hide and unhide - Verified existing per-message `PATCH .../extra` endpoint still functions correctly (no regression) - Out-of-range index produces clear error toast with total message count - Edge cases not covered: dark/light mode (slash command has no visual component — text input only), mobile viewport (not tested), empty args returns usage hint - Container build not tested — Docker environment not available in this workspace ## 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 docs or release metadata changes included. Slash commands are self-documenting via `/help`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added `/hide` and `/unhide` slash commands to control which messages the AI considers. * Supports flexible message index syntax: single numbers, ranges (e.g., 3-8), and comma-separated values. * Performs bulk updates so multiple messages (and their associated content) can be toggled at once. * Shows toast notifications reporting how many messages were affected and validates requested indexes. <!-- 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:09:49 +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#4687
No description provided.