mirror of
https://github.com/ostris/ai-toolkit.git
synced 2026-04-30 11:11:37 +00:00
Built out the ui trainer plugin with db comminication
This commit is contained in:
@@ -19,8 +19,9 @@ export const defaultJobConfig: JobConfig = {
|
||||
name: 'my_first_flex_lora_v1',
|
||||
process: [
|
||||
{
|
||||
type: 'sd_trainer',
|
||||
type: 'ui_trainer',
|
||||
training_folder: 'output',
|
||||
sqlite_db_path: './aitk_db.db',
|
||||
device: 'cuda:0',
|
||||
network: {
|
||||
type: 'lora',
|
||||
|
||||
@@ -51,10 +51,29 @@ export const NumberInput = (props: NumberInputProps) => {
|
||||
type="number"
|
||||
value={value}
|
||||
onChange={(e) => {
|
||||
let value = Number(e.target.value);
|
||||
if (isNaN(value)) value = 0;
|
||||
// Use parseFloat instead of Number to properly handle decimal values
|
||||
const rawValue = e.target.value;
|
||||
|
||||
// Special handling for empty or partial inputs
|
||||
if (rawValue === '' || rawValue === '-' || rawValue === '.') {
|
||||
// For empty or partial inputs (like just a minus sign or decimal point),
|
||||
// we need to maintain the raw input in the input field
|
||||
// but pass a valid number to onChange
|
||||
onChange(0);
|
||||
return;
|
||||
}
|
||||
|
||||
let value = parseFloat(rawValue);
|
||||
|
||||
// Handle NaN cases
|
||||
if (isNaN(value)) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
// Apply min/max constraints only for valid numbers
|
||||
if (min !== undefined && value < min) value = min;
|
||||
if (max !== undefined && value > max) value = max;
|
||||
|
||||
onChange(value);
|
||||
}}
|
||||
className={inputClasses}
|
||||
@@ -62,6 +81,8 @@ export const NumberInput = (props: NumberInputProps) => {
|
||||
required={required}
|
||||
min={min}
|
||||
max={max}
|
||||
// Allow decimal points
|
||||
step="any"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -121,7 +121,8 @@ export interface SampleConfig {
|
||||
}
|
||||
|
||||
export interface ProcessConfig {
|
||||
type: 'sd_trainer';
|
||||
type: 'ui_trainer';
|
||||
sqlite_db_path?: string;
|
||||
training_folder: string;
|
||||
device: string;
|
||||
network?: NetworkConfig;
|
||||
|
||||
Reference in New Issue
Block a user