[PR #263] [MERGED] feat: guide generations with chat input + visible indicator #4533

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/263
Author: @LukaTheHero
Created: 4/27/2026
Status: ✅ Merged
Merged: 4/27/2026
Merged by: @LukaTheHero

Base: main ← Head: feat/guide-generations-with-indicator


📝 Commits (5)

  • 16e136b feat: add current input to chat store
  • 6154e9a feat: implement option to guide generations with chat input
  • 58da0d7 fix: fix input unmount race conditions
  • 89ae1f0 docs: update FRONTEND.md with new store values
  • 65577de feat: visible primary-color indicator when guide-generations is armed

📊 Changes

14 files changed (+126 additions, -42 deletions)

View changed files

📝 docs/FRONTEND.md (+2 -1)
📝 packages/client/src/components/chat/ChatArea.tsx (+9 -2)
📝 packages/client/src/components/chat/ChatInput.tsx (+29 -17)
📝 packages/client/src/components/chat/ChatMessage.tsx (+13 -2)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+1 -0)
📝 packages/client/src/components/chat/ConversationInput.tsx (+24 -17)
📝 packages/client/src/components/chat/ConversationMessage.tsx (+13 -2)
📝 packages/client/src/components/chat/ConversationView.tsx (+1 -1)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+8 -0)
📝 packages/client/src/hooks/use-generate.ts (+1 -0)
📝 packages/client/src/stores/chat.store.ts (+7 -0)
📝 packages/client/src/stores/ui.store.ts (+6 -0)
📝 packages/server/src/routes/generate.routes.ts (+11 -0)
📝 packages/shared/src/schemas/chat.schema.ts (+1 -0)

📄 Description

Why this change

Builds on @mm14141's work in #216. The original PR introduces a great quality-of-life feature — let unsent chat input nudge a regeneration or character-trigger one-shot, without polluting the chat history. Tested it in the test dir and the underlying flow works exactly as advertised.

The only thing missing was a visible signal that the guided state is armed. The original PR ships the indicator via tooltip text ("Regenerate (guided)" / "Trigger character response (guided)"), which means a user has to hover the button to discover that their typed-but-unsent input is about to be folded into the prompt as a system instruction. For a feature that silently changes generation behavior, that's too easy to miss.

This PR keeps mm14141's four commits intact and adds a single commit on top that turns the affected buttons pink when guided is armed.

