@bty/customer-service-cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/bin.js +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,7 +199,7 @@ cs-cli --workspace ws-other agent list # ❌ 报错:CS_WORKSPACE_ID 已被
|
|
|
199
199
|
| `product list --agent <id> [--keyword <关键词>] [--status <状态>] [--tag <标签>]` | 列出商品 |
|
|
200
200
|
| `product get --agent <id> --product-id <商品ID>` | 获取商品详情(自动获取 db_id) |
|
|
201
201
|
| `product update --agent <id> --product-id <商品ID> --update <json\|@file>` | 更新商品信息 |
|
|
202
|
-
| `product update-sku --agent <id> --sku <SKU名称> --update <json\|@file>` | 更新 SKU
|
|
202
|
+
| `product update-sku --agent <id> (--sku <SKU名称> \| --sku-id <id>) --update <json\|@file>` | 更新 SKU 信息(`--sku-id` 优先于 `--sku`) |
|
|
203
203
|
| `product learn --agent <id> --url <URL...> [--source <type>] [--no-identify]` | 通过商品 URL 异步学习(manual / identify 默认开启) |
|
|
204
204
|
|
|
205
205
|
`product update` 支持更新的字段包括:`卖点`、`补充知识`、`tag`、`参数`、`轮播图识别结果`、`商品详情页识别结果` 等。`--update` 接受 JSON 字符串或 `@文件路径`。
|
|
@@ -216,8 +216,11 @@ cs-cli product update --agent <id> --product-id <商品ID> --update '{"tag":"[\"
|
|
|
216
216
|
# 添加商品补充知识
|
|
217
217
|
cs-cli product update --agent <id> --product-id <商品ID> --update '{"补充知识":"[{\"question\":\"问题\",\"answer\":\"回答\"}]"}'
|
|
218
218
|
|
|
219
|
-
# 更新 SKU
|
|
219
|
+
# 更新 SKU 补充知识(按 SKU 名称定位)
|
|
220
220
|
cs-cli product update-sku --agent <id> --sku "颜色分类:粉红" --update '{"补充知识":"说明内容"}'
|
|
221
|
+
|
|
222
|
+
# 更新 SKU 补充知识(按 sku_id 定位,推荐)
|
|
223
|
+
cs-cli product update-sku --agent <id> --sku-id 6072595054179 --update '{"补充知识":"说明内容"}'
|
|
221
224
|
```
|
|
222
225
|
|
|
223
226
|
|
|
@@ -475,8 +478,8 @@ cs-cli product update --agent <id> --product-id 977691714398 --update '{"卖点"
|
|
|
475
478
|
# 更新商品标签
|
|
476
479
|
cs-cli product update --agent <id> --product-id 977691714398 --update '{"tag":"春季新品,热卖"}'
|
|
477
480
|
|
|
478
|
-
# 更新 SKU
|
|
479
|
-
cs-cli product update-sku --agent <id> --sku
|
|
481
|
+
# 更新 SKU 补充知识(按 sku_id 定位,推荐)
|
|
482
|
+
cs-cli product update-sku --agent <id> --sku-id 6072595054179 --update '{"补充知识":"粉红色为浅粉调"}'
|
|
480
483
|
|
|
481
484
|
# 添加 FAQ
|
|
482
485
|
cs-cli faq add --agent <id> --file "常见问题" --questions "怎么退款,如何退款" --answers "答案=请联系客服处理退款"
|
package/dist/bin.js
CHANGED
|
@@ -2609,11 +2609,15 @@ async function uploadProductByUrl(opts) {
|
|
|
2609
2609
|
});
|
|
2610
2610
|
}
|
|
2611
2611
|
async function updateSku(opts) {
|
|
2612
|
+
if (!opts.skuId && !opts.sku) {
|
|
2613
|
+
throw new Error("updateSku \u9700\u8981\u63D0\u4F9B sku \u6216 sku_id \u5176\u4E2D\u4E4B\u4E00");
|
|
2614
|
+
}
|
|
2615
|
+
const identifier = opts.skuId ? { sku_id: opts.skuId } : { sku: opts.sku };
|
|
2612
2616
|
const request = createRequest();
|
|
2613
2617
|
return request(getCustomerServiceUrl(), "/v1/knowledge/sku/update", {
|
|
2614
2618
|
method: "POST",
|
|
2615
2619
|
body: {
|
|
2616
|
-
|
|
2620
|
+
...identifier,
|
|
2617
2621
|
customer_agent_config_id: opts.agentConfigId,
|
|
2618
2622
|
update_dict: opts.updateDict
|
|
2619
2623
|
}
|
|
@@ -2728,14 +2732,20 @@ function registerProductCommand(program2) {
|
|
|
2728
2732
|
process.exit(toExitCode(err));
|
|
2729
2733
|
}
|
|
2730
2734
|
});
|
|
2731
|
-
product.command("update-sku").description(
|
|
2735
|
+
product.command("update-sku").description(
|
|
2736
|
+
"\u66F4\u65B0\u6307\u5B9A SKU \u7684\u77E5\u8BC6\u4FE1\u606F\uFF08\u5982\u8865\u5145\u77E5\u8BC6\uFF09\u3002\u652F\u6301\u901A\u8FC7 SKU \u540D\u79F0\u6216 sku_id \u5B9A\u4F4D\uFF0C\u540C\u65F6\u63D0\u4F9B\u65F6\u4F18\u5148\u4F7F\u7528 sku_id"
|
|
2737
|
+
).requiredOption("--agent <config_id>", "Agent \u914D\u7F6E ID\uFF08\u4ECE agent list \u83B7\u53D6\uFF09").option("--sku <name>", 'SKU \u540D\u79F0\uFF08\u7CBE\u786E\u5339\u914D\uFF0C\u5982 "\u989C\u8272\u5206\u7C7B:\u7C89\u7EA2"\uFF09').option("--sku-id <id>", "SKU ID\uFF08\u5168\u5C40\u552F\u4E00\uFF0C\u4F18\u5148\u4E8E --sku\uFF09").requiredOption(
|
|
2732
2738
|
"--update <json>",
|
|
2733
2739
|
'\u66F4\u65B0\u5185\u5BB9 JSON \u6216 @\u6587\u4EF6\u8DEF\u5F84\u3002\u793A\u4F8B: {"\u8865\u5145\u77E5\u8BC6":"\u7C89\u7EA2\u8272\u4E3A\u6D45\u7C89\u8C03"}'
|
|
2734
2740
|
).action(async (opts) => {
|
|
2735
2741
|
try {
|
|
2742
|
+
if (!opts.sku && !opts.skuId) {
|
|
2743
|
+
throw new Error("\u8BF7\u63D0\u4F9B --sku \u6216 --sku-id \u5176\u4E2D\u4E4B\u4E00");
|
|
2744
|
+
}
|
|
2736
2745
|
const updateDict = parseDataOption(opts.update);
|
|
2737
2746
|
const data = await updateSku({
|
|
2738
2747
|
sku: opts.sku,
|
|
2748
|
+
skuId: opts.skuId,
|
|
2739
2749
|
agentConfigId: opts.agent,
|
|
2740
2750
|
updateDict
|
|
2741
2751
|
});
|