mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-25 18:49:38 +00:00
make model_weights descriptions optional
- these will be bad to have on low-value weights, eg. zero shot. - want to capture this change now
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n\nON DUPLICATE KEY UPDATE\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 43
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "0a392b6adb884a4bb4c08fbc2123d40c27e9fbb5c2b688b182f849b0c1cc5735"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n UPDATE model_weights\n SET\n title = COALESCE(?, title),\n maybe_description_markdown = COALESCE(?, maybe_description_markdown),\n maybe_description_rendered_html = COALESCE(?, maybe_description_rendered_html),\n creator_set_visibility = COALESCE(?, creator_set_visibility),\n version = version + 1\n WHERE token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 5
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "0e95df24f6301525e59cc281cca9cc8e95f6b58e8abbd0b4404ab0b1a699e71c"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n UPDATE model_weights\n SET\n title = COALESCE(?, title),\n description_markdown = COALESCE(?, description_markdown),\n description_rendered_html = COALESCE(?, description_rendered_html),\n creator_set_visibility = COALESCE(?, creator_set_visibility),\n version = version + 1\n WHERE token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 5
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "4aeff65c652a5db1a09d65af1c828c2a018eeb979ede924264c6d90a698bfac4"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n\n maybe_cover_image_media_file_token = NULL,\n description_markdown = \"\",\n description_rendered_html = \"\",\n\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 15
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "5498a76dbb2b6a6c3a94e4c143b7863d4b2ac4b63820658f02e538f7d4213cc7"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = NULL,\n maybe_description_rendered_html = NULL,\n\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 15
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "6512f05410514927b52b8cc42f4eda0ad7a256254fd7fcf3b8a1cc429b06ad38"
|
||||
}
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.description_markdown,\n wt.description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n ",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -45,20 +45,20 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "description_markdown",
|
||||
"name": "maybe_description_markdown",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description_rendered_html",
|
||||
"name": "maybe_description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
@@ -342,8 +342,8 @@
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
@@ -373,5 +373,5 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "c26943bde6d2364f0f1594dfbf4fa40c8f94706f1cc413aea6bf213df5d533d5"
|
||||
"hash": "7d3806f46b5cc96c0e3df22454190834c0294ad34db2d8271f2e2863a3cca3a1"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n INSERT INTO model_weights\n SET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = ?,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = ?,\n cached_user_ratings_positive_count = ?,\n cached_user_ratings_negative_count = ?,\n maybe_cached_user_ratings_ratio = ?,\n version = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 22
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "839a90609725c9dd5d916e111c97d50fd2f6f4084024b4b706df3e8cf91753c6"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n INSERT INTO model_weights\n SET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = ?,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = ?,\n cached_user_ratings_positive_count = ?,\n cached_user_ratings_negative_count = ?,\n maybe_cached_user_ratings_ratio = ?,\n version = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 22
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "a18c5b1418d71fa9aefd3ae5c440be2afc1f9467808aa66d3b850a4d54c81e4d"
|
||||
}
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.description_markdown,\n wt.description_rendered_html,\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -45,20 +45,20 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "description_markdown",
|
||||
"name": "maybe_description_markdown",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description_rendered_html",
|
||||
"name": "maybe_description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
@@ -342,8 +342,8 @@
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
@@ -373,5 +373,5 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "b15b16149e6a765de1949cc77dd8b38188295df583de5214baa5e2d66782ef59"
|
||||
"hash": "bb2c5a81ab6f38ecef7ee177a4ea36e75c5d2180a897094f940f097bbbd66060"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n\nON DUPLICATE KEY UPDATE\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 43
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "ec1a3b0dfea8dfded94efac1b90fe3ebd0345e5b49fddbbe126cca7569698629"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE maybe_description_markdown description_markdown TEXT NOT NULL;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE maybe_description_rendered_html description_rendered_html TEXT NOT NULL;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE description_markdown maybe_description_markdown TEXT DEFAULT NULL;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE description_rendered_html maybe_description_rendered_html TEXT DEFAULT NULL;
|
||||
@@ -44,10 +44,14 @@ CREATE TABLE model_weights (
|
||||
maybe_cover_image_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The description of the model in markdown.
|
||||
description_markdown TEXT NOT NULL,
|
||||
-- This is optional, since not all weights are of the same caliber (eg. zero shot models
|
||||
-- don't deserve a description).
|
||||
maybe_description_markdown TEXT DEFAULT NULL,
|
||||
|
||||
-- Generated HTML (not user-editable).
|
||||
description_rendered_html TEXT NOT NULL,
|
||||
-- This is optional, since not all weights are of the same caliber (eg. zero shot
|
||||
-- models don't deserve a description).
|
||||
maybe_description_rendered_html TEXT DEFAULT NULL,
|
||||
|
||||
|
||||
-- ========== CREATOR DETAILS ==========
|
||||
|
||||
@@ -305,8 +305,8 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
weights_type: weights_types, // replace with actual WeightsType
|
||||
weights_category, // replace with actual WeightsCategory
|
||||
title,
|
||||
description_markdown: description,
|
||||
description_rendered_html: description_rendered_html.to_string(),
|
||||
maybe_description_markdown: Some(description),
|
||||
maybe_description_rendered_html: Some(description_rendered_html.to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -350,8 +350,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -375,8 +375,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::HifiganTacotron2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::TextToSpeech, // replace with actual WeightsCategory
|
||||
title: "Title 2".to_string(),
|
||||
description_markdown: "Description 2".to_string(),
|
||||
description_rendered_html: "<p>Description 2</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 2".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 2</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "292.268.2.2",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -400,8 +400,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 3".to_string(),
|
||||
description_markdown: "Description 3".to_string(),
|
||||
description_rendered_html: "<p>Description 3</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 3".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 3</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "392.368.3.3",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -425,8 +425,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 4".to_string(),
|
||||
description_markdown: "Description 4".to_string(),
|
||||
description_rendered_html: "<p>Description 4</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 4".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 4</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -450,8 +450,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 5".to_string(),
|
||||
description_markdown: "Description 4".to_string(),
|
||||
description_rendered_html: "<p>Description 4</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 4".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 4</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -501,8 +501,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -526,8 +526,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::HifiganTacotron2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::TextToSpeech, // replace with actual WeightsCategory
|
||||
title: "Title 2".to_string(),
|
||||
description_markdown: "Description 2".to_string(),
|
||||
description_rendered_html: "<p>Description 2</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 2".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 2</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token2), // replace with actual UserToken
|
||||
creator_ip_address: "292.268.2.2",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -551,8 +551,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 3".to_string(),
|
||||
description_markdown: "Description 3".to_string(),
|
||||
description_rendered_html: "<p>Description 3</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 3".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 3</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token3), // replace with actual UserToken
|
||||
creator_ip_address: "392.368.3.3",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -576,8 +576,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 4".to_string(),
|
||||
description_markdown: "Description 4".to_string(),
|
||||
description_rendered_html: "<p>Description 4</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 4".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 4</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token4), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -601,8 +601,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 5".to_string(),
|
||||
description_markdown: "Description 5".to_string(),
|
||||
description_rendered_html: "<p>Description 5</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 5".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 5</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token5), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
|
||||
@@ -129,8 +129,8 @@ pub async fn seed_weights_files(
|
||||
weights_type, // Assuming weights_type is defined elsewhere
|
||||
weights_category, // Assuming weights_category is defined elsewhere
|
||||
title: title.to_string(),
|
||||
description_markdown: description.to_string(),
|
||||
description_rendered_html: description_rendered_html.to_string(),
|
||||
maybe_description_markdown: Some(description.to_string()),
|
||||
maybe_description_rendered_html: Some(description_rendered_html.to_string()),
|
||||
creator_user_token: Some(&user_token),
|
||||
creator_ip_address: "127.0.0.1", // Assuming the IP address is localhost
|
||||
creator_set_visibility: Visibility::Public, // Assuming the visibility is public
|
||||
|
||||
+2
-2
@@ -64,8 +64,8 @@ SET
|
||||
title = ?,
|
||||
|
||||
maybe_cover_image_media_file_token = NULL,
|
||||
description_markdown = "",
|
||||
description_rendered_html = "",
|
||||
maybe_description_markdown = NULL,
|
||||
maybe_description_rendered_html = NULL,
|
||||
|
||||
maybe_last_update_user_token = NULL,
|
||||
original_download_url = ?,
|
||||
|
||||
@@ -13,8 +13,8 @@ pub struct CreateModelWeightsArgs<'a> {
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub title: String,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
pub creator_user_token: Option<&'a UserToken>,
|
||||
pub creator_ip_address: &'a str,
|
||||
pub creator_set_visibility: Visibility,
|
||||
@@ -46,8 +46,8 @@ pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult<Mod
|
||||
weights_type = ?,
|
||||
weights_category = ?,
|
||||
title = ?,
|
||||
description_markdown = ?,
|
||||
description_rendered_html = ?,
|
||||
maybe_description_markdown = ?,
|
||||
maybe_description_rendered_html = ?,
|
||||
creator_user_token = ?,
|
||||
creator_ip_address = ?,
|
||||
creator_set_visibility = ?,
|
||||
@@ -69,8 +69,8 @@ pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult<Mod
|
||||
args.weights_type.to_str(),
|
||||
args.weights_category.to_str(),
|
||||
args.title,
|
||||
args.description_markdown,
|
||||
args.description_rendered_html,
|
||||
args.maybe_description_markdown,
|
||||
args.maybe_description_rendered_html,
|
||||
args.creator_user_token.as_deref(),
|
||||
args.creator_ip_address,
|
||||
args.creator_set_visibility.to_str(),
|
||||
|
||||
@@ -8,8 +8,8 @@ use tokens::tokens::model_weights::ModelWeightToken;
|
||||
pub struct UpdateWeightArgs<'a> {
|
||||
pub weight_token: &'a ModelWeightToken,
|
||||
pub title: Option<&'a str>,
|
||||
pub description_markdown: Option<&'a str>,
|
||||
pub description_rendered_html: Option<&'a str>,
|
||||
pub maybe_description_markdown: Option<&'a str>,
|
||||
pub maybe_description_rendered_html: Option<&'a str>,
|
||||
pub creator_set_visibility: Option<&'a Visibility>,
|
||||
pub weights_type: Option<String>,
|
||||
pub weights_category: Option<String>,
|
||||
@@ -25,15 +25,15 @@ pub async fn update_weights(args: UpdateWeightArgs<'_>) -> AnyhowResult<()> {
|
||||
UPDATE model_weights
|
||||
SET
|
||||
title = COALESCE(?, title),
|
||||
description_markdown = COALESCE(?, description_markdown),
|
||||
description_rendered_html = COALESCE(?, description_rendered_html),
|
||||
maybe_description_markdown = COALESCE(?, maybe_description_markdown),
|
||||
maybe_description_rendered_html = COALESCE(?, maybe_description_rendered_html),
|
||||
creator_set_visibility = COALESCE(?, creator_set_visibility),
|
||||
version = version + 1
|
||||
WHERE token = ?
|
||||
"#,
|
||||
args.title.as_deref(),
|
||||
args.description_markdown.as_deref(),
|
||||
args.description_rendered_html.as_deref(),
|
||||
args.maybe_description_markdown.as_deref(),
|
||||
args.maybe_description_rendered_html.as_deref(),
|
||||
args.creator_set_visibility.as_deref(),
|
||||
args.weight_token.as_str()
|
||||
)
|
||||
@@ -59,6 +59,7 @@ mod tests {
|
||||
use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
#[ignore]
|
||||
#[tokio::test]
|
||||
async fn test_update_weights() -> AnyhowResult<()> {
|
||||
let db_connection_string = DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
|
||||
@@ -19,8 +19,8 @@ pub struct RetrievedModelWeight {
|
||||
pub title: String,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
@@ -94,8 +94,8 @@ pub async fn get_weights_by_token_with_connection(
|
||||
title: record.title,
|
||||
weights_type: record.weights_type,
|
||||
weights_category: record.weights_category,
|
||||
description_markdown: record.description_markdown,
|
||||
description_rendered_html: record.description_rendered_html,
|
||||
maybe_description_markdown: record.maybe_description_markdown,
|
||||
maybe_description_rendered_html: record.maybe_description_rendered_html,
|
||||
creator_user_token: record.creator_user_token,
|
||||
creator_username: record.creator_username,
|
||||
creator_display_name: record.creator_display_name,
|
||||
@@ -140,8 +140,8 @@ async fn select_include_deleted(
|
||||
wt.title,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
wt.description_markdown,
|
||||
wt.description_rendered_html,
|
||||
wt.maybe_description_markdown,
|
||||
wt.maybe_description_rendered_html,
|
||||
|
||||
wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,
|
||||
users.username as creator_username,
|
||||
@@ -202,8 +202,8 @@ async fn select_without_deleted(
|
||||
wt.title,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
wt.description_markdown,
|
||||
wt.description_rendered_html,
|
||||
wt.maybe_description_markdown,
|
||||
wt.maybe_description_rendered_html,
|
||||
wt.creator_ip_address,
|
||||
wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
@@ -257,8 +257,8 @@ pub struct RawWeight {
|
||||
pub title: String,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
|
||||
@@ -30,9 +30,11 @@ pub struct WeightsJoinUserRecord {
|
||||
pub weights_category: WeightsCategory,
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//pub maybe_description_markdown: String,
|
||||
//pub maybe_description_rendered_html: String,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_ip_address: String,
|
||||
@@ -140,8 +142,6 @@ fn select_result_fields() -> String {
|
||||
mw.title,
|
||||
mw.weights_type,
|
||||
mw.weights_category,
|
||||
mw.description_markdown,
|
||||
mw.description_rendered_html,
|
||||
u.token as creator_user_token,
|
||||
u.username as creator_username,
|
||||
u.display_name as creator_display_name,
|
||||
@@ -230,8 +230,8 @@ async fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsJoinUserRe
|
||||
title: weight.title,
|
||||
weights_type: weight.weights_type,
|
||||
weights_category: weight.weights_category,
|
||||
description_markdown: weight.description_markdown,
|
||||
description_rendered_html: weight.description_rendered_html,
|
||||
//maybe_description_markdown: weight.maybe_description_markdown,
|
||||
//maybe_description_rendered_html: weight.maybe_description_rendered_html,
|
||||
|
||||
creator_user_token: weight.creator_user_token,
|
||||
creator_ip_address: weight.creator_ip_address,
|
||||
@@ -279,9 +279,11 @@ async fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsJoinUserRe
|
||||
pub weights_category: WeightsCategory,
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//pub description_markdown: String,
|
||||
//pub description_rendered_html: String,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_ip_address: String,
|
||||
@@ -329,8 +331,10 @@ impl FromRow<'_, MySqlRow> for RawWeightJoinUser {
|
||||
weights_type: row.try_get("weights_type")?,
|
||||
weights_category: row.try_get("weights_category")?,
|
||||
title: row.try_get("title")?,
|
||||
description_markdown: row.try_get("description_markdown")?,
|
||||
description_rendered_html: row.try_get("description_rendered_html")?,
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//maybe_description_markdown: row.try_get("maybe_description_markdown")?,
|
||||
//maybe_description_rendered_html: row.try_get("maybe_description_rendered_html")?,
|
||||
creator_user_token: row.try_get("creator_user_token")?,
|
||||
creator_ip_address: row.try_get("creator_ip_address")?,
|
||||
creator_set_visibility: Visibility::try_from_mysql_row(row, "creator_set_visibility")?,
|
||||
|
||||
+8
-8
@@ -36,8 +36,8 @@ pub struct WeightJoinUser {
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_ip_address: String,
|
||||
@@ -218,8 +218,8 @@ impl ListWeightsQueryBuilder {
|
||||
record.weights_category.as_str()
|
||||
).unwrap(),
|
||||
title: record.title,
|
||||
description_markdown: record.description_markdown,
|
||||
description_rendered_html: record.description_rendered_html,
|
||||
maybe_description_markdown: record.maybe_description_markdown,
|
||||
maybe_description_rendered_html: record.maybe_description_rendered_html,
|
||||
creator_user_token: UserToken::new_from_str(&record.creator_user_token),
|
||||
creator_ip_address: record.creator_ip_address,
|
||||
creator_set_visibility: Visibility::from_str(
|
||||
@@ -272,8 +272,8 @@ impl ListWeightsQueryBuilder {
|
||||
model_weights.weights_type,
|
||||
model_weights.weights_category,
|
||||
model_weights.title,
|
||||
model_weights.description_markdown,
|
||||
model_weights.description_rendered_html,
|
||||
model_weights.maybe_description_markdown,
|
||||
model_weights.maybe_description_rendered_html,
|
||||
model_weights.creator_user_token,
|
||||
model_weights.creator_ip_address,
|
||||
model_weights.creator_set_visibility,
|
||||
@@ -430,8 +430,8 @@ struct RawWeightJoinUser {
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: String,
|
||||
pub creator_ip_address: String,
|
||||
|
||||
+4
-4
@@ -77,8 +77,8 @@ SET
|
||||
weights_category = ?,
|
||||
title = ?,
|
||||
maybe_cover_image_media_file_token = NULL,
|
||||
description_markdown = ?,
|
||||
description_rendered_html = ?,
|
||||
maybe_description_markdown = ?,
|
||||
maybe_description_rendered_html = ?,
|
||||
creator_user_token = ?,
|
||||
creator_ip_address = ?,
|
||||
|
||||
@@ -110,8 +110,8 @@ ON DUPLICATE KEY UPDATE
|
||||
weights_category = ?,
|
||||
title = ?,
|
||||
maybe_cover_image_media_file_token = NULL,
|
||||
description_markdown = ?,
|
||||
description_rendered_html = ?,
|
||||
maybe_description_markdown = ?,
|
||||
maybe_description_rendered_html = ?,
|
||||
creator_user_token = ?,
|
||||
creator_ip_address = ?,
|
||||
creator_set_visibility = ?,
|
||||
|
||||
@@ -4,8 +4,8 @@ CREATE TABLE model_weights (
|
||||
weights_type VARCHAR(32) NOT NULL,
|
||||
weights_category VARCHAR(32) NOT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
description_markdown TEXT NOT NULL,
|
||||
description_rendered_html TEXT NOT NULL,
|
||||
maybe_description_markdown TEXT DEFAULT NULL,
|
||||
maybe_description_rendered_html TEXT DEFAULT NULL,
|
||||
creator_user_token VARCHAR(32) NOT NULL,
|
||||
creator_ip_address VARCHAR(40) NOT NULL,
|
||||
creator_set_visibility ENUM(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#[ignore]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use anyhow::Ok;
|
||||
@@ -65,8 +66,8 @@ mod tests {
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -97,8 +98,8 @@ mod tests {
|
||||
assert_eq!(result.title, "Title 1".to_string());
|
||||
assert_eq!(result.weights_type, WeightsType::RvcV2);
|
||||
assert_eq!(result.weights_category, WeightsCategory::VoiceConversion);
|
||||
assert_eq!(result.description_markdown, "Description 1".to_string());
|
||||
assert_eq!(result.description_rendered_html, "<p>Description 1</p>".to_string());
|
||||
assert_eq!(result.maybe_description_markdown, Some("Description 1".to_string()));
|
||||
assert_eq!(result.maybe_description_rendered_html, Some("<p>Description 1</p>".to_string()));
|
||||
assert_eq!(result.creator_user_token, creator_token1);
|
||||
assert_eq!(result.creator_ip_address, "192.168.1.1".to_string());
|
||||
assert_eq!(result.creator_set_visibility, Visibility::Public);
|
||||
@@ -138,8 +139,8 @@ mod tests {
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -214,8 +215,8 @@ mod tests {
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -325,11 +326,11 @@ mod tests {
|
||||
|
||||
let args = CreateModelWeightsArgs {
|
||||
token: &model_weight_token, // replace with actual ModelWeightToken
|
||||
weights_type: weights_type, // replace with actual WeightsType
|
||||
weights_category: weights_category, // replace with actual WeightsCategory
|
||||
weights_type, // replace with actual WeightsType
|
||||
weights_category, // replace with actual WeightsCategory
|
||||
title: format!("Title {}", i),
|
||||
description_markdown: format!("Description {}", i),
|
||||
description_rendered_html: format!("<p>Description {}</p>", i),
|
||||
maybe_description_markdown: Some(format!("Description {}", i)),
|
||||
maybe_description_rendered_html: Some(format!("<p>Description {}</p>", i)),
|
||||
creator_user_token: Some(&creator_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -567,11 +568,11 @@ mod tests {
|
||||
|
||||
let args = CreateModelWeightsArgs {
|
||||
token: &model_weight_token, // replace with actual ModelWeightToken
|
||||
weights_type: weights_type, // replace with actual WeightsType
|
||||
weights_category: weights_category, // replace with actual WeightsCategory
|
||||
weights_type, // replace with actual WeightsType
|
||||
weights_category, // replace with actual WeightsCategory
|
||||
title: format!("Title {}", i),
|
||||
description_markdown: format!("Description {}", i),
|
||||
description_rendered_html: format!("<p>Description {}</p>", i),
|
||||
maybe_description_markdown: Some(format!("Description {}", i)),
|
||||
maybe_description_rendered_html: Some(format!("<p>Description {}</p>", i)),
|
||||
creator_user_token: Some(&creator_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
|
||||
@@ -26,7 +26,11 @@ pub struct GetWeightResponse {
|
||||
title: String,
|
||||
weights_type: WeightsType,
|
||||
weights_category: WeightsCategory,
|
||||
|
||||
// TODO(bt,2023-12-24): Migrated the column. We should return nullables, but I don't want to break the frontend
|
||||
description_markdown: String,
|
||||
|
||||
// TODO(bt,2023-12-24): Migrated the column. We should return nullables, but I don't want to break the frontend
|
||||
description_rendered_html: String,
|
||||
|
||||
creator: UserDetailsLight,
|
||||
@@ -168,8 +172,9 @@ pub async fn get_weight_handler(
|
||||
title: weight.title,
|
||||
weights_type: weight.weights_type,
|
||||
weights_category: weight.weights_category,
|
||||
description_markdown: weight.description_markdown,
|
||||
description_rendered_html: weight.description_rendered_html,
|
||||
// TODO(bt,2023-12-24): Migrated the column. We should return nullable fields, but I don't want to break the frontend
|
||||
description_markdown: weight.maybe_description_markdown.unwrap_or_else(|| "".to_string()),
|
||||
description_rendered_html: weight.maybe_description_rendered_html.unwrap_or_else(|| "".to_string()),
|
||||
maybe_cover_image_public_bucket_path: maybe_cover_image,
|
||||
creator,
|
||||
creator_set_visibility: weight.creator_set_visibility,
|
||||
|
||||
+4
-4
@@ -53,8 +53,10 @@ pub struct ModelWeightForList {
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//pub description_markdown: String,
|
||||
//pub description_rendered_html: String,
|
||||
|
||||
/// Cover images are small descriptive images that can be set for any model.
|
||||
/// If a cover image is set, this is the path to the asset.
|
||||
@@ -259,8 +261,6 @@ pub async fn list_available_weights_handler(
|
||||
weights_type: weight.weights_type,
|
||||
weights_category: weight.weights_category,
|
||||
|
||||
description_markdown: weight.description_markdown,
|
||||
description_rendered_html: weight.description_rendered_html,
|
||||
maybe_cover_image_public_bucket_path: maybe_cover_image,
|
||||
|
||||
creator: UserDetailsLight::from_db_fields(
|
||||
|
||||
+6
-4
@@ -27,8 +27,10 @@ pub struct Weight {
|
||||
creator: UserDetailsLight,
|
||||
creator_set_visibility: Visibility,
|
||||
|
||||
description_markdown: String,
|
||||
description_rendered_html: String,
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//description_markdown: String,
|
||||
//description_rendered_html: String,
|
||||
|
||||
file_size_bytes: i32,
|
||||
file_checksum_sha2: String,
|
||||
@@ -180,8 +182,8 @@ pub async fn list_weights_by_user_handler(
|
||||
&weight.creator_email_gravatar_hash,
|
||||
),
|
||||
maybe_cover_image_public_bucket_path: maybe_cover_image,
|
||||
description_markdown: weight.description_markdown,
|
||||
description_rendered_html: weight.description_rendered_html,
|
||||
//description_markdown: weight.maybe_description_markdown,
|
||||
//description_rendered_html: weight.maybe_description_rendered_html,
|
||||
file_size_bytes: weight.file_size_bytes,
|
||||
file_checksum_sha2: weight.file_checksum_sha2,
|
||||
cached_user_ratings_total_count: weight.cached_user_ratings_total_count,
|
||||
|
||||
+2
-2
@@ -143,8 +143,8 @@ pub async fn update_weight_handler(
|
||||
weight_token: &ModelWeightToken::new(path.weight_token.clone()),
|
||||
mysql_pool: &server_state.mysql_pool,
|
||||
title: request.title.as_deref(),
|
||||
description_markdown: request.description_markdown.as_deref(),
|
||||
description_rendered_html: request.description_rendered_html.as_deref(),
|
||||
maybe_description_markdown: request.description_markdown.as_deref(),
|
||||
maybe_description_rendered_html: request.description_rendered_html.as_deref(),
|
||||
creator_set_visibility: request.visibility.as_ref(),
|
||||
weights_type: request.weight_type.as_deref().map(|s| s.to_string()),
|
||||
weights_category: request.weight_category.as_deref().map(|s| s.to_string()),
|
||||
|
||||
Reference in New Issue
Block a user