chore: making embeddings code compile
This commit is contained in:
parent
b79fe41af3
commit
a706c312b3
|
|
@ -122,6 +122,7 @@ impl StorageQueue {
|
||||||
workspace_id: workspace_id.to_string(),
|
workspace_id: workspace_id.to_string(),
|
||||||
object_id: params.object_id.clone(),
|
object_id: params.object_id.clone(),
|
||||||
collab_type: params.collab_type.clone(),
|
collab_type: params.collab_type.clone(),
|
||||||
|
embeddings: params.embeddings.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|
@ -419,7 +420,7 @@ async fn write_pending_to_disk(
|
||||||
object_id: meta.object_id.clone(),
|
object_id: meta.object_id.clone(),
|
||||||
collab_type: meta.collab_type.clone(),
|
collab_type: meta.collab_type.clone(),
|
||||||
encode_collab_v1,
|
encode_collab_v1,
|
||||||
embeddings,
|
embeddings: meta.embeddings.clone(),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
@ -526,6 +527,8 @@ pub struct PendingWriteMeta {
|
||||||
pub workspace_id: String,
|
pub workspace_id: String,
|
||||||
pub object_id: String,
|
pub object_id: String,
|
||||||
pub collab_type: CollabType,
|
pub collab_type: CollabType,
|
||||||
|
#[serde(default)]
|
||||||
|
pub embeddings: Option<AFCollabEmbeddings>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&PendingWriteMeta> for QueryCollab {
|
impl From<&PendingWriteMeta> for QueryCollab {
|
||||||
|
|
|
||||||
|
|
@ -609,7 +609,7 @@ async fn batch_create_collab_handler(
|
||||||
{
|
{
|
||||||
state
|
state
|
||||||
.collab_access_control_storage
|
.collab_access_control_storage
|
||||||
.insert_new_collab(&workspace_id, &uid, params, None)
|
.insert_new_collab(&workspace_id, &uid, params)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
state
|
state
|
||||||
|
|
@ -854,7 +854,7 @@ async fn update_collab_handler(
|
||||||
let (params, workspace_id) = create_params.split();
|
let (params, workspace_id) = create_params.split();
|
||||||
state
|
state
|
||||||
.collab_access_control_storage
|
.collab_access_control_storage
|
||||||
.insert_or_update_collab(&workspace_id, &uid, params, None, false)
|
.insert_or_update_collab(&workspace_id, &uid, params, false)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(AppResponse::Ok().into())
|
Ok(AppResponse::Ok().into())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ where
|
||||||
object_id,
|
object_id,
|
||||||
encoded_collab_v1,
|
encoded_collab_v1,
|
||||||
collab_type: template.object_type,
|
collab_type: template.object_type,
|
||||||
|
embeddings: None,
|
||||||
},
|
},
|
||||||
txn,
|
txn,
|
||||||
)
|
)
|
||||||
|
|
@ -104,6 +105,7 @@ async fn create_workspace_database_collab(
|
||||||
object_id: object_id.to_string(),
|
object_id: object_id.to_string(),
|
||||||
encoded_collab_v1,
|
encoded_collab_v1,
|
||||||
collab_type,
|
collab_type,
|
||||||
|
embeddings: None,
|
||||||
},
|
},
|
||||||
txn,
|
txn,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ async fn batch_insert_collab_success_test() {
|
||||||
object_id: Uuid::new_v4().to_string(),
|
object_id: Uuid::new_v4().to_string(),
|
||||||
encoded_collab_v1: mock_encoded_collab_v1[i].encode_to_bytes().unwrap(),
|
encoded_collab_v1: mock_encoded_collab_v1[i].encode_to_bytes().unwrap(),
|
||||||
collab_type: CollabType::Unknown,
|
collab_type: CollabType::Unknown,
|
||||||
|
embeddings: None,
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
|
@ -182,6 +183,7 @@ async fn create_collab_compatibility_with_json_params_test() {
|
||||||
object_id: object_id.clone(),
|
object_id: object_id.clone(),
|
||||||
encoded_collab_v1: encoded_collab.encode_to_bytes().unwrap(),
|
encoded_collab_v1: encoded_collab.encode_to_bytes().unwrap(),
|
||||||
collab_type: CollabType::Unknown,
|
collab_type: CollabType::Unknown,
|
||||||
|
embeddings: None,
|
||||||
},
|
},
|
||||||
workspace_id: workspace_id.clone(),
|
workspace_id: workspace_id.clone(),
|
||||||
};
|
};
|
||||||
|
|
@ -238,6 +240,7 @@ async fn batch_create_collab_compatibility_with_uncompress_params_test() {
|
||||||
object_id: object_id.clone(),
|
object_id: object_id.clone(),
|
||||||
encoded_collab_v1: encoded_collab.encode_to_bytes().unwrap(),
|
encoded_collab_v1: encoded_collab.encode_to_bytes().unwrap(),
|
||||||
collab_type: CollabType::Unknown,
|
collab_type: CollabType::Unknown,
|
||||||
|
embeddings: None,
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
.to_bytes()
|
.to_bytes()
|
||||||
|
|
|
||||||
|
|
@ -468,6 +468,7 @@ async fn simulate_small_data_set_write(pool: PgPool) {
|
||||||
object_id: format!("object_id_{}", i),
|
object_id: format!("object_id_{}", i),
|
||||||
collab_type: CollabType::Unknown,
|
collab_type: CollabType::Unknown,
|
||||||
encoded_collab_v1: encode_collab.encode_to_bytes().unwrap(),
|
encoded_collab_v1: encode_collab.encode_to_bytes().unwrap(),
|
||||||
|
embeddings: None,
|
||||||
};
|
};
|
||||||
cloned_storage_queue
|
cloned_storage_queue
|
||||||
.push(
|
.push(
|
||||||
|
|
@ -543,6 +544,7 @@ async fn simulate_large_data_set_write(pool: PgPool) {
|
||||||
object_id: uuid::Uuid::new_v4().to_string(),
|
object_id: uuid::Uuid::new_v4().to_string(),
|
||||||
collab_type: CollabType::Unknown,
|
collab_type: CollabType::Unknown,
|
||||||
encoded_collab_v1: origin_encode_collab.encode_to_bytes().unwrap(),
|
encoded_collab_v1: origin_encode_collab.encode_to_bytes().unwrap(),
|
||||||
|
embeddings: None,
|
||||||
};
|
};
|
||||||
storage_queue
|
storage_queue
|
||||||
.push(&user.workspace_id, &user.uid, ¶ms, WritePriority::Low)
|
.push(&user.workspace_id, &user.uid, ¶ms, WritePriority::Low)
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ async fn insert_collab_sql_test(pool: PgPool) {
|
||||||
object_id,
|
object_id,
|
||||||
collab_type: CollabType::Unknown,
|
collab_type: CollabType::Unknown,
|
||||||
encoded_collab_v1,
|
encoded_collab_v1,
|
||||||
|
embeddings: None,
|
||||||
};
|
};
|
||||||
insert_into_af_collab(&mut txn, &user.uid, &user.workspace_id, ¶ms)
|
insert_into_af_collab(&mut txn, &user.uid, &user.workspace_id, ¶ms)
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue