← Commit history
v2.1.6: A JLCPCB hit whose part number differs from the query only in punctuation is no longer thrown away. The relevance filter compared the query with the hit's part number as written, so a search for `PMEG6010CEJ115` dropped LCSC's `PMEG6010CEJ,115`. It now also compares them with punctuation dropped. The JLCPCB service matches those searches since adom/adom-jlcpcb#3 (Noah). Exactness for the recommendation still treats punctuation as part of the MPN (`74LVC2G17GV,125` is not `74LVC2G17GV-Q100H`).
7 files changed
+27−44
Cargo.lock+1−1@@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "adom-parts-search"-version = "2.1.5"+version = "2.1.6" dependencies = [ "base64", "clap",
Cargo.toml+1−1@@ -1,6 +1,6 @@ [package] name = "adom-parts-search"-version = "2.1.5"+version = "2.1.6" edition = "2021" description = "Parts Search Electronics component search — CLI, backend HTTP service, and Hydrogen webview app" license = "MIT"
VERSION+1−1@@ -1 +1 @@-2.1.5+2.1.6
install.shpackage.json+1−40@@ -34,44 +34,5 @@ "SKILL.md", "BUILD-SKILL.md", "CHANGELOG.md"- ],- "changelog": "A JLCPCB hit whose part number differs from the query only in punctuation is no longer thrown away. The relevance filter compared the query with the hit's part number as written, so a search for `PMEG6010CEJ115` dropped LCSC's `PMEG6010CEJ,115`. It now also compares them with punctuation dropped. The JLCPCB service matches those searches since adom/adom-jlcpcb#3 (Noah). Exactness for the recommendation still treats punctuation as part of the MPN (`74LVC2G17GV,125` is not `74LVC2G17GV-Q100H`).",- "discovery_triggers": [- "parts search",- "find part",- "source component",- "source part",- "compare distributors",- "compare vendors",- "Mouser or DigiKey",- "BOM sourcing",- "price this part",- "where can I get",- "check stock",- "parts availability",- "fastest delivery",- "cheapest part",- "component search",- "part lookup",- "price breaks"- ],- "discovery_pitch": "Search Mouser, DigiKey and JLCPCB in parallel with product photos; Mouser-preferred best-source pick. Say 'with parts search' to your AI.",- "sample_prompts": [- {- "label": "source an STM32F103RBT6",- "prompt": "source an STM32F103RBT6"- },- {- "label": "where can I get an ESP32-S3-WROOM cheape",- "prompt": "where can I get an ESP32-S3-WROOM cheapest and fastest"- },- {- "label": "compare Mouser, DigiKey and JLCPCB for a",- "prompt": "compare Mouser, DigiKey and JLCPCB for an LM555"- },- {- "label": "price this BOM across distributors",- "prompt": "price this BOM across distributors"- } ]-}+}
src/vendors.rs+23−1@@ -185,10 +185,32 @@ fn filter_relevant(hits: &[VendorHit], query: &str) -> Vec<VendorHit> { hits.iter().filter(|h| { let mpn = h.mpn.to_lowercase(); let desc = h.description.to_lowercase();- mpn.contains(&primary) || desc.contains(&primary)+ // Also with the part number's punctuation dropped: LCSC lists PMEG6010CEJ,115 and EEEFK1H101P, so a search+ // for PMEG6010CEJ115 or EEE-FK1H101P must not throw the right part away here (adom/adom-jlcpcb#3).+ let mpn_alnum: String = mpn.chars().filter(|c| c.is_ascii_alphanumeric()).collect();+ mpn.contains(&primary) || desc.contains(&primary) || mpn_alnum.contains(&primary) }).cloned().collect() } +#[cfg(test)]+mod relevance_tests {+ use super::*;+ fn hit(mpn: &str) -> VendorHit {+ VendorHit { vendor: Vendor::JLCPCB, vendor_pn: "C1".into(), mpn: mpn.into(), manufacturer: String::new(), description: String::new(),+ stock: 1, unit_price: None, price_100: None, lead_time: String::new(), image_url: None, datasheet_url: None, product_url: None,+ flags: vec![], price_breaks: vec![], min_order: None, packaging: None, note: None, cad_3d_url: None, cad_3d_format: None, cad_3d_source: None }+ }+ /// adom/adom-jlcpcb#3: the catalogue and the query disagree on punctuation; the right part stays.+ #[test]+ fn punctuation_does_not_drop_the_right_part() {+ assert_eq!(filter_relevant(&[hit("PMEG6010CEJ,115")], "PMEG6010CEJ115").len(), 1);+ assert_eq!(filter_relevant(&[hit("EEEFK1H101P")], "EEE-FK1H101P").len(), 1);+ assert_eq!(filter_relevant(&[hit("AP2112K-3.3TRG1(MS)")], "AP2112K33TRG1MS").len(), 1);+ // an unrelated "popular part" answer is still filtered out+ assert_eq!(filter_relevant(&[hit("CL05B104KO5NNNC")], "PMEG6010CEJ115").len(), 0);+ }+}+ /// Translate a raw backend error into a short title + longer explanation /// + actionable hint, written for a non-expert Adom user. Redacts API /// keys, URLs, and stack traces before they reach stdout or the UI.
uninstall.sh