@bty/customer-service-cli 0.1.18 → 0.1.20

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 CHANGED
@@ -225,7 +225,7 @@ cs-cli product update-sku --agent <id> --sku "颜色分类:粉红" --update '{"
225
225
 
226
226
  | 命令 | 说明 |
227
227
  | -------------------------------------------------------------------------------- | -------- |
228
- | `conversation list --agent <id> [--user <用户名>] [--start <日期>] [--end <日期>]` | 搜索会话 |
228
+ | `conversation list [--agent <id>] [--equipment-id <设备ID>] [--user <用户名>] [--start <日期>] [--end <日期>]` | 搜索会话 |
229
229
  | `conversation records <conversation_id> [--page-size N] [--direction prev|next]` | 获取会话聊天记录 |
230
230
  | `conversation context-search --query <文本> [--start <时间>] [--end <时间>]` | 通过上下文内容模糊搜索对话记录(返回匹配消息详情,时间范围最多 3 天) |
231
231
 
package/dist/bin.js CHANGED
@@ -1311,6 +1311,7 @@ async function listConversations(opts) {
1311
1311
  method: "GET",
1312
1312
  query: {
1313
1313
  agent_config_id: opts.agentConfigId,
1314
+ equipment_id: opts.equipmentId,
1314
1315
  workspace_id: wsId,
1315
1316
  user_name: opts.userName,
1316
1317
  start_date: opts.startDate,
@@ -1326,10 +1327,11 @@ function registerConversationCommand(program2) {
1326
1327
  const conversation = program2.command("conversation").description(
1327
1328
  "\u4F1A\u8BDD\u7BA1\u7406 \u2014\u2014 Agent \u4E0E\u771F\u5B9E\u7528\u6237\u7684\u5BF9\u8BDD\u8BB0\u5F55\u3002\u6CE8\u610F\uFF1A\u8FD9\u662F Agent \u7684\u5B9E\u9645\u5BF9\u8BDD\uFF0C\u4E0D\u662F\u5BA2\u6237\u5BFC\u5165\u7684\u804A\u5929\u8BB0\u5F55\uFF08\u540E\u8005\u7528 chat-history \u547D\u4EE4\uFF09"
1328
1329
  );
1329
- conversation.command("list").description("\u6309\u6761\u4EF6\u641C\u7D22\u4F1A\u8BDD\u5217\u8868\u3002\u8FD4\u56DE conversation_id\u3001user_name\u3001created_at \u7B49\u5B57\u6BB5").requiredOption("--agent <config_id>", "Agent \u914D\u7F6E ID\uFF08\u4ECE agent list \u83B7\u53D6\uFF09").option("--user <name>", "\u6309\u7528\u6237\u540D\u7B5B\u9009").option("--start <date>", "\u5F00\u59CB\u65E5\u671F\uFF08ISO \u683C\u5F0F\uFF0C\u5982 2026-03-22T00:00:00\uFF09").option("--end <date>", "\u7ED3\u675F\u65E5\u671F\uFF08ISO \u683C\u5F0F\uFF0C\u5982 2026-03-22T23:59:59\uFF09").option("--page <number>", "\u9875\u7801", "1").option("--page-size <number>", "\u6BCF\u9875\u6570\u91CF", "20").action(async (opts) => {
1330
+ conversation.command("list").description("\u6309\u6761\u4EF6\u641C\u7D22\u4F1A\u8BDD\u5217\u8868\u3002\u8FD4\u56DE conversation_id\u3001user_name\u3001created_at \u7B49\u5B57\u6BB5").option("--agent <config_id>", "Agent \u914D\u7F6E ID\uFF08\u4ECE agent list \u83B7\u53D6\uFF09").option("--equipment-id <id>", "\u8BBE\u5907 ID").option("--user <name>", "\u6309\u7528\u6237\u540D\u7B5B\u9009").option("--start <date>", "\u5F00\u59CB\u65E5\u671F\uFF08ISO \u683C\u5F0F\uFF0C\u5982 2026-03-22T00:00:00\uFF09").option("--end <date>", "\u7ED3\u675F\u65E5\u671F\uFF08ISO \u683C\u5F0F\uFF0C\u5982 2026-03-22T23:59:59\uFF09").option("--page <number>", "\u9875\u7801", "1").option("--page-size <number>", "\u6BCF\u9875\u6570\u91CF", "20").action(async (opts) => {
1330
1331
  try {
1331
1332
  const data = await listConversations({
1332
1333
  agentConfigId: opts.agent,
1334
+ equipmentId: opts.equipmentId,
1333
1335
  userName: opts.user,
1334
1336
  startDate: opts.start,
1335
1337
  endDate: opts.end,
@@ -1454,7 +1456,11 @@ function truncateBeforeRecord(records, targetRecordId) {
1454
1456
  return records.slice(0, targetIdx);
1455
1457
  }
1456
1458
  function recordsToMsgList(records) {
1457
- return records.map((r) => {
1459
+ const nowSec = Math.floor(Date.now() / 1e3);
1460
+ const originalTimestamps = records.map((r) => Math.floor(new Date(r.created_at).getTime() / 1e3));
1461
+ const maxOriginal = Math.max(...originalTimestamps);
1462
+ const offset = nowSec - maxOriginal;
1463
+ return records.map((r, i) => {
1458
1464
  const context = r.context ?? {};
1459
1465
  const text = context.text ?? "";
1460
1466
  const imageUrl = context.image_url;
@@ -1466,7 +1472,7 @@ function recordsToMsgList(records) {
1466
1472
  if (imageUrl) {
1467
1473
  content.image_url = imageUrl;
1468
1474
  }
1469
- const timestamp = Math.floor(new Date(r.created_at).getTime() / 1e3);
1475
+ const timestamp = originalTimestamps[i] + offset;
1470
1476
  return {
1471
1477
  match_id: r.record_id ?? `match_${timestamp}_${Math.floor(Math.random() * 100)}`,
1472
1478
  content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bty/customer-service-cli",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "AI Customer Service CLI - Agent friendly",
5
5
  "type": "module",
6
6
  "main": "./dist/bin.js",