diff --git a/components/PromptPanel.tsx b/components/PromptPanel.tsx index 4106ab0..7a1006d 100644 --- a/components/PromptPanel.tsx +++ b/components/PromptPanel.tsx @@ -33,12 +33,7 @@ export default function PromptPanel({ onSubmit={(e) => { e.preventDefault(); const prompt = e.currentTarget.prompt.value; - var promptLastIndex = prompts.length - 1; - if (prompts[promptLastIndex - 1].prompt == "") { - changePrompt(prompt, promptLastIndex - 1); - } else { - changePrompt(prompt, promptLastIndex); - } + changePrompt(prompt, prompts.length - 1); inputPrompt.current.value = ""; }} > diff --git a/pages/index.tsx b/pages/index.tsx index d4c973d..b86411d 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -90,8 +90,20 @@ export default function Home() { let newAppState = appState; if (appState == AppState.SAME_PROMPT) { - if (endPrompt) { + if (upNextPrompt) { newAppState = AppState.TRANSITION; + + // swap the last two prompts to bring the upNextPrompt into the next inference call + setPromptInputs((prevPromptInputs) => { + const newPromptInputs = [...prevPromptInputs]; + newPromptInputs[newPromptInputs.length - 1] = { + prompt: endPrompt, + }; + newPromptInputs[newPromptInputs.length - 2] = { + prompt: upNextPrompt, + }; + return newPromptInputs; + }); } setSeed(seed + 1); } else if (appState == AppState.TRANSITION) {