From: Ian Jackson Date: Fri, 26 Feb 2021 20:26:02 +0000 (+0000) Subject: apitest: Get llm id X-Git-Tag: otter-0.4.0~348 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8d07fa7f33000806683e563402beaae9120699c8;p=otter.git apitest: Get llm id Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index a718c9db..053f060d 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -129,7 +129,7 @@ impl Ctx { #[derive(Debug,Clone)] struct PieceInfo { - id: (), + id: String, info: I, } @@ -140,11 +140,13 @@ impl Session { .element("#pieces_marker") .unwrap().next_siblings() .map_loop(|puse: ego_tree::NodeRef| { - dbg!(puse); - let puse = puse.value().as_element().ok_or(Loop::Continue)?; + let puse = puse.value(); + let puse = puse.as_element().ok_or(Loop::Continue)?; let attr = puse.attr("data-info").ok_or(Loop::Break)?; + let id = puse.id.as_ref().unwrap(); + let id = id.strip_prefix("use").unwrap().to_string(); let info = serde_json::from_str(attr).unwrap(); - Loop::ok(PieceInfo { id: (), info }) + Loop::ok(PieceInfo { id, info }) }) .collect() } @@ -177,7 +179,6 @@ impl Ctx { let llm = pieces.into_iter() .filter(|pi| pi.info["desc"] == "a library load area marker") .collect::>(); - dbg!(&llm); let llm: [_;2] = llm.into_inner().unwrap(); dbg!(&llm); // xxx find load markers ids