1
0
Fork 0

Duplicate first message

This commit is contained in:
Pabloader 2026-04-07 11:40:02 +00:00
parent 21ad47a67b
commit 24165f0abd
1 changed files with 3 additions and 1 deletions

View File

@ -337,6 +337,8 @@ function reducer(state: IState, action: Action): IState {
const world = state.worlds.find(w => w.id === action.worldId); const world = state.worlds.find(w => w.id === action.worldId);
const original = world?.stories.find(s => s.id === action.id); const original = world?.stories.find(s => s.id === action.id);
if (!original) return state; if (!original) return state;
const firstMessage = original.chatMessages[0];
const chatMessages = world?.chatOnly && firstMessage && firstMessage.role === 'assistant' ? [firstMessage] : [];
const newStory: Story = { const newStory: Story = {
id: crypto.randomUUID(), id: crypto.randomUUID(),
title: `${original.title} (Copy)`, title: `${original.title} (Copy)`,
@ -345,7 +347,7 @@ function reducer(state: IState, action: Action): IState {
lore: [...original.lore], lore: [...original.lore],
characters: [...original.characters], characters: [...original.characters],
locations: [...original.locations], locations: [...original.locations],
chatMessages: [], chatMessages,
chapters: [], chapters: [],
}; };
return { return {