diff --git a/frontend/libs/components/model-selector/src/lib/model-lists.tsx b/frontend/libs/components/model-selector/src/lib/model-lists.tsx index b08889260d..42c912e7bd 100644 --- a/frontend/libs/components/model-selector/src/lib/model-lists.tsx +++ b/frontend/libs/components/model-selector/src/lib/model-lists.tsx @@ -4,10 +4,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { getCreatorIcon, Model, - ModelConfig, - CANVAS_2D_PAGE_MODELS, - STAGE_3D_PAGE_MODELS, - IMAGE_EDITOR_PAGE_MODELS, VIDEO_MODELS, IMAGE_MODELS, } from "@storyteller/model-list"; @@ -17,22 +13,6 @@ export type ModelList = Omit[]; const withIcon = (creatorIcon: any, fallback: any) => creatorIcon || fallback; -const buildItems = ( - models: ModelConfig[], - fallbackIcon: any -) => - models.map((m) => ({ - label: m.label, - icon: withIcon(getCreatorIcon(m.info.creator), fallbackIcon), - description: m.description, - badges: m.badges?.map((b) => ({ - label: b.label, - icon: , - })), - modelConfig: m, // Access to full object. - modelInfo: m.info, - })); - const buildItems2 = ( models: Model[], fallbackIcon: any @@ -46,7 +26,6 @@ const buildItems2 = ( icon: , })), modelConfig: model.toLegacyModelConfig(), // Access to full object. - modelInfo: undefined, // NB: Dead. model: model, })); diff --git a/frontend/libs/model-list/src/lib/Models.ts b/frontend/libs/model-list/src/lib/Models.ts index 401059af07..a54b55c4fc 100644 --- a/frontend/libs/model-list/src/lib/Models.ts +++ b/frontend/libs/model-list/src/lib/Models.ts @@ -30,7 +30,7 @@ const cfg = ( ...m, }); -export const ALL_MODELS: ModelConfig[] = [ +const ALL_MODELS: ModelConfig[] = [ ////////////////////////////// // Image models ////////////////////////////// diff --git a/frontend/libs/model-list/src/lib/ModelsByPage.ts b/frontend/libs/model-list/src/lib/ModelsByPage.ts index 3e997a429c..08c65a1275 100644 --- a/frontend/libs/model-list/src/lib/ModelsByPage.ts +++ b/frontend/libs/model-list/src/lib/ModelsByPage.ts @@ -1,7 +1,3 @@ -import { ALL_MODELS_BY_ID } from "./Models.js"; -import { ModelConfig } from "./ModelConfig.js"; -import { ModelTag } from "./ModelTag.js"; -import { getModelsByCategory } from "./Models.js"; /** * We might not want to always programatically build the list of models, because @@ -9,28 +5,32 @@ import { getModelsByCategory } from "./Models.js"; * more popular models. We may also want to selectively prune non-useful models. */ -export const TEXT_TO_IMAGE_PAGE_MODELS : ModelConfig[] = - getModelsByCategory("image") - // Remove inpainting and editing models. - .filter((m) => m.id !== "flux_pro_inpaint") - .filter((m) => m.id !== "flux_pro_kontext_max"); +// export const TEXT_TO_IMAGE_PAGE_MODELS : ModelConfig[] = +// getModelsByCategory("image") +// // Remove inpainting and editing models. +// .filter((m) => m.id !== "flux_pro_inpaint") +// .filter((m) => m.id !== "flux_pro_kontext_max"); -export const IMAGE_TO_VIDEO_PAGE_MODELS : ModelConfig[] = - getModelsByCategory("video"); +// export const IMAGE_TO_VIDEO_PAGE_MODELS : ModelConfig[] = +// getModelsByCategory("video"); -export const CANVAS_2D_PAGE_MODELS : ModelConfig[] = - getModelsByCategory("image") - // Remove non-instructive models. - .filter((m) => m.tags?.includes(ModelTag.InstructiveEdit)) +// export const CANVAS_2D_PAGE_MODELS : ModelConfig[] = +// getModelsByCategory("image") +// // Remove non-instructive models. +// .filter((m) => m.tags?.includes(ModelTag.InstructiveEdit)) -export const STAGE_3D_PAGE_MODELS : ModelConfig[] = - getModelsByCategory("image") - // Remove non-instructive models. - .filter((m) => m.tags?.includes(ModelTag.InstructiveEdit)) +// export const STAGE_3D_PAGE_MODELS : ModelConfig[] = +// getModelsByCategory("image") +// // Remove non-instructive models. +// .filter((m) => m.tags?.includes(ModelTag.InstructiveEdit)) -export const IMAGE_EDITOR_PAGE_MODELS : ModelConfig[] = [ - // Explicit list for now. - ALL_MODELS_BY_ID.get("flux_pro_inpaint")!, - ALL_MODELS_BY_ID.get("flux_dev_juggernaut_inpaint")!, - ALL_MODELS_BY_ID.get("flux_pro_kontext_max")!, -]; +// export const IMAGE_EDITOR_PAGE_MODELS : ModelConfig[] = [ +// // Explicit list for now. +// ALL_MODELS_BY_ID.get("flux_pro_inpaint")!, +// ALL_MODELS_BY_ID.get("flux_dev_juggernaut_inpaint")!, +// ALL_MODELS_BY_ID.get("flux_pro_kontext_max")!, +// ]; + +// export const CANVAS_2D_PAGE_MODELS_NEW : ImageModel[] = IMAGE_MODELS +// // Remove non-instructive models. +// .filter((m) => m.tags?.includes(ModelTag.InstructiveEdit)) \ No newline at end of file diff --git a/frontend/libs/model-list/src/lib/lists/AllModelsById.ts b/frontend/libs/model-list/src/lib/lists/AllModelsById.ts new file mode 100644 index 0000000000..c2088f6fdc --- /dev/null +++ b/frontend/libs/model-list/src/lib/lists/AllModelsById.ts @@ -0,0 +1,10 @@ +import { Model } from "../classes/Model.js"; +import { ALL_MODELS_LIST } from "./AllModels.js"; + +export const ALL_MODELS_BY_ID : Map = new Map( + ALL_MODELS_LIST.map((model) => [model.id, model]) +); + +if (ALL_MODELS_BY_ID.size !== ALL_MODELS_LIST.length) { + throw new Error("All models must have unique IDs"); +}