Spaces:
Running
Running
Fix combo: total-budget (sum of items) price + Vietnamese money units (triệu đồng, chục triệu, trăm nghìn, tỷ, word numbers)
Browse files- src/app.js +2 -1
src/app.js
CHANGED
|
@@ -994,7 +994,8 @@ function runTool(name,argsJson,callId){
|
|
| 994 |
const html = '<div class="chat-combo-section">' + window.vaix.renderComboCardsBlock(combo) + '</div>';
|
| 995 |
setPendingProductCards(html);
|
| 996 |
const lines = combo.items.map(function(p){ return '• ' + p.title_clean + ' — ' + (p.brand||'') + ' — ' + (p.priceNum>0?p.priceNum.toLocaleString("vi-VN")+"₫":"Liên hệ"); });
|
| 997 |
-
|
|
|
|
| 998 |
} else {
|
| 999 |
send("Xin lỗi, em chưa tìm được combo phù hợp với yêu cầu đó. Anh chị có thể thử với tiêu chí khác như thương hiệu Malloca, Eurogold hoặc khoảng giá nhé.");
|
| 1000 |
}
|
|
|
|
| 994 |
const html = '<div class="chat-combo-section">' + window.vaix.renderComboCardsBlock(combo) + '</div>';
|
| 995 |
setPendingProductCards(html);
|
| 996 |
const lines = combo.items.map(function(p){ return '• ' + p.title_clean + ' — ' + (p.brand||'') + ' — ' + (p.priceNum>0?p.priceNum.toLocaleString("vi-VN")+"₫":"Liên hệ"); });
|
| 997 |
+
const _tot = (combo.items||[]).reduce(function(s,p){ return s + ((p.priceNum||0)); }, 0);
|
| 998 |
+
send("Em gợi ý combo sau đây " + (combo.brand?("thương hiệu "+combo.brand+" "):"") + "cho anh chị:\n" + lines.join("\n") + "\n\nTổng combo (" + combo.items.length + " món): " + (_tot>0 ? (_tot.toLocaleString("vi-VN")+" ₫") : "Liên hệ") + " — đã tính đủ theo tổng các món. Anh chị có muốn tôi điều chỉnh theo giá/ chất liệu/ màu sắc/ thương hiệu không?");
|
| 999 |
} else {
|
| 1000 |
send("Xin lỗi, em chưa tìm được combo phù hợp với yêu cầu đó. Anh chị có thể thử với tiêu chí khác như thương hiệu Malloca, Eurogold hoặc khoảng giá nhé.");
|
| 1001 |
}
|