tidy(ui): remove unused metadata schemas

This commit is contained in:
psychedelicious 2024-02-26 22:26:25 +11:00 committed by Kent Keirsey
parent 8b9f0a9551
commit 2367f53367
2 changed files with 0 additions and 202 deletions

View File

@ -1,28 +0,0 @@
import { z } from 'zod';
import { zControlField, zIPAdapterField, zModelFieldBase, zT2IAdapterField } from './common';
export const zLoRAWeight = z.number().nullish();
// #region Metadata-optimized versions of schemas
// TODO: It's possible that `deepPartial` will be deprecated:
// - https://github.com/colinhacks/zod/issues/2106
// - https://github.com/colinhacks/zod/issues/2854
export const zLoRAMetadataItem = z.object({
lora: zModelFieldBase.deepPartial(),
weight: zLoRAWeight,
});
const zControlNetMetadataItem = zControlField.merge(z.object({ control_model: z.unknown() })).deepPartial();
const zIPAdapterMetadataItem = zIPAdapterField.merge(z.object({ ip_adapter_model: z.unknown() })).deepPartial();
const zT2IAdapterMetadataItem = zT2IAdapterField.merge(z.object({ t2i_adapter_model: z.unknown() })).deepPartial();
const zSDXLRefinerModelMetadataItem = z.unknown();
const zModelMetadataItem = z.unknown();
const zVAEModelMetadataItem = z.unknown();
export type LoRAMetadataItem = z.infer<typeof zLoRAMetadataItem>;
export type ControlNetMetadataItem = z.infer<typeof zControlNetMetadataItem>;
export type IPAdapterMetadataItem = z.infer<typeof zIPAdapterMetadataItem>;
export type T2IAdapterMetadataItem = z.infer<typeof zT2IAdapterMetadataItem>;
export type SDXLRefinerModelMetadataItem = z.infer<typeof zSDXLRefinerModelMetadataItem>;
export type ModelMetadataItem = z.infer<typeof zModelMetadataItem>;
export type VAEModelMetadataItem = z.infer<typeof zVAEModelMetadataItem>;
// #endregion

View File

@ -1,174 +0,0 @@
export default {};
// python metadata parsing tests to rebuild
// # def test_is_good_metadata_unchanged():
// # parsed_metadata = metadata_service._parse_invokeai_metadata(valid_metadata)
// # expected = deepcopy(valid_metadata)
// # assert expected == parsed_metadata
// # def test_can_parse_missing_session_id():
// # metadata_missing_session_id = deepcopy(valid_metadata)
// # del metadata_missing_session_id["session_id"]
// # expected = deepcopy(valid_metadata)
// # del expected["session_id"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_missing_session_id
// # )
// # assert metadata_missing_session_id == parsed_metadata
// # def test_can_parse_invalid_session_id():
// # metadata_invalid_session_id = deepcopy(valid_metadata)
// # metadata_invalid_session_id["session_id"] = 123
// # expected = deepcopy(valid_metadata)
// # del expected["session_id"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_invalid_session_id
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_missing_node():
// # metadata_missing_node = deepcopy(valid_metadata)
// # del metadata_missing_node["node"]
// # expected = deepcopy(valid_metadata)
// # del expected["node"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(metadata_missing_node)
// # assert expected == parsed_metadata
// # def test_can_parse_invalid_node():
// # metadata_invalid_node = deepcopy(valid_metadata)
// # metadata_invalid_node["node"] = 123
// # expected = deepcopy(valid_metadata)
// # del expected["node"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(metadata_invalid_node)
// # assert expected == parsed_metadata
// # def test_can_parse_missing_node_id():
// # metadata_missing_node_id = deepcopy(valid_metadata)
// # del metadata_missing_node_id["node"]["id"]
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["id"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_missing_node_id
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_invalid_node_id():
// # metadata_invalid_node_id = deepcopy(valid_metadata)
// # metadata_invalid_node_id["node"]["id"] = 123
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["id"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_invalid_node_id
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_missing_node_type():
// # metadata_missing_node_type = deepcopy(valid_metadata)
// # del metadata_missing_node_type["node"]["type"]
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["type"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_missing_node_type
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_invalid_node_type():
// # metadata_invalid_node_type = deepcopy(valid_metadata)
// # metadata_invalid_node_type["node"]["type"] = 123
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["type"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_invalid_node_type
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_no_node_attrs():
// # metadata_no_node_attrs = deepcopy(valid_metadata)
// # metadata_no_node_attrs["node"] = {}
// # expected = deepcopy(valid_metadata)
// # del expected["node"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(metadata_no_node_attrs)
// # assert expected == parsed_metadata
// # def test_can_parse_array_attr():
// # metadata_array_attr = deepcopy(valid_metadata)
// # metadata_array_attr["node"]["seed"] = [1, 2, 3]
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["seed"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(metadata_array_attr)
// # assert expected == parsed_metadata
// # def test_can_parse_invalid_dict_attr():
// # metadata_invalid_dict_attr = deepcopy(valid_metadata)
// # metadata_invalid_dict_attr["node"]["seed"] = {"a": 1}
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["seed"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_invalid_dict_attr
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_missing_image_field_image_type():
// # metadata_missing_image_field_image_type = deepcopy(valid_metadata)
// # del metadata_missing_image_field_image_type["node"]["image"]["image_type"]
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["image"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_missing_image_field_image_type
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_invalid_image_field_image_type():
// # metadata_invalid_image_field_image_type = deepcopy(valid_metadata)
// # metadata_invalid_image_field_image_type["node"]["image"][
// # "image_type"
// # ] = "bad image type"
// # expected = deepcopy(valid_metadata)
// # del expected["node"]["image"]
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_invalid_image_field_image_type
// # )
// # assert expected == parsed_metadata
// # def test_can_parse_invalid_latents_field_latents_name():
// # metadata_invalid_latents_field_latents_name = deepcopy(valid_metadata)
// # metadata_invalid_latents_field_latents_name["node"]["latents"] = {
// # "latents_name": 123
// # }
// # expected = deepcopy(valid_metadata)
// # parsed_metadata = metadata_service._parse_invokeai_metadata(
// # metadata_invalid_latents_field_latents_name
// # )
// # assert expected == parsed_metadata