bring prompts into transition panel upon usage

This commit is contained in:
Seth Forsgren 2022-11-29 14:58:59 -08:00
parent d1edfd1114
commit b721c0983e
2 changed files with 14 additions and 7 deletions

View File

@ -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 = "";
}}
>

View File

@ -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) {