What changed (on top of #216)

When guideGenerations is on AND the chat input has non-empty text, three buttons now render with a primary-color (var(--primary)) tint:

  • Regenerate in roleplay messages (ChatMessage.tsx — both desktop and grouped layouts)
  • Regenerate in conversation messages (ConversationMessage.tsx — full and compact layouts)
  • Trigger Character in the chat input bar (ChatInput.tsx — group RP only)

Styling applied to each:

text-[var(--primary)] bg-[var(--primary)]/15 ring-1 ring-[var(--primary)]/30

So the icon is pink, the button has a faint pink fill, and a thin pink ring outlines it. Theme-aware via var(--primary) which is defined for both [data-theme=\"dark\"] (#ffb3d9) and [data-theme=\"light\"] (#e0709a).

When guideGenerations is off OR the input is empty, the buttons render in their normal muted styling — zero visual change vs. mm14141's PR. The instant the user starts typing with the toggle on, those buttons light up. Clear the input → they go back to muted.

Implementation notes

  • Both message components derive a shared isGuided = guideGenerations && hasInput flag plus a regenerateGuidedClass string, and pass it through the existing className extension prop on ActionBtn / MsgAction. No new component plumbing required.
  • cn() uses tailwind-merge so the conflict between the base text-foreground/40 and the guided text-[var(--primary)] resolves cleanly — no need for !important.
  • ChatInput.tsx Trigger Character button is a custom inline button (not ActionBtn), so I added the guided branch directly to its cn(...) ladder, prioritising guided over the existing open/closed states so the pink tint always wins when armed.
  • mm14141's race-condition fixes (key={activeChatId} on the input components, the unmount cleanup capture fix, the currentInput zustand field) are preserved untouched — those are real bugs his PR catches and they should land alongside the feature.

Validation

  • pnpm check passes (TypeScript + ESLint + build, all three workspaces)
  • Manual: tested in browser on RP and Conversation chats. Toggle on + type → Regenerate icon and (in group RP) Trigger Character icon turn pink. Clear input or toggle off → buttons return to muted styling. Confirmed in both light and dark mode.
  • Confirmed mm14141's underlying behavior (the generationGuide system message injection, Take the following into special consideration for your next message: ...) still works as expected — the indicator changes are purely visual.

Credit

Original feature work is @mm14141's in #216 — those four commits are preserved on this branch with their authorship intact. This PR only adds a visible indicator on top.

Summary by CodeRabbit

  • New Features
    • Added a new advanced setting to enable guided generation mode, which incorporates your current chat input to directly influence message regeneration and response generation outcomes throughout conversations.
    • Regenerate and response generation buttons display enhanced visual feedback—updated tooltips and highlight styling—when guided generation mode is active with input text present.

🔄 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/263 **Author:** [@LukaTheHero](https://github.com/LukaTheHero) **Created:** 4/27/2026 **Status:** ✅ Merged **Merged:** 4/27/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `feat/guide-generations-with-indicator` --- ### 📝 Commits (5) - [`16e136b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/16e136b84741383fb2a9081c75e90c6f866cf0f8) feat: add current input to chat store - [`6154e9a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6154e9a2ea86e39dd6a167e245a1ad572185e374) feat: implement option to guide generations with chat input - [`58da0d7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/58da0d7aa3596adddfe60cbfb674bfb534d1c5e0) fix: fix input unmount race conditions - [`89ae1f0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/89ae1f025ab546088d518dfb5cc9c1e56abb14e2) docs: update FRONTEND.md with new store values - [`65577de`](https://github.com/Pasta-Devs/Marinara-Engine/commit/65577deeee6e3ef40ab725559a3bb83e8e1bcb44) feat: visible primary-color indicator when guide-generations is armed ### 📊 Changes **14 files changed** (+126 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `docs/FRONTEND.md` (+2 -1) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+9 -2) 📝 `packages/client/src/components/chat/ChatInput.tsx` (+29 -17) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+13 -2) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+1 -0) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+24 -17) 📝 `packages/client/src/components/chat/ConversationMessage.tsx` (+13 -2) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+1 -1) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+8 -0) 📝 `packages/client/src/hooks/use-generate.ts` (+1 -0) 📝 `packages/client/src/stores/chat.store.ts` (+7 -0) 📝 `packages/client/src/stores/ui.store.ts` (+6 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+11 -0) 📝 `packages/shared/src/schemas/chat.schema.ts` (+1 -0) </details> ### 📄 Description ## Why this change Builds on @mm14141's work in #216. The original PR introduces a great quality-of-life feature — let unsent chat input nudge a regeneration or character-trigger one-shot, without polluting the chat history. Tested it in the test dir and the underlying flow works exactly as advertised. The only thing missing was a **visible signal** that the guided state is armed. The original PR ships the indicator via tooltip text (`"Regenerate (guided)"` / `"Trigger character response (guided)"`), which means a user has to hover the button to discover that their typed-but-unsent input is about to be folded into the prompt as a system instruction. For a feature that silently changes generation behavior, that's too easy to miss. This PR keeps mm14141's four commits intact and adds a single commit on top that turns the affected buttons pink when guided is armed. ## What changed (on top of #216) When **`guideGenerations` is on AND the chat input has non-empty text**, three buttons now render with a primary-color (`var(--primary)`) tint: - **Regenerate** in roleplay messages (`ChatMessage.tsx` — both desktop and grouped layouts) - **Regenerate** in conversation messages (`ConversationMessage.tsx` — full and compact layouts) - **Trigger Character** in the chat input bar (`ChatInput.tsx` — group RP only) Styling applied to each: ``` text-[var(--primary)] bg-[var(--primary)]/15 ring-1 ring-[var(--primary)]/30 ``` So the icon is pink, the button has a faint pink fill, and a thin pink ring outlines it. Theme-aware via `var(--primary)` which is defined for both `[data-theme=\"dark\"]` (#ffb3d9) and `[data-theme=\"light\"]` (#e0709a). When `guideGenerations` is off OR the input is empty, the buttons render in their normal muted styling — zero visual change vs. mm14141's PR. The instant the user starts typing with the toggle on, those buttons light up. Clear the input → they go back to muted. ## Implementation notes - Both message components derive a shared `isGuided = guideGenerations && hasInput` flag plus a `regenerateGuidedClass` string, and pass it through the existing `className` extension prop on `ActionBtn` / `MsgAction`. No new component plumbing required. - `cn()` uses `tailwind-merge` so the conflict between the base `text-foreground/40` and the guided `text-[var(--primary)]` resolves cleanly — no need for `!important`. - `ChatInput.tsx` Trigger Character button is a custom inline button (not `ActionBtn`), so I added the guided branch directly to its `cn(...)` ladder, prioritising guided over the existing open/closed states so the pink tint always wins when armed. - mm14141's race-condition fixes (`key={activeChatId}` on the input components, the unmount cleanup capture fix, the `currentInput` zustand field) are preserved untouched — those are real bugs his PR catches and they should land alongside the feature. ## Validation - [x] `pnpm check` passes (TypeScript + ESLint + build, all three workspaces) - [x] Manual: tested in browser on RP and Conversation chats. Toggle on + type → Regenerate icon and (in group RP) Trigger Character icon turn pink. Clear input or toggle off → buttons return to muted styling. Confirmed in both light and dark mode. - [x] Confirmed mm14141's underlying behavior (the `generationGuide` system message injection, `Take the following into special consideration for your next message: ...`) still works as expected — the indicator changes are purely visual. ## Credit Original feature work is @mm14141's in #216 — those four commits are preserved on this branch with their authorship intact. This PR only adds a visible indicator on top. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new advanced setting to enable guided generation mode, which incorporates your current chat input to directly influence message regeneration and response generation outcomes throughout conversations. * Regenerate and response generation buttons display enhanced visual feedback—updated tooltips and highlight styling—when guided generation mode is active with input text present. <!-- 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:08:28 +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#4533
No description provided.