@bty/customer-service-cli 0.1.16 → 0.1.18
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/dist/bin.js +19 -26
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -511,12 +511,15 @@ async function listWorkspaces() {
|
|
|
511
511
|
// src/commands/config.ts
|
|
512
512
|
function registerConfigCommand(program2) {
|
|
513
513
|
const config = program2.command("config").description("\u914D\u7F6E\u7BA1\u7406 \u2014\u2014 API \u5730\u5740\u3001\u9ED8\u8BA4\u5DE5\u4F5C\u7A7A\u95F4\u7B49\u6301\u4E45\u5316\u8BBE\u7F6E\u3002\u652F\u6301\u5168\u5C40\u914D\u7F6E\u548C\u76EE\u5F55\u7EA7\u672C\u5730\u914D\u7F6E\uFF08.cs-cli.json\uFF09");
|
|
514
|
-
config.command("set").description("\u8BBE\u7F6E API \u5730\u5740").option("--cs-api <url>", "\u5BA2\u670D API \u5730\u5740").option("--auth-api <url>", "\u8BA4\u8BC1 API \u5730\u5740").option("--ai-api <url>", "AI API \u5730\u5740").option("--agent-api <url>", "Customer Agent API \u5730\u5740").action((opts) => {
|
|
514
|
+
config.command("set").description("\u8BBE\u7F6E API \u5730\u5740").option("--cs-api <url>", "\u5BA2\u670D API \u5730\u5740").option("--auth-api <url>", "\u8BA4\u8BC1 API \u5730\u5740").option("--ai-api <url>", "AI API \u5730\u5740").option("--agent-api <url>", "Customer Agent API \u5730\u5740").option("--langfuse-host <url>", "Langfuse \u5730\u5740").option("--langfuse-public-key <key>", "Langfuse Public Key").option("--langfuse-secret-key <key>", "Langfuse Secret Key").action((opts) => {
|
|
515
515
|
const updates = {};
|
|
516
516
|
if (opts.csApi) updates.customerServiceApiUrl = opts.csApi;
|
|
517
517
|
if (opts.authApi) updates.authApiUrl = opts.authApi;
|
|
518
518
|
if (opts.aiApi) updates.aiApiUrl = opts.aiApi;
|
|
519
519
|
if (opts.agentApi) updates.customerAgentApiUrl = opts.agentApi;
|
|
520
|
+
if (opts.langfuseHost) updates.langfuseHost = opts.langfuseHost;
|
|
521
|
+
if (opts.langfusePublicKey) updates.langfusePublicKey = opts.langfusePublicKey;
|
|
522
|
+
if (opts.langfuseSecretKey) updates.langfuseSecretKey = opts.langfuseSecretKey;
|
|
520
523
|
writeConfig(updates);
|
|
521
524
|
formatOutput({ success: true, data: readConfig() }, program2.opts().table);
|
|
522
525
|
});
|
|
@@ -2186,7 +2189,7 @@ function registerRepairRecordCommand(program2) {
|
|
|
2186
2189
|
}
|
|
2187
2190
|
|
|
2188
2191
|
// src/client/operations-record-api.ts
|
|
2189
|
-
var PATH_PREFIX2 = "/
|
|
2192
|
+
var PATH_PREFIX2 = "/v1/agent_operations_records";
|
|
2190
2193
|
async function listOperationsRecords(opts) {
|
|
2191
2194
|
const request = createRequest();
|
|
2192
2195
|
const query = {};
|
|
@@ -2194,45 +2197,35 @@ async function listOperationsRecords(opts) {
|
|
|
2194
2197
|
if (opts.agentId) query.agent_id = opts.agentId;
|
|
2195
2198
|
if (opts.page) query.page = opts.page;
|
|
2196
2199
|
if (opts.pageSize) query.page_size = opts.pageSize;
|
|
2197
|
-
return request(
|
|
2200
|
+
return request(getCustomerServiceUrl(), PATH_PREFIX2, {
|
|
2198
2201
|
method: "GET",
|
|
2199
|
-
query
|
|
2200
|
-
headers: buildCookieHeaders(),
|
|
2201
|
-
skipAuth: true
|
|
2202
|
+
query
|
|
2202
2203
|
});
|
|
2203
2204
|
}
|
|
2204
2205
|
async function getOperationsRecord(recordId) {
|
|
2205
2206
|
const request = createRequest();
|
|
2206
|
-
return request(
|
|
2207
|
-
method: "GET"
|
|
2208
|
-
headers: buildCookieHeaders(),
|
|
2209
|
-
skipAuth: true
|
|
2207
|
+
return request(getCustomerServiceUrl(), `${PATH_PREFIX2}/${recordId}`, {
|
|
2208
|
+
method: "GET"
|
|
2210
2209
|
});
|
|
2211
2210
|
}
|
|
2212
2211
|
async function createOperationsRecord(data) {
|
|
2213
2212
|
const request = createRequest();
|
|
2214
|
-
return request(
|
|
2213
|
+
return request(getCustomerServiceUrl(), PATH_PREFIX2, {
|
|
2215
2214
|
method: "POST",
|
|
2216
|
-
body: data
|
|
2217
|
-
headers: buildCookieHeaders(),
|
|
2218
|
-
skipAuth: true
|
|
2215
|
+
body: data
|
|
2219
2216
|
});
|
|
2220
2217
|
}
|
|
2221
2218
|
async function updateOperationsRecord(recordId, data) {
|
|
2222
2219
|
const request = createRequest();
|
|
2223
|
-
return request(
|
|
2220
|
+
return request(getCustomerServiceUrl(), `${PATH_PREFIX2}/${recordId}`, {
|
|
2224
2221
|
method: "PUT",
|
|
2225
|
-
body: data
|
|
2226
|
-
headers: buildCookieHeaders(),
|
|
2227
|
-
skipAuth: true
|
|
2222
|
+
body: data
|
|
2228
2223
|
});
|
|
2229
2224
|
}
|
|
2230
2225
|
async function deleteOperationsRecord(recordId) {
|
|
2231
2226
|
const request = createRequest();
|
|
2232
|
-
return request(
|
|
2233
|
-
method: "DELETE"
|
|
2234
|
-
headers: buildCookieHeaders(),
|
|
2235
|
-
skipAuth: true
|
|
2227
|
+
return request(getCustomerServiceUrl(), `${PATH_PREFIX2}/${recordId}`, {
|
|
2228
|
+
method: "DELETE"
|
|
2236
2229
|
});
|
|
2237
2230
|
}
|
|
2238
2231
|
|
|
@@ -2241,10 +2234,10 @@ function registerOperationsRecordCommand(program2) {
|
|
|
2241
2234
|
const opsRecord = program2.command("ops-record").description(
|
|
2242
2235
|
"Agent \u8FD0\u7EF4\u64CD\u4F5C\u8BB0\u5F55\u7BA1\u7406 \u2014\u2014 \u8FD0\u7EF4\u5DE5\u7A0B\u5E08\u4E0A\u4F20\u548C\u67E5\u8BE2\u5BF9 Agent \u7684\u64CD\u4F5C\u8BB0\u5F55\u3002\u8BB0\u5F55\u6BCF\u6B21\u8FD0\u7EF4\u64CD\u4F5C\u7684\u5DE5\u4F5C\u7A7A\u95F4\u3001Agent\u3001\u5173\u8054\u6587\u4EF6\u8DEF\u5F84\u548C\u5907\u6CE8\u4FE1\u606F"
|
|
2243
2236
|
);
|
|
2244
|
-
opsRecord.command("list").description("\u5217\u51FA\u8FD0\u7EF4\u64CD\u4F5C\u8BB0\u5F55\u3002\u8FD4\u56DE record_id\u3001workspace_id\u3001agent_id\u3001operator_name\u3001path\u3001remark \u7B49\u5B57\u6BB5").option("--workspace <workspace_id>", "\u6309\u5DE5\u4F5C\u7A7A\u95F4 ID \u7B5B\u9009").option("--agent <agent_id>", "\u6309 Agent ID \u7B5B\u9009").option("--page <number>", "\u9875\u7801", "1").option("--page-size <number>", "\u6BCF\u9875\u6570\u91CF", "20").action(async (opts) => {
|
|
2237
|
+
opsRecord.command("list").description("\u5217\u51FA\u8FD0\u7EF4\u64CD\u4F5C\u8BB0\u5F55\u3002\u8FD4\u56DE record_id\u3001workspace_id\u3001agent_id\u3001operator_name\u3001path\u3001remark \u7B49\u5B57\u6BB5").option("--workspace-id <workspace_id>", "\u6309\u5DE5\u4F5C\u7A7A\u95F4 ID \u7B5B\u9009").option("--agent <agent_id>", "\u6309 Agent ID \u7B5B\u9009").option("--page <number>", "\u9875\u7801", "1").option("--page-size <number>", "\u6BCF\u9875\u6570\u91CF", "20").action(async (opts) => {
|
|
2245
2238
|
try {
|
|
2246
2239
|
const data = await listOperationsRecords({
|
|
2247
|
-
workspaceId: opts.
|
|
2240
|
+
workspaceId: opts.workspaceId,
|
|
2248
2241
|
agentId: opts.agent,
|
|
2249
2242
|
page: Number(opts.page),
|
|
2250
2243
|
pageSize: Number(opts.pageSize)
|
|
@@ -2264,10 +2257,10 @@ function registerOperationsRecordCommand(program2) {
|
|
|
2264
2257
|
process.exit(toExitCode(error));
|
|
2265
2258
|
}
|
|
2266
2259
|
});
|
|
2267
|
-
opsRecord.command("create").description("\u521B\u5EFA\u8FD0\u7EF4\u64CD\u4F5C\u8BB0\u5F55\u3002operator_id \u548C operator_name \u81EA\u52A8\u4ECE\u5F53\u524D\u767B\u5F55\u7528\u6237\u83B7\u53D6").requiredOption("--workspace <workspace_id>", "\u5DE5\u4F5C\u7A7A\u95F4 ID\uFF08\u4ECE workspace list \u83B7\u53D6\uFF09").requiredOption("--agent <agent_id>", "Agent ID\uFF08\u4ECE agent list \u83B7\u53D6\uFF09").option("--workspace-name <name>", "\u5DE5\u4F5C\u7A7A\u95F4\u540D\u79F0\uFF08\u4FBF\u4E8E\u9605\u8BFB\uFF09").option("--agent-name <name>", "Agent \u540D\u79F0\uFF08\u4FBF\u4E8E\u9605\u8BFB\uFF09").option("--path <path>", "\u5173\u8054\u7684\u6587\u4EF6\u76EE\u5F55\u5730\u5740").option("--remark <remark>", "\u5907\u6CE8\u8BF4\u660E").action(async (opts) => {
|
|
2260
|
+
opsRecord.command("create").description("\u521B\u5EFA\u8FD0\u7EF4\u64CD\u4F5C\u8BB0\u5F55\u3002operator_id \u548C operator_name \u81EA\u52A8\u4ECE\u5F53\u524D\u767B\u5F55\u7528\u6237\u83B7\u53D6").requiredOption("--workspace-id <workspace_id>", "\u5DE5\u4F5C\u7A7A\u95F4 ID\uFF08\u4ECE workspace list \u83B7\u53D6\uFF09").requiredOption("--agent <agent_id>", "Agent ID\uFF08\u4ECE agent list \u83B7\u53D6\uFF09").option("--workspace-name <name>", "\u5DE5\u4F5C\u7A7A\u95F4\u540D\u79F0\uFF08\u4FBF\u4E8E\u9605\u8BFB\uFF09").option("--agent-name <name>", "Agent \u540D\u79F0\uFF08\u4FBF\u4E8E\u9605\u8BFB\uFF09").option("--path <path>", "\u5173\u8054\u7684\u6587\u4EF6\u76EE\u5F55\u5730\u5740").option("--remark <remark>", "\u5907\u6CE8\u8BF4\u660E").action(async (opts) => {
|
|
2268
2261
|
try {
|
|
2269
2262
|
const data = await createOperationsRecord({
|
|
2270
|
-
workspace_id: opts.
|
|
2263
|
+
workspace_id: opts.workspaceId,
|
|
2271
2264
|
agent_id: opts.agent,
|
|
2272
2265
|
workspace_name: opts.workspaceName,
|
|
2273
2266
|
agent_name: opts.agentName,
|