MCPcopy Create free account
hub / github.com/evilsocket/cake / list_models

Function list_models

cake-core/src/cake/sharding/api/mod.rs:41–60  ·  view source on GitHub ↗
(
    state: web::Data<Arc<RwLock<Master<M>>>>,
)

Source from the content-addressed store, hash-verified

39}
40
41pub async fn list_models<M: Model>(
42 state: web::Data<Arc<RwLock<Master<M>>>>,
43) -> HttpResponse {
44 let master = state.read().await;
45 let mut models = Vec::new();
46
47 if master.model.is_some() {
48 models.push(ModelObject {
49 id: M::MODEL_NAME.to_string(),
50 object: "model".to_string(),
51 owned_by: "cake".to_string(),
52 });
53 }
54
55 let response = ModelsResponse {
56 object: "list".to_string(),
57 data: models,
58 };
59 HttpResponse::Ok().json(response)
60}
61
62async fn not_found() -> actix_web::Result<HttpResponse> {
63 Ok(HttpResponse::NotFound().body("nope"))

Callers

nothing calls this directly

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected