mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-19 03:24:37 -05:00
This is a squash merge of a bajillion messy small commits created while iterating on the UI component library and redesign.
30 lines
763 B
TypeScript
30 lines
763 B
TypeScript
import { logger } from 'app/logging/logger';
|
|
import type { ParameterSDXLRefinerModel } from 'features/parameters/types/parameterSchemas';
|
|
import { zParameterSDXLRefinerModel } from 'features/parameters/types/parameterSchemas';
|
|
|
|
export const modelIdToSDXLRefinerModelParam = (
|
|
mainModelId: string
|
|
): ParameterSDXLRefinerModel | undefined => {
|
|
const log = logger('models');
|
|
const [base_model, model_type, model_name] = mainModelId.split('/');
|
|
|
|
const result = zParameterSDXLRefinerModel.safeParse({
|
|
base_model,
|
|
model_name,
|
|
model_type,
|
|
});
|
|
|
|
if (!result.success) {
|
|
log.error(
|
|
{
|
|
mainModelId,
|
|
errors: result.error.format(),
|
|
},
|
|
'Failed to parse main model id'
|
|
);
|
|
return;
|
|
}
|
|
|
|
return result.data;
|
|
};
|