Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
99 lines (91 loc) · 2.61 KB
/
Copy pathtypes.ts
File metadata and controls
99 lines (91 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Standard UI Fields we support controlling
export enum UIFieldType {
POSITIVE_PROMPT = 'positive_prompt',
NEGATIVE_PROMPT = 'negative_prompt',
SEED = 'seed',
STEPS = 'steps',
CFG = 'cfg',
SAMPLER_NAME = 'sampler_name',
SCHEDULER = 'scheduler',
WIDTH = 'width',
HEIGHT = 'height',
BATCH_SIZE = 'batch_size',
MODEL = 'ckpt_name',
CLIP_MODEL = 'clip_name',
VAE_MODEL = 'vae_name',
LORA_1 = 'lora_name'
}
// ComfyUI API Types
export interface ComfyNode {
class_type: string;
inputs: Record<string, any>;
_meta?: {
title?: string;
};
}
export interface ComfyWorkflow {
[nodeId: string]: ComfyNode;
}
// Internal Application Types
export interface NodeMapping {
nodeId: string;
field: string;
}
export type UIMappings = Partial<Record<UIFieldType, NodeMapping>>;
export interface RecentImage {
id: string;
url: string;
timestamp: number;
prompt: string;
}
export interface AppState {
backendUrl: string;
commsClientId: string; // Used for actual communication (e.g., clientId=did=...)
backendStatus: boolean; // True if connected
workflow: ComfyWorkflow | null;
workflowName: string;
mappings: UIMappings;
uiValues: Record<UIFieldType, any>;
isSettingsOpen: boolean;
generationStatus: 'idle' | 'generating' | 'success' | 'error';
generatedImage: string | null;
errorMessage: string | null;
recentImages: RecentImage[];
activeAspectRatio: string; // e.g., "9:16"
activeStyle: string; // e.g., "Realistic"
isRandomSeed: boolean;
theme: 'dark' | 'light';
language: 'en' | 'zh';
}
export const DEFAULT_UI_VALUES: Record<UIFieldType, any> = {
[UIFieldType.POSITIVE_PROMPT]: "",
[UIFieldType.NEGATIVE_PROMPT]: "",
[UIFieldType.SEED]: -1,
[UIFieldType.STEPS]: 25,
[UIFieldType.CFG]: 7.0,
[UIFieldType.SAMPLER_NAME]: "euler",
[UIFieldType.SCHEDULER]: "normal",
[UIFieldType.WIDTH]: 544,
[UIFieldType.HEIGHT]: 960,
[UIFieldType.BATCH_SIZE]: 1,
[UIFieldType.MODEL]: "",
[UIFieldType.CLIP_MODEL]: "",
[UIFieldType.VAE_MODEL]: "",
[UIFieldType.LORA_1]: ""
};
export const FIELD_LABELS: Record<UIFieldType, string> = {
[UIFieldType.POSITIVE_PROMPT]: "Positive Prompt",
[UIFieldType.NEGATIVE_PROMPT]: "Negative Prompt",
[UIFieldType.SEED]: "Seed",
[UIFieldType.STEPS]: "Steps",
[UIFieldType.CFG]: "CFG Scale",
[UIFieldType.SAMPLER_NAME]: "Sampler",
[UIFieldType.SCHEDULER]: "Scheduler",
[UIFieldType.WIDTH]: "Width",
[UIFieldType.HEIGHT]: "Height",
[UIFieldType.BATCH_SIZE]: "Batch Size",
[UIFieldType.MODEL]: "Checkpoint Model",
[UIFieldType.CLIP_MODEL]: "CLIP Model",
[UIFieldType.VAE_MODEL]: "VAE Model",
[UIFieldType.LORA_1]: "LoRA 1"
};