[PR #351] [MERGED] feat: CYOA reroll + chat-scoped choices #4574

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/351
Author: @Xelvanis
Created: 5/2/2026
Status: ✅ Merged
Merged: 5/3/2026
Merged by: @LukaTheHero

Base: main ← Head: feat/reroll-CYOA


📝 Commits (1)

  • 2d25495 feat: CYOA reroll + chat-scoped choices

📊 Changes

3 files changed (+135 additions, -8 deletions)

View changed files

📝 packages/client/src/components/chat/CyoaChoices.tsx (+67 -8)
📝 packages/client/src/hooks/use-generate.ts (+8 -0)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+60 -0)

📄 Description

Add a CYOA reroll action and prevent stale CYOA choices from bleeding across chat switches.

Linked issue

Closes #338

Why this change

  • Add an explicit “Re-roll” flow for CYOA choices so users can regenerate options using the latest chat context without sending a new message.

What changed

  • Added a “Re-roll” button to the CYOA choices UI that re-runs only the cyoa agent and swaps in the new choices.
  • Updated the retry-agent SSE handler to apply cyoa results to the client CYOA store immediately.
  • Updated the server retry-agents route to (a) include previous CYOA choices for anti-repetition and (b) persist re-rolled choices to message/swipe extras for refresh safety.

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

  • Manual testing TODO:
    • Built and ran app locally without issues.
    • Opened a roleplay chat and enabled CYOA agent
    • After choices appeared, click Re-roll and confirmed:
      • Spinner shows and choices disable while re-rolling
      • New choices appear based on most recent assistant message context
      • Refreshed the page and confirmed choices persist
      • Regenerated assistant message and confirmed re-rolling choices use new assistant message's context.
      • Checked light/dark mode and mobile viewport layout
      • Swapped to different roleplay chat with CYOA enabled and confirmed choices stay within their respective chat

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)

UI evidence (if applicable)

Screenshot 2026-05-02 150255

Summary by CodeRabbit

  • New Features

    • Re-roll CYOA choices to generate alternative options during a conversation.
    • Retries immediately update choice buttons so new options appear without delay.
  • Bug Fixes / UX

    • Prevents duplicate or stale CYOA choices when switching chats or during streaming.
    • UI disables edit controls, re-roll button, and individual choices while re-rolling or streaming.
    • Re-roll results are properly persisted and applied to the active message.

🔄 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/351 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/2/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `feat/reroll-CYOA` --- ### 📝 Commits (1) - [`2d25495`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2d254951d90ffea540702743d31449d21b891315) feat: CYOA reroll + chat-scoped choices ### 📊 Changes **3 files changed** (+135 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/CyoaChoices.tsx` (+67 -8) 📝 `packages/client/src/hooks/use-generate.ts` (+8 -0) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+60 -0) </details> ### 📄 Description Add a CYOA reroll action and prevent stale CYOA choices from bleeding across chat switches. ## Linked issue Closes #338 ## Why this change - Add an explicit “Re-roll” flow for CYOA choices so users can regenerate options using the latest chat context without sending a new message. ## What changed - Added a “Re-roll” button to the CYOA choices UI that re-runs only the `cyoa` agent and swaps in the new choices. - Updated the retry-agent SSE handler to apply `cyoa` results to the client CYOA store immediately. - Updated the server retry-agents route to (a) include previous CYOA choices for anti-repetition and (b) persist re-rolled choices to message/swipe extras for refresh safety. ## Validation - [X] `pnpm check` passes locally - [X] Container (Docker / Podman) built and ran without issue - [X] Ran the app, clicked through the changes manually - [X] 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 - Manual testing TODO: - [X] Built and ran app locally without issues. - [X] Opened a roleplay chat and enabled CYOA agent - After choices appeared, click **Re-roll** and confirmed: - [X] Spinner shows and choices disable while re-rolling - [X] New choices appear based on most recent assistant message context - [X] Refreshed the page and confirmed choices persist - [X] Regenerated assistant message and confirmed re-rolling choices use new assistant message's context. - [X] Checked light/dark mode and mobile viewport layout - [X] Swapped to different roleplay chat with CYOA enabled and confirmed choices stay within their respective chat ## 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) ## UI evidence (if applicable) <img width="377" height="57" alt="Screenshot 2026-05-02 150255" src="https://github.com/user-attachments/assets/164afdaa-2b5d-4879-a5b0-94dc070e22af" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Re-roll CYOA choices to generate alternative options during a conversation. * Retries immediately update choice buttons so new options appear without delay. * **Bug Fixes / UX** * Prevents duplicate or stale CYOA choices when switching chats or during streaming. * UI disables edit controls, re-roll button, and individual choices while re-rolling or streaming. * Re-roll results are properly persisted and applied to the active message. <!-- 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:51 +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#4574
No description provided.