@@ -8,15 +8,15 @@ use crate::storage::{ModelStorage, SqliteStorage};
88use crate :: utils:: file;
99
1010#[ derive( Debug , Serialize , Deserialize , Clone ) ]
11- pub struct ArtifactInfo {
11+ pub struct CacheInfo {
1212 pub revision : String ,
1313 pub size : u64 ,
1414 pub path : String ,
1515}
1616
1717#[ derive( Debug , Serialize , Deserialize , Clone ) ]
1818pub struct ModelMetadata {
19- pub artifact : ArtifactInfo ,
19+ pub cache : CacheInfo ,
2020 #[ serde( skip_serializing_if = "Option::is_none" ) ]
2121 pub context_window : Option < u32 > ,
2222 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -27,12 +27,12 @@ pub struct ModelMetadata {
2727pub struct ModelInfo {
2828 pub uuid : String ,
2929 pub name : String ,
30+ pub provider : String ,
3031 pub author : Option < String > ,
3132 #[ serde( skip_serializing_if = "Option::is_none" ) ]
3233 pub task : Option < String > , // Task type (image-text-to-text, text-generation)
3334 #[ serde( skip_serializing_if = "Option::is_none" ) ]
3435 pub model_series : Option < String > , // Architecture series (qwen3_5, gpt2, llama3)
35- pub provider : String ,
3636 #[ serde( skip_serializing_if = "Option::is_none" ) ]
3737 pub license : Option < String > ,
3838 pub metadata : ModelMetadata ,
@@ -82,7 +82,7 @@ impl ModelRegistry {
8282
8383 if let Some ( info) = model_info {
8484 // Delete artifact directory if it exists
85- let artifact_path = std:: path:: Path :: new ( & info. metadata . artifact . path ) ;
85+ let artifact_path = std:: path:: Path :: new ( & info. metadata . cache . path ) ;
8686 if artifact_path. exists ( ) {
8787 fs:: remove_dir_all ( artifact_path) ?;
8888 }
@@ -119,15 +119,15 @@ mod tests {
119119 ModelInfo {
120120 uuid : revision. to_string ( ) ,
121121 name : name. to_string ( ) ,
122+ provider : "huggingface" . to_string ( ) ,
122123 author : Some ( "test-author" . to_string ( ) ) ,
123124 task : Some ( "text-generation" . to_string ( ) ) ,
124125 model_series : Some ( "gpt2" . to_string ( ) ) ,
125- provider : "huggingface" . to_string ( ) ,
126126 license : Some ( "mit" . to_string ( ) ) ,
127127 created_at : "2025-01-01T00:00:00Z" . to_string ( ) ,
128128 updated_at : "2025-01-01T00:00:00Z" . to_string ( ) ,
129129 metadata : ModelMetadata {
130- artifact : ArtifactInfo {
130+ cache : CacheInfo {
131131 revision : revision. to_string ( ) ,
132132 size : 1000 ,
133133 path : "/tmp/test" . to_string ( ) ,
@@ -202,17 +202,17 @@ mod tests {
202202 registry. register_model ( model1) . unwrap ( ) ;
203203
204204 let mut model2 = create_test_model ( "test/model" , "def456" ) ;
205- model2. metadata . artifact . size = 2000 ;
206- model2. metadata . artifact . path = "/tmp/test2" . to_string ( ) ;
205+ model2. metadata . cache . size = 2000 ;
206+ model2. metadata . cache . path = "/tmp/test2" . to_string ( ) ;
207207 model2. created_at = "2025-01-02T00:00:00Z" . to_string ( ) ;
208208 model2. updated_at = "2025-01-02T00:00:00Z" . to_string ( ) ;
209209
210210 registry. register_model ( model2) . unwrap ( ) ;
211211
212212 let models = registry. load_models ( None ) . unwrap ( ) ;
213213 assert_eq ! ( models. len( ) , 1 ) ;
214- assert_eq ! ( models[ 0 ] . metadata. artifact . revision, "def456" ) ;
215- assert_eq ! ( models[ 0 ] . metadata. artifact . size, 2000 ) ;
214+ assert_eq ! ( models[ 0 ] . metadata. cache . revision, "def456" ) ;
215+ assert_eq ! ( models[ 0 ] . metadata. cache . size, 2000 ) ;
216216 // created_at should be preserved from model1
217217 assert_eq ! ( models[ 0 ] . created_at, "2025-01-01T00:00:00Z" ) ;
218218 // updated_at should be from model2
@@ -230,7 +230,7 @@ mod tests {
230230 fs:: write ( cache_dir. join ( "test.txt" ) , "test data" ) . unwrap ( ) ;
231231
232232 let mut model = create_test_model ( "test/model" , "abc123" ) ;
233- model. metadata . artifact . path = cache_dir. to_string_lossy ( ) . to_string ( ) ;
233+ model. metadata . cache . path = cache_dir. to_string_lossy ( ) . to_string ( ) ;
234234
235235 registry. register_model ( model) . unwrap ( ) ;
236236 assert_eq ! ( registry. load_models( None ) . unwrap( ) . len( ) , 1 ) ;
@@ -271,7 +271,7 @@ mod tests {
271271 let model_info = retrieved. unwrap ( ) ;
272272 assert_eq ! ( model_info. name, "test/gpt-model" ) ;
273273 assert_eq ! ( model_info. provider, "huggingface" ) ;
274- assert_eq ! ( model_info. metadata. artifact . revision, "abc123def456" ) ;
274+ assert_eq ! ( model_info. metadata. cache . revision, "abc123def456" ) ;
275275 assert_eq ! ( model_info. model_series, Some ( "gpt2" . to_string( ) ) ) ;
276276 assert_eq ! ( model_info. metadata. context_window, Some ( 2048 ) ) ;
277277 assert_eq ! (
0 commit comments