drop auto scan
Browse files
src/lib/components/Pages/Scanner.svelte
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import PicletGenerator from '../PicletGenerator/PicletGenerator.svelte';
|
| 3 |
-
import AutoTrainerScanner from '../AutoTrainerScanner/AutoTrainerScanner.svelte';
|
| 4 |
import type { GradioClient } from '$lib/types';
|
| 5 |
-
|
| 6 |
interface Props {
|
| 7 |
fluxClient: GradioClient | null;
|
| 8 |
joyCaptionClient: GradioClient | null;
|
|
@@ -14,14 +13,6 @@
|
|
| 14 |
|
| 15 |
<div class="scanner-page">
|
| 16 |
{#if fluxClient && joyCaptionClient && gptOssClient}
|
| 17 |
-
<!-- Auto Trainer Scanner -->
|
| 18 |
-
<AutoTrainerScanner
|
| 19 |
-
{joyCaptionClient}
|
| 20 |
-
{fluxClient}
|
| 21 |
-
{gptOssClient}
|
| 22 |
-
/>
|
| 23 |
-
|
| 24 |
-
<!-- Manual Piclet Generator -->
|
| 25 |
<PicletGenerator
|
| 26 |
{fluxClient}
|
| 27 |
{joyCaptionClient}
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import PicletGenerator from '../PicletGenerator/PicletGenerator.svelte';
|
|
|
|
| 3 |
import type { GradioClient } from '$lib/types';
|
| 4 |
+
|
| 5 |
interface Props {
|
| 6 |
fluxClient: GradioClient | null;
|
| 7 |
joyCaptionClient: GradioClient | null;
|
|
|
|
| 13 |
|
| 14 |
<div class="scanner-page">
|
| 15 |
{#if fluxClient && joyCaptionClient && gptOssClient}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
<PicletGenerator
|
| 17 |
{fluxClient}
|
| 18 |
{joyCaptionClient}
|
src/lib/components/PicletGenerator/PicletGenerator.svelte
CHANGED
|
@@ -12,20 +12,12 @@
|
|
| 12 |
import { CanonicalService } from '$lib/services/canonicalService';
|
| 13 |
// import { withQwenTimeout } from '$lib/utils/qwenTimeout'; // Unused since qwen is disabled
|
| 14 |
|
| 15 |
-
interface Props extends PicletGeneratorProps {
|
| 16 |
-
|
| 17 |
-
isTrainerMode?: boolean;
|
| 18 |
-
onTrainerImageCompleted?: (imagePath: string, picletId: number) => void;
|
| 19 |
-
onTrainerImageFailed?: (imagePath: string, error: string) => void;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
let {
|
| 23 |
joyCaptionClient,
|
| 24 |
fluxClient,
|
| 25 |
-
gptOssClient
|
| 26 |
-
isTrainerMode = false,
|
| 27 |
-
onTrainerImageCompleted,
|
| 28 |
-
onTrainerImageFailed
|
| 29 |
}: Props = $props();
|
| 30 |
|
| 31 |
// GPT-OSS-120B text generation
|
|
@@ -83,9 +75,6 @@
|
|
| 83 |
let imageQueue: File[] = $state([]);
|
| 84 |
let currentImageIndex: number = $state(0);
|
| 85 |
|
| 86 |
-
// Track trainer image metadata when in trainer mode
|
| 87 |
-
let trainerImagePaths: string[] = $state([]);
|
| 88 |
-
|
| 89 |
const IMAGE_GENERATION_PROMPT = (concept: string) => `Extract ONLY the visual appearance from this monster concept and describe it in one concise sentence:
|
| 90 |
"${concept}"
|
| 91 |
|
|
@@ -187,13 +176,6 @@ Focus on: colors, body shape, eyes, limbs, mouth, and key visual features. Omit
|
|
| 187 |
if (currentImageIndex < imageQueue.length) {
|
| 188 |
// Process next image
|
| 189 |
setTimeout(() => processCurrentImage(), 1000); // Small delay for better UX
|
| 190 |
-
} else if (isTrainerMode) {
|
| 191 |
-
// In trainer mode, don't reset - wait for scanner to queue next image
|
| 192 |
-
console.log('🔧 DEBUG: Trainer mode - waiting for next image to be queued');
|
| 193 |
-
// Reset current image index for next image
|
| 194 |
-
currentImageIndex = 0;
|
| 195 |
-
imageQueue = [];
|
| 196 |
-
// Don't call reset() - stay ready to process next trainer image
|
| 197 |
} else {
|
| 198 |
// Queue completed - reset to single image mode
|
| 199 |
imageQueue = [];
|
|
@@ -230,8 +212,8 @@ Focus on: colors, body shape, eyes, limbs, mouth, and key visual features. Omit
|
|
| 230 |
|
| 231 |
workflowState.currentStep = 'complete';
|
| 232 |
|
| 233 |
-
// If processing a queue
|
| 234 |
-
if (imageQueue.length > 1
|
| 235 |
setTimeout(() => advanceToNextImage(), 2000); // 2 second delay to show completion
|
| 236 |
}
|
| 237 |
} catch (err) {
|
|
@@ -663,11 +645,6 @@ Create a concise visual description (1-3 sentences, max 100 words). Focus only o
|
|
| 663 |
|
| 664 |
const picletId = await savePicletInstance(picletInstance);
|
| 665 |
console.log('Piclet auto-saved as caught with ID:', picletId);
|
| 666 |
-
|
| 667 |
-
// If in trainer mode, notify completion
|
| 668 |
-
if (isTrainerMode && onTrainerImageCompleted && trainerImagePaths[currentImageIndex]) {
|
| 669 |
-
onTrainerImageCompleted(trainerImagePaths[currentImageIndex], picletId);
|
| 670 |
-
}
|
| 671 |
} catch (err) {
|
| 672 |
console.error('Failed to auto-save piclet:', err);
|
| 673 |
console.error('Piclet data that failed to save:', {
|
|
@@ -676,13 +653,7 @@ Create a concise visual description (1-3 sentences, max 100 words). Focus only o
|
|
| 676 |
hasImageData: !!workflowState.picletImage?.imageData,
|
| 677 |
hasStats: !!workflowState.picletStats
|
| 678 |
});
|
| 679 |
-
|
| 680 |
-
// If in trainer mode, notify failure
|
| 681 |
-
if (isTrainerMode && onTrainerImageFailed && trainerImagePaths[currentImageIndex]) {
|
| 682 |
-
const errorMessage = err instanceof Error ? err.message : 'Failed to save piclet';
|
| 683 |
-
onTrainerImageFailed(trainerImagePaths[currentImageIndex], errorMessage);
|
| 684 |
-
}
|
| 685 |
-
|
| 686 |
// Don't throw - we don't want to interrupt the workflow
|
| 687 |
}
|
| 688 |
}
|
|
@@ -715,21 +686,6 @@ Create a concise visual description (1-3 sentences, max 100 words). Focus only o
|
|
| 715 |
|
| 716 |
<div class="piclet-generator">
|
| 717 |
|
| 718 |
-
<!-- Text Generation Client Selector (hidden since only HunyuanTurbos is active) -->
|
| 719 |
-
<!--
|
| 720 |
-
{#if !isTrainerMode}
|
| 721 |
-
<div class="client-selector">
|
| 722 |
-
<label for="text-client">Text Generator:</label>
|
| 723 |
-
<select id="text-client" bind:value={currentTextClient}>
|
| 724 |
-
<option value="hunyuan">HunyuanTurbos</option>
|
| 725 |
-
<option value="command">Command</option>
|
| 726 |
-
<option value="zephyr">Zephyr-7B</option>
|
| 727 |
-
<option value="qwen">Qwen3</option>
|
| 728 |
-
<option value="dots">Dots-Demo</option>
|
| 729 |
-
</select>
|
| 730 |
-
</div>
|
| 731 |
-
{/if}
|
| 732 |
-
-->
|
| 733 |
|
| 734 |
{#if workflowState.currentStep !== 'upload'}
|
| 735 |
<WorkflowProgress currentStep={workflowState.currentStep} error={workflowState.error} />
|
|
|
|
| 12 |
import { CanonicalService } from '$lib/services/canonicalService';
|
| 13 |
// import { withQwenTimeout } from '$lib/utils/qwenTimeout'; // Unused since qwen is disabled
|
| 14 |
|
| 15 |
+
interface Props extends PicletGeneratorProps {}
|
| 16 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
let {
|
| 18 |
joyCaptionClient,
|
| 19 |
fluxClient,
|
| 20 |
+
gptOssClient
|
|
|
|
|
|
|
|
|
|
| 21 |
}: Props = $props();
|
| 22 |
|
| 23 |
// GPT-OSS-120B text generation
|
|
|
|
| 75 |
let imageQueue: File[] = $state([]);
|
| 76 |
let currentImageIndex: number = $state(0);
|
| 77 |
|
|
|
|
|
|
|
|
|
|
| 78 |
const IMAGE_GENERATION_PROMPT = (concept: string) => `Extract ONLY the visual appearance from this monster concept and describe it in one concise sentence:
|
| 79 |
"${concept}"
|
| 80 |
|
|
|
|
| 176 |
if (currentImageIndex < imageQueue.length) {
|
| 177 |
// Process next image
|
| 178 |
setTimeout(() => processCurrentImage(), 1000); // Small delay for better UX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
} else {
|
| 180 |
// Queue completed - reset to single image mode
|
| 181 |
imageQueue = [];
|
|
|
|
| 212 |
|
| 213 |
workflowState.currentStep = 'complete';
|
| 214 |
|
| 215 |
+
// If processing a queue, auto-advance to next image after a short delay
|
| 216 |
+
if (imageQueue.length > 1) {
|
| 217 |
setTimeout(() => advanceToNextImage(), 2000); // 2 second delay to show completion
|
| 218 |
}
|
| 219 |
} catch (err) {
|
|
|
|
| 645 |
|
| 646 |
const picletId = await savePicletInstance(picletInstance);
|
| 647 |
console.log('Piclet auto-saved as caught with ID:', picletId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
} catch (err) {
|
| 649 |
console.error('Failed to auto-save piclet:', err);
|
| 650 |
console.error('Piclet data that failed to save:', {
|
|
|
|
| 653 |
hasImageData: !!workflowState.picletImage?.imageData,
|
| 654 |
hasStats: !!workflowState.picletStats
|
| 655 |
});
|
| 656 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 657 |
// Don't throw - we don't want to interrupt the workflow
|
| 658 |
}
|
| 659 |
}
|
|
|
|
| 686 |
|
| 687 |
<div class="piclet-generator">
|
| 688 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 689 |
|
| 690 |
{#if workflowState.currentStep !== 'upload'}
|
| 691 |
<WorkflowProgress currentStep={workflowState.currentStep} error={workflowState.error} />
|