Download services/assetMapper.js from phanquocdat123/Chatbot_Robot_Automation: direct link, hf CLI and curl.
- Browser
- Download file 681 Bytes
-
https://huggingface.co/spaces/phanquocdat123/Chatbot_Robot_Automation/resolve/main/services/assetMapper.js
- Command line
-
hf download hf://spaces/phanquocdat123/Chatbot_Robot_Automation/services/assetMapper.js
-
curl -L -o assetMapper.js https://huggingface.co/spaces/phanquocdat123/Chatbot_Robot_Automation/resolve/main/services/assetMapper.js
681 Bytes
| // services/assetMapper.js | |
| const googleSheets = require('./googleSheets'); | |
| const assetMapper = { | |
| // Từ mã SP, đi tìm mọi thông tin liên quan để gửi cho khách | |
| mapProductToAssets: async (productCode) => { | |
| const product = await googleSheets.getProductInfo(productCode); | |
| if (product) { | |
| return { | |
| price: product.price, | |
| // Chuyển ID Drive thành link có thể xem trực tiếp | |
| imageUrl: `https://lh3.googleusercontent.com/d/${product.driveId}`, | |
| available: product.stock > 0 | |
| }; | |
| } | |
| return null; | |
| } | |
| }; | |
| module.exports = assetMapper; |