admin-catalog-tools

Extract component data from a product page with an LLM

Turns a product page into a component draft. Nothing is persisted — save the result with POST /api/admin/save-component. Depends on external AI and fetch services, so a request can take tens of seconds; any upstream failure ends in 500.

  1. Input precedence: productInfo.url > url > searchTerm. A searchTerm without url first calls POST /api/admin/search-amazon on NEXT_PUBLIC_BASE_URL, forwarding the caller's Authorization header; if no product is found, extraction continues from the search term alone.
  2. The page is fetched as markdown through Jina Reader (https://r.jina.ai/<url>, optional JINA_API_KEY, 30 s timeout) and cached in-process for 1 h (at most 50 entries).
  3. Blocked or captcha Amazon pages fall back to a SearxNG search (search.yuzuhub.com) for the ASIN.
  4. Existing brand names are read from the PocketBase component_brands collection.
  5. The Anthropic Messages API extracts the specification (ANTHROPIC_API_KEY required; model EXTRACT_MODEL, default claude-haiku-4-5-20251001; up to 5 turns in which the model may call a searxng_search tool).
  6. A second search-amazon call supplies one amazon.de affiliate link; without a hit the link is an amazon.de search-results URL carrying the affiliate tag.
  7. http(s) icon URLs go through self-hosted background removal (BRIA RMBG-1.4 via @huggingface/transformers); on failure the original URL is kept.
post/api/admin/extract-component

Request

  • Base URL: https://voltplan.app
  • URL: https://voltplan.app/api/admin/extract-component
  • Auth: HTTP bearer

Request body

urlstring

Product page to crawl.

searchTermstring

Used only without url: resolved to a product page via search-amazon.

Response

Extracted component draft.

namestring
typestring

Expected one of battery, charger, inverter, transformer, power, load, fuse, shunt, switch, disconnect, tool; not enforced.

brandstring nullable
voltage_innumber nullable
voltage_in_typestring nullable

ac or dc.

voltage_outnumber nullable
voltage_out_typestring nullable

ac or dc.

wattnumber nullable
estd_price_euronumber nullable
descriptionstring nullable
imagestring nullable
iconstring nullable

data:image/png;base64,… after background removal, else an http(s) image URL, else a generic symbols/*.svg path for battery, charger, inverter, transformer, power and load; absent or null otherwise.

duty_cyclenumber nullable
default_utilization_factornumber nullable
usage_hours_per_daynumber nullable
amperagenumber nullable
cutoff_voltagenumber nullable
fuse_typestring nullable
wire_gaugestring nullable

Changes

No recorded changes to this operation across all 1 revision of this API.