prompt box fixes

This commit is contained in:
Brandon Thomas committed 2025-05-10 20:44:02 -04:00
1 parent 9c24dbd446
commit 55c9da44d2
4 files changed
+73 -29

No files matched your search

@@ -320,7 +320,7 @@ export const PromptBox = () => {
if (!prompt.trim()) return;
try {
console.log(
"Enqueuing with prompt:",
"(3) Enqueuing with prompt:",
prompt,
"and reference images:",
referenceImages,
@@ -446,8 +446,10 @@ export const PromptBox = () => {
r.playSound("test");
if (isDesktop) {
console.log("Desktop enqueueing...")
await handleTauriEnqueue();
} else {
console.log("Web enqueueing...")
await handleWebEnqueue();
}
};
@@ -492,7 +494,7 @@ export const PromptBox = () => {
try {
// Here we would pass both the prompt and reference images to the generation
console.log(
"Enqueuing with prompt:",
"(2) Enqueuing with prompt:",
prompt,
"and reference images:",
referenceImages,
@@ -592,7 +594,7 @@ export const PromptBox = () => {
try {
// Here we would pass both the prompt and reference images to the generation
console.log(
"Enqueuing with prompt:",
"(1) Enqueuing with prompt:",
prompt,
"and reference images:",
referenceImages,
@@ -357,7 +357,7 @@ export const PromptBox2D = ({
if (!prompt.trim()) return;
try {
console.log(
"Enqueuing with prompt:",
"(4) Enqueuing with prompt:",
prompt,
"and reference images:",
referenceImages
@@ -42,19 +42,20 @@ import { PromptsApi } from "@storyteller/api";
import { SoundRegistry } from "@storyteller/soundboard";
import { toast } from "@storyteller/ui-toaster";
interface ReferenceImage {
id: string;
url: string;
file: File;
mediaToken: string;
}
import { EngineApi } from "@storyteller/api";
import { CameraSettingsModal } from "@storyteller/ui-camera-settings-modal";
import { twMerge } from "tailwind-merge";
import { GalleryModal, GalleryItem } from "@storyteller/ui-gallery-modal";
import { Modal } from "@storyteller/ui-modal";
import { Signal } from "@preact/signals-react";
import { CommandSuccessStatus, GetAppPreferences, SoraImageRemix } from "@storyteller/tauri-api";
interface ReferenceImage {
id: string;
url: string;
file: File;
mediaToken: string;
}
interface PromptBox3DProps {
cameras: Signal<Camera[]>;
@@ -317,14 +318,11 @@ export const PromptBox3D = ({
const handleEnqueue = async () => {
const isDesktop = IsDesktopApp();
console.log("Is this a desktop app?", isDesktop);
const r = SoundRegistry.getInstance();
r.playSound("test");
if (isDesktop) {
console.log("Desktop app - tauri enqueue");
await handleTauriEnqueue();
} else {
console.log("Web app - web enqueue");
await handleWebEnqueue();
}
};
@@ -369,7 +367,7 @@ export const PromptBox3D = ({
try {
// Here we would pass both the prompt and reference images to the generation
console.log(
"Enqueuing with prompt:",
"(3D.2) Enqueuing with prompt:",
prompt,
"and reference images:",
referenceImages
@@ -388,6 +386,15 @@ export const PromptBox3D = ({
setisEnqueueing(true);
setTimeout(() => {
// TODO(bt,2025-05-08): This is a hack so we don't accidentally wind up with a permanently disabled prompt box if
// the backend hangs on a given request. (Sometimes Sora doesn't respond.) Ideally what we would do instead is only
// force the prompt box to be enabled again as long as another request isn't running, ie. if we just fired off two
// requests in succession, we wouldn't want to turn it off as the first one gets submitted.
console.debug('Turn off blocking of prompt box...');
setisEnqueueing(false);
}, 10000);
setPrompt(prompt);
const promptsApi = new PromptsApi();
@@ -401,19 +408,54 @@ export const PromptBox3D = ({
//sceneMediaToken: "",
});
const generateResponse = await invoke("sora_image_remix_command", {
request: {
snapshot_media_token: snapshotResult.data!,
disable_system_prompt: !useSystemPrompt,
prompt: prompt,
maybe_additional_images: referenceImages.map(
(image) => image.mediaToken
),
maybe_number_of_samples: 1,
},
console.log("snapshotResult", snapshotResult);
// const generateResponse = await invoke("sora_image_remix_command", {
// request: {
// snapshot_media_token: snapshotResult.data!,
// disable_system_prompt: !useSystemPrompt,
// prompt: prompt,
// maybe_additional_images: referenceImages.map(
// (image) => image.mediaToken
// ),
// maybe_number_of_samples: 1,
// },
// });
const generateResponse = await SoraImageRemix({
snapshot_media_token: snapshotResult.data!,
disable_system_prompt: !useSystemPrompt,
prompt: prompt,
maybe_additional_images: referenceImages.map(
(image) => image.mediaToken,
),
maybe_number_of_samples: 1,
});
console.log("response", generateResponse);
console.log("generateResponse", generateResponse);
if (generateResponse.status === CommandSuccessStatus.Success) {
const prefs = await GetAppPreferences();
const soundName = prefs.preferences?.enqueue_success_sound;
if (soundName !== undefined) {
const registry = SoundRegistry.getInstance();
registry.playSound(soundName);
}
toast.success("Image added to queue");
setisEnqueueing(false);
return;
} else {
const prefs = await GetAppPreferences();
const soundName = prefs.preferences?.enqueue_failure_sound;
if (soundName !== undefined) {
const registry = SoundRegistry.getInstance();
registry.playSound(soundName);
}
toast.error("Failed to enqueue image");
setisEnqueueing(false);
return;
}
//if (generateResponse.errorMessage) {
// handleError(response.errorMessage);
@@ -425,7 +467,7 @@ export const PromptBox3D = ({
try {
// Here we would pass both the prompt and reference images to the generation
console.log(
"Enqueuing with prompt:",
"(3D.1) Enqueuing with prompt:",
prompt,
"and reference images:",
referenceImages