Duplicate first message
This commit is contained in:
parent
21ad47a67b
commit
24165f0abd
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue