feat: allow users to edit models freely

This commit is contained in:
psychedelicious
2025-10-10 14:18:29 +11:00
parent ca0bdac18c
commit fca6ee3c9d
3 changed files with 30 additions and 40 deletions

View File

@@ -301,7 +301,7 @@ async def update_model_record(
logger = ApiDependencies.invoker.services.logger
record_store = ApiDependencies.invoker.services.model_manager.store
try:
config = record_store.update_model(key, changes=changes)
config = record_store.update_model(key, changes=changes, allow_class_change=True)
config = add_cover_image_to_model_config(config, ApiDependencies)
logger.info(f"Updated model: {key}")
except UnknownModelException as e:

View File

@@ -123,11 +123,9 @@ export const ModelEdit = memo(({ modelConfig }: Props) => {
<Textarea {...form.register('description')} minH={32} />
</FormControl>
</Flex>
{modelConfig.type !== 'clip_vision' && (
<Heading as="h3" fontSize="md" mt="4">
{t('modelManager.modelSettings')}
</Heading>
)}
<Heading as="h3" fontSize="md" mt="4">
{t('modelManager.modelSettings')}
</Heading>
<SimpleGrid columns={2} gap={4}>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.modelType')}</FormLabel>
@@ -137,34 +135,26 @@ export const ModelEdit = memo(({ modelConfig }: Props) => {
<FormLabel>{t('modelManager.modelFormat')}</FormLabel>
<ModelFormatSelect control={form.control} />
</FormControl>
{modelConfig.type !== 'clip_vision' && (
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.baseModel')}</FormLabel>
<BaseModelSelect control={form.control} />
</FormControl>
)}
{modelConfig.type === 'main' && (
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.variant')}</FormLabel>
<ModelVariantSelect control={form.control} />
</FormControl>
)}
{modelConfig.type === 'main' && modelConfig.format === 'checkpoint' && (
<>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.pathToConfig')}</FormLabel>
<Input {...form.register('config_path', stringFieldOptions)} />
</FormControl>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.predictionType')}</FormLabel>
<PredictionTypeSelect control={form.control} />
</FormControl>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.upcastAttention')}</FormLabel>
<Checkbox {...form.register('upcast_attention')} />
</FormControl>
</>
)}
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.baseModel')}</FormLabel>
<BaseModelSelect control={form.control} />
</FormControl>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.variant')}</FormLabel>
<ModelVariantSelect control={form.control} />
</FormControl>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.pathToConfig')}</FormLabel>
<Input {...form.register('config_path')} />
</FormControl>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.predictionType')}</FormLabel>
<PredictionTypeSelect control={form.control} />
</FormControl>
<FormControl flexDir="column" alignItems="flex-start" gap={1}>
<FormLabel>{t('modelManager.upcastAttention')}</FormLabel>
<Checkbox {...form.register('upcast_attention')} />
</FormControl>
</SimpleGrid>
</Flex>
</form>

View File

@@ -7204,7 +7204,7 @@ export type components = {
/**
* Use Cache
* @description Whether or not to use the cache
* @default false
* @default true
*/
use_cache?: boolean;
/**
@@ -20477,7 +20477,7 @@ export type components = {
/**
* Use Cache
* @description Whether or not to use the cache
* @default false
* @default true
*/
use_cache?: boolean;
/**
@@ -20524,7 +20524,7 @@ export type components = {
/**
* Use Cache
* @description Whether or not to use the cache
* @default false
* @default true
*/
use_cache?: boolean;
/**
@@ -20565,7 +20565,7 @@ export type components = {
/**
* Use Cache
* @description Whether or not to use the cache
* @default false
* @default true
*/
use_cache?: boolean;
/**
@@ -21656,7 +21656,7 @@ export type components = {
/**
* Use Cache
* @description Whether or not to use the cache
* @default false
* @default true
*/
use_cache?: boolean;
/**
@@ -24545,7 +24545,7 @@ export type components = {
};
/**
* Unknown_Config
* @description Model config for unknown models, used as a fallback when we cannot identify a model.
* @description Model config for unknown models, used as a fallback when we cannot positively identify a model.
*/
Unknown_Config: {
/**