mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
slightly better types
This commit is contained in:
parent
d72acf137e
commit
50ccffe391
6 changed files with 36 additions and 31 deletions
|
|
@ -21,12 +21,12 @@ interface CommandLineArgumentsModalProps {
|
||||||
|
|
||||||
interface ArgumentInfo {
|
interface ArgumentInfo {
|
||||||
flag: string;
|
flag: string;
|
||||||
aliases?: string[];
|
aliases?: readonly string[];
|
||||||
description: string;
|
description: string;
|
||||||
metavar?: string;
|
metavar?: string;
|
||||||
default?: string | number;
|
default?: string | number;
|
||||||
type?: string;
|
type?: string;
|
||||||
choices?: string[];
|
choices?: readonly string[];
|
||||||
category: string;
|
category: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,11 +61,16 @@ const UI_COVERED_ARGS = new Set([
|
||||||
'--sdlora',
|
'--sdlora',
|
||||||
'--sdflashattention',
|
'--sdflashattention',
|
||||||
'--sdconvdirect',
|
'--sdconvdirect',
|
||||||
]);
|
] as const) as ReadonlySet<string>;
|
||||||
|
|
||||||
const IGNORED_ARGS = new Set(['--cli', '--version', '--launch', '--config']);
|
const IGNORED_ARGS = new Set([
|
||||||
|
'--cli',
|
||||||
|
'--version',
|
||||||
|
'--launch',
|
||||||
|
'--config',
|
||||||
|
] as const) as ReadonlySet<string>;
|
||||||
|
|
||||||
const COMMAND_LINE_ARGUMENTS: ArgumentInfo[] = [
|
const COMMAND_LINE_ARGUMENTS = [
|
||||||
{
|
{
|
||||||
flag: '--threads',
|
flag: '--threads',
|
||||||
aliases: ['-t'],
|
aliases: ['-t'],
|
||||||
|
|
@ -487,7 +492,7 @@ const COMMAND_LINE_ARGUMENTS: ArgumentInfo[] = [
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
category: 'Embeddings',
|
category: 'Embeddings',
|
||||||
},
|
},
|
||||||
];
|
] as const;
|
||||||
|
|
||||||
const AVAILABLE_ARGUMENTS = COMMAND_LINE_ARGUMENTS.filter(
|
const AVAILABLE_ARGUMENTS = COMMAND_LINE_ARGUMENTS.filter(
|
||||||
(arg) => !UI_COVERED_ARGS.has(arg.flag) && !IGNORED_ARGS.has(arg.flag)
|
(arg) => !UI_COVERED_ARGS.has(arg.flag) && !IGNORED_ARGS.has(arg.flag)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
export interface ImageModelPreset {
|
export interface ImageModelPreset {
|
||||||
name: string;
|
readonly name: string;
|
||||||
description?: string;
|
readonly description?: string;
|
||||||
sdmodel: string;
|
readonly sdmodel: string;
|
||||||
sdt5xxl: string;
|
readonly sdt5xxl: string;
|
||||||
sdclipl: string;
|
readonly sdclipl: string;
|
||||||
sdclipg: string;
|
readonly sdclipg: string;
|
||||||
sdphotomaker: string;
|
readonly sdphotomaker: string;
|
||||||
sdvae: string;
|
readonly sdvae: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IMAGE_MODEL_PRESETS: ImageModelPreset[] = [
|
export const IMAGE_MODEL_PRESETS = [
|
||||||
{
|
{
|
||||||
name: 'FLUX.1',
|
name: 'FLUX.1',
|
||||||
description: 'FLUX.1 development model with default encoders',
|
description: 'FLUX.1 development model with default encoders',
|
||||||
|
|
@ -38,4 +38,4 @@ export const IMAGE_MODEL_PRESETS: ImageModelPreset[] = [
|
||||||
sdvae:
|
sdvae:
|
||||||
'https://huggingface.co/lodestones/Chroma/resolve/main/ae.safetensors?download=true',
|
'https://huggingface.co/lodestones/Chroma/resolve/main/ae.safetensors?download=true',
|
||||||
},
|
},
|
||||||
];
|
] as const;
|
||||||
|
|
|
||||||
|
|
@ -153,10 +153,10 @@ async function detectCUDA() {
|
||||||
return {
|
return {
|
||||||
supported: devices.length > 0,
|
supported: devices.length > 0,
|
||||||
devices,
|
devices,
|
||||||
};
|
} as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { supported: false, devices: [] };
|
return { supported: false, devices: [] } as const;
|
||||||
} catch {
|
} catch {
|
||||||
return { supported: false, devices: [] };
|
return { supported: false, devices: [] };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
src/types/hardware.d.ts
vendored
20
src/types/hardware.d.ts
vendored
|
|
@ -11,20 +11,20 @@ export interface GPUMemoryInfo {
|
||||||
|
|
||||||
export interface GPUCapabilities {
|
export interface GPUCapabilities {
|
||||||
cuda: {
|
cuda: {
|
||||||
supported: boolean;
|
readonly supported: boolean;
|
||||||
devices: string[];
|
readonly devices: readonly string[];
|
||||||
};
|
};
|
||||||
rocm: {
|
rocm: {
|
||||||
supported: boolean;
|
readonly supported: boolean;
|
||||||
devices: string[];
|
readonly devices: readonly string[];
|
||||||
};
|
};
|
||||||
vulkan: {
|
vulkan: {
|
||||||
supported: boolean;
|
readonly supported: boolean;
|
||||||
devices: string[];
|
readonly devices: readonly string[];
|
||||||
};
|
};
|
||||||
clblast: {
|
clblast: {
|
||||||
supported: boolean;
|
readonly supported: boolean;
|
||||||
devices: string[];
|
readonly devices: readonly string[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,8 +35,8 @@ export interface BasicGPUInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HardwareDetectionResult {
|
export interface HardwareDetectionResult {
|
||||||
supported: boolean;
|
readonly supported: boolean;
|
||||||
devices: string[];
|
readonly devices: readonly string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HardwareInfo {
|
export interface HardwareInfo {
|
||||||
|
|
|
||||||
4
src/types/index.d.ts
vendored
4
src/types/index.d.ts
vendored
|
|
@ -53,8 +53,8 @@ export interface SelectOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BackendOption extends SelectOption {
|
export interface BackendOption extends SelectOption {
|
||||||
devices?: string[];
|
readonly devices?: readonly string[];
|
||||||
disabled?: boolean;
|
readonly disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BackendSupport {
|
export interface BackendSupport {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ export function getAvailableInterfaceOptions({
|
||||||
...chatItems,
|
...chatItems,
|
||||||
{ value: 'terminal', label: 'Terminal' },
|
{ value: 'terminal', label: 'Terminal' },
|
||||||
{ value: 'eject', label: 'Eject' },
|
{ value: 'eject', label: 'Eject' },
|
||||||
];
|
] as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDefaultInterfaceTab({
|
export function getDefaultInterfaceTab({
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue