Skip to content

feat: add Duplicate Topic feature#14788

Open
LWWZH wants to merge 1 commit into
CherryHQ:v2from
LWWZH:feat/copy-topic
Open

feat: add Duplicate Topic feature#14788
LWWZH wants to merge 1 commit into
CherryHQ:v2from
LWWZH:feat/copy-topic

Conversation

@LWWZH
Copy link
Copy Markdown
Contributor

@LWWZH LWWZH commented May 2, 2026

What this PR does

Before this PR:
Users could only copy topic content to clipboard (as image, markdown, or plain text) or export it to external formats. There was no way to create a full copy of a topic including all its conversation history within the app.

After this PR:
Right-clicking any topic in the topic list now shows a "Duplicate Topic" option. Selecting it creates a complete clone of the topic — including all messages, blocks, files, and the topic prompt — with the name suffixed by " (Copy)". The duplicated topic is immediately activated so the user can continue the conversation.

Fixes #14773

Why we need it and why it was done in this way

This feature was requested by AI novel creators who frequently need to branch stories within the same world view / background / premise. Without duplication, they had to manually save content or copy-paste, which is cumbersome for long conversations.

The implementation reuses the existing cloneMessagesToNewTopicThunk (already used for topic branching) to deep-clone all messages and blocks with remapped IDs. This avoids duplicating logic and ensures file references are handled correctly.

Tradeoffs:

  • Messages are cloned into Dexie/Redux only, not bulk-posted to the backend SQLite API. This is consistent with the existing topic-branching behavior.
  • The server-side topic created via dataApiService.post is not rolled back on local clone failure. This matches the existing removeTopic pattern in the codebase.

Alternatives considered:

  • Prompting the user to rename the duplicated topic immediately. Rejected in favor of the simpler "name + (Copy)" approach.
  • Keeping the exact same name. Rejected because it makes the list indistinguishable.

Breaking changes

None.

Special notes for your reviewer

  • Switched useDispatchuseAppDispatch in Topics.tsx for better type safety.
  • Added i18n keys for en-us, zh-cn, and zh-tw.

Checklist

Release note

Added "Duplicate Topic" feature to the topic right-click context menu, allowing users to create a full copy of a topic including all conversation history.

@LWWZH LWWZH requested a review from a team May 2, 2026 09:16
@ousugo ousugo added the v2 label May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants