mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-18 15:44:36 +00:00
batch matching fix
This commit is contained in:
1 parent
9365826771
commit
2b94bc5a1b
4 files changed
+25
-13
No files matched your search
@@ -103,7 +103,7 @@ const TextToImage = ({ imageMediaId, imageUrl }: TextToImageProps) => {
|
||||
</div>
|
||||
<div className="mt-2 flex justify-end">
|
||||
<Badge
|
||||
label={selectedModel}
|
||||
label={batch.modelLabel}
|
||||
className="px-2 py-1 text-xs opacity-70"
|
||||
/>
|
||||
</div>
|
||||
@@ -175,8 +175,8 @@ const TextToImage = ({ imageMediaId, imageUrl }: TextToImageProps) => {
|
||||
modelInfo={selectedModelInfo}
|
||||
imageMediaId={imageMediaId}
|
||||
url={imageUrl ?? undefined}
|
||||
onEnqueuePressed={async (prompt, count) => {
|
||||
startBatch(prompt, count, selectedModel);
|
||||
onEnqueuePressed={async (prompt, count, subscriberId) => {
|
||||
startBatch(prompt, count, selectedModel, subscriberId);
|
||||
}}
|
||||
/>
|
||||
</animated.div>
|
||||
|
||||
@@ -18,6 +18,7 @@ type TextToImageState = {
|
||||
prompt: string,
|
||||
requestedCount: number,
|
||||
modelLabel: string,
|
||||
subscriberId?: string,
|
||||
) => string;
|
||||
completeBatch: (
|
||||
images: GeneratedImage[],
|
||||
@@ -29,10 +30,17 @@ type TextToImageState = {
|
||||
|
||||
export const useTextToImageStore = create<TextToImageState>((set, get) => ({
|
||||
batches: [],
|
||||
startBatch: (prompt: string, requestedCount: number, modelLabel: string) => {
|
||||
const id = crypto.randomUUID
|
||||
? crypto.randomUUID()
|
||||
: Math.random().toString(36).slice(2);
|
||||
startBatch: (
|
||||
prompt: string,
|
||||
requestedCount: number,
|
||||
modelLabel: string,
|
||||
subscriberId?: string,
|
||||
) => {
|
||||
const id = subscriberId
|
||||
? subscriberId
|
||||
: crypto.randomUUID
|
||||
? crypto.randomUUID()
|
||||
: Math.random().toString(36).slice(2);
|
||||
const batch: TextToImageBatch = {
|
||||
id,
|
||||
prompt,
|
||||
|
||||
@@ -34,7 +34,11 @@ import { gtagEvent } from "@storyteller/google-analytics";
|
||||
|
||||
interface PromptBoxImageProps {
|
||||
useJobContext: () => JobContextType;
|
||||
onEnqueuePressed?: (prompt: string, count: number) => void | Promise<void>;
|
||||
onEnqueuePressed?: (
|
||||
prompt: string,
|
||||
count: number,
|
||||
subscriberId: string
|
||||
) => void | Promise<void>;
|
||||
model: string;
|
||||
modelInfo?: ModelInfo;
|
||||
imageMediaId?: string;
|
||||
@@ -268,7 +272,7 @@ export const PromptBoxImage = ({
|
||||
? crypto.randomUUID()
|
||||
: Math.random().toString(36).slice(2);
|
||||
|
||||
onEnqueuePressed?.(prompt, generationCount);
|
||||
onEnqueuePressed?.(prompt, generationCount, subscriberId);
|
||||
|
||||
setTimeout(() => {
|
||||
// TODO(bt,2025-05-08): This is a hack so we don't accidentally wind up with a permanently disabled prompt box if
|
||||
|
||||
@@ -55,7 +55,7 @@ export const ALL_MODELS: ModelConfig[] = [
|
||||
},
|
||||
description: "High quality model",
|
||||
badges: [{ label: "15 sec." }],
|
||||
capabilities: { maxGenerationCount: 4 },
|
||||
capabilities: { maxGenerationCount: 4, defaultGenerationCount: 4 },
|
||||
}),
|
||||
cfg({
|
||||
id: "flux_pro_1_1",
|
||||
@@ -67,7 +67,7 @@ export const ALL_MODELS: ModelConfig[] = [
|
||||
},
|
||||
description: "High quality model",
|
||||
badges: [{ label: "15 sec." }],
|
||||
capabilities: { maxGenerationCount: 4 },
|
||||
capabilities: { maxGenerationCount: 4, defaultGenerationCount: 4 },
|
||||
}),
|
||||
cfg({
|
||||
id: "flux_1_dev",
|
||||
@@ -79,7 +79,7 @@ export const ALL_MODELS: ModelConfig[] = [
|
||||
},
|
||||
description: "High quality model",
|
||||
badges: [{ label: "15 sec." }],
|
||||
capabilities: { maxGenerationCount: 4 },
|
||||
capabilities: { maxGenerationCount: 4, defaultGenerationCount: 4 },
|
||||
}),
|
||||
cfg({
|
||||
id: "flux_1_schnell",
|
||||
@@ -91,7 +91,7 @@ export const ALL_MODELS: ModelConfig[] = [
|
||||
},
|
||||
description: "High quality model",
|
||||
badges: [{ label: "15 sec." }],
|
||||
capabilities: { maxGenerationCount: 4 },
|
||||
capabilities: { maxGenerationCount: 4, defaultGenerationCount: 4 },
|
||||
}),
|
||||
cfg({
|
||||
id: "gpt_image_1",
|
||||
|
||||
Reference in new issue
Block a user