generalbots/bottemplates/store-server.gbai/store-server.gbdialog/scan-barcode.bas
Rodrigo Rodriguez (Pragmatismo) 037db5c381 feat: Major workspace reorganization and documentation update
- Add comprehensive documentation in botbook/ with 12 chapters
- Add botapp/ Tauri desktop application
- Add botdevice/ IoT device support
- Add botlib/ shared library crate
- Add botmodels/ Python ML models service
- Add botplugin/ browser extension
- Add botserver/ reorganized server code
- Add bottemplates/ bot templates
- Add bottest/ integration tests
- Add botui/ web UI server
- Add CI/CD workflows in .forgejo/workflows/
- Add AGENTS.md and PROD.md documentation
- Add dependency management scripts (DEPENDENCIES.sh/ps1)
- Remove legacy src/ structure and migrations
- Clean up temporary and backup files
2026-04-19 08:14:25 -03:00

23 lines
983 B
QBasic

PARAM image AS STRING
barcode = SCAN BARCODE image
IF NOT barcode THEN
RETURN WITH error AS "No barcode found"
END IF
ean = barcode.data
cached = FIND "products" WITH "global_trade_number = '" + ean + "'"
IF cached THEN
RETURN cached
END IF
data = GET "https://world.openfoodfacts.org/api/v0/product/" + ean + ".json"
IF data.product THEN
SAVE "products" WITH name AS data.product.product_name, brand AS data.product.brands, global_trade_number AS ean, description AS data.product.generic_name, category AS data.product.categories, net_weight AS data.product.quantity
RETURN FIND "products" WITH "global_trade_number = '" + ean + "'"
END IF
info = LLM "Search product info for EAN: " + ean + ". Return JSON with name, brand, description, category"
SAVE "products" WITH name AS info.name, brand AS info.brand, description AS info.description, category AS info.category, global_trade_number AS ean
RETURN FIND "products" WITH "global_trade_number = '" + ean + "'"