@bty/customer-service-cli 0.1.19 → 0.1.21
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 +1 -1
- package/dist/bin.js +13 -2
- package/package.json +1 -1
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
|
@@ -1456,7 +1456,11 @@ function truncateBeforeRecord(records, targetRecordId) {
|
|
|
1456
1456
|
return records.slice(0, targetIdx);
|
|
1457
1457
|
}
|
|
1458
1458
|
function recordsToMsgList(records) {
|
|
1459
|
-
|
|
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) => {
|
|
1460
1464
|
const context = r.context ?? {};
|
|
1461
1465
|
const text = context.text ?? "";
|
|
1462
1466
|
const imageUrl = context.image_url;
|
|
@@ -1468,7 +1472,7 @@ function recordsToMsgList(records) {
|
|
|
1468
1472
|
if (imageUrl) {
|
|
1469
1473
|
content.image_url = imageUrl;
|
|
1470
1474
|
}
|
|
1471
|
-
const timestamp =
|
|
1475
|
+
const timestamp = originalTimestamps[i] + offset;
|
|
1472
1476
|
return {
|
|
1473
1477
|
match_id: r.record_id ?? `match_${timestamp}_${Math.floor(Math.random() * 100)}`,
|
|
1474
1478
|
content,
|
|
@@ -1617,6 +1621,12 @@ function registerDebugCommand(program2) {
|
|
|
1617
1621
|
pollInterval: Number(opts.pollInterval),
|
|
1618
1622
|
category: "agent_response"
|
|
1619
1623
|
});
|
|
1624
|
+
let traceId = null;
|
|
1625
|
+
try {
|
|
1626
|
+
const debugInfo = await getRecordDebugInfo(agentRecords[0].record_id);
|
|
1627
|
+
traceId = debugInfo.trace_id ?? null;
|
|
1628
|
+
} catch {
|
|
1629
|
+
}
|
|
1620
1630
|
formatOutput({
|
|
1621
1631
|
success: true,
|
|
1622
1632
|
data: {
|
|
@@ -1626,6 +1636,7 @@ function registerDebugCommand(program2) {
|
|
|
1626
1636
|
agent_config_name: agentConfig.config_name,
|
|
1627
1637
|
user_name: userName,
|
|
1628
1638
|
context_messages_count: msgList.length,
|
|
1639
|
+
trace_id: traceId,
|
|
1629
1640
|
reply: agentRecords
|
|
1630
1641
|
}
|
|
1631
1642
|
}, program2.opts().table);
|