cheshirecat-typescript-client 1.8.3 → 1.8.4
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/endpoints/conversation.d.ts +14 -3
- package/dist/endpoints/conversation.js +25 -6
- package/dist/endpoints/conversation.js.map +1 -1
- package/dist/models/api/conversations.d.ts +2 -1
- package/dist/models/api/conversations.js +4 -3
- package/dist/models/api/conversations.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractEndpoint } from "./abstract";
|
|
2
|
-
import { ConversationDeleteOutput, ConversationHistoryOutput,
|
|
2
|
+
import { ConversationDeleteOutput, ConversationHistoryOutput, ConversationAttributesChangeOutput, ConversationsResponse } from "../models/api/conversations";
|
|
3
3
|
export declare class ConversationEndpoint extends AbstractEndpoint {
|
|
4
4
|
protected prefix: string;
|
|
5
5
|
/**
|
|
@@ -21,6 +21,16 @@ export declare class ConversationEndpoint extends AbstractEndpoint {
|
|
|
21
21
|
* @returns An array of conversation attributes.
|
|
22
22
|
*/
|
|
23
23
|
getConversations(agentId: string, userId: string): Promise<ConversationsResponse[]>;
|
|
24
|
+
/**
|
|
25
|
+
* This endpoint returns the attributes of a given conversation, for a given agent and user.
|
|
26
|
+
*
|
|
27
|
+
* @param agentId The agent ID.
|
|
28
|
+
* @param userId The user ID to filter the conversation attributes by.
|
|
29
|
+
* @param chatId The chat ID to filter the conversation attributes by.
|
|
30
|
+
*
|
|
31
|
+
* @returns The conversation attributes.
|
|
32
|
+
*/
|
|
33
|
+
getConversation(agentId: string, userId: string, chatId: string): Promise<ConversationsResponse>;
|
|
24
34
|
/**
|
|
25
35
|
* This endpoint deletes the conversation.
|
|
26
36
|
*
|
|
@@ -34,12 +44,13 @@ export declare class ConversationEndpoint extends AbstractEndpoint {
|
|
|
34
44
|
/**
|
|
35
45
|
* This endpoint changes the name of the conversation.
|
|
36
46
|
*
|
|
37
|
-
* @param name The new name of the conversation.
|
|
38
47
|
* @param agentId The agent ID.
|
|
39
48
|
* @param userId The user ID to add the conversation history to.
|
|
40
49
|
* @param chatId The chat ID to add the conversation history to.
|
|
50
|
+
* @param name The new name of the conversation.
|
|
51
|
+
* @param metadata The metadata to associate to the conversation.
|
|
41
52
|
*
|
|
42
53
|
* @returns The output of the change operation.
|
|
43
54
|
*/
|
|
44
|
-
|
|
55
|
+
putConversationAttributes(agentId: string, userId: string, chatId: string, name?: string | null, metadata?: Record<string, any>): Promise<ConversationAttributesChangeOutput>;
|
|
45
56
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ConversationEndpoint = void 0;
|
|
4
4
|
const abstract_1 = require("./abstract");
|
|
5
5
|
class ConversationEndpoint extends abstract_1.AbstractEndpoint {
|
|
6
|
-
prefix = "/
|
|
6
|
+
prefix = "/conversations";
|
|
7
7
|
/**
|
|
8
8
|
* This endpoint returns the conversation history.
|
|
9
9
|
*
|
|
@@ -14,7 +14,7 @@ class ConversationEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
14
14
|
* @returns The conversation history.
|
|
15
15
|
*/
|
|
16
16
|
async getConversationHistory(agentId, userId, chatId) {
|
|
17
|
-
return this.get(this.formatUrl(chatId), agentId, userId);
|
|
17
|
+
return this.get(this.formatUrl(`/${chatId}/history`), agentId, userId);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* This endpoint returns all conversation attributes for a given agent and user.
|
|
@@ -32,6 +32,18 @@ class ConversationEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
32
32
|
const conversations = response.data;
|
|
33
33
|
return conversations.map((conversation) => this.deserialize(JSON.stringify(conversation)));
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* This endpoint returns the attributes of a given conversation, for a given agent and user.
|
|
37
|
+
*
|
|
38
|
+
* @param agentId The agent ID.
|
|
39
|
+
* @param userId The user ID to filter the conversation attributes by.
|
|
40
|
+
* @param chatId The chat ID to filter the conversation attributes by.
|
|
41
|
+
*
|
|
42
|
+
* @returns The conversation attributes.
|
|
43
|
+
*/
|
|
44
|
+
async getConversation(agentId, userId, chatId) {
|
|
45
|
+
return this.get(this.formatUrl(chatId), agentId, userId);
|
|
46
|
+
}
|
|
35
47
|
/**
|
|
36
48
|
* This endpoint deletes the conversation.
|
|
37
49
|
*
|
|
@@ -47,16 +59,23 @@ class ConversationEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
47
59
|
/**
|
|
48
60
|
* This endpoint changes the name of the conversation.
|
|
49
61
|
*
|
|
50
|
-
* @param name The new name of the conversation.
|
|
51
62
|
* @param agentId The agent ID.
|
|
52
63
|
* @param userId The user ID to add the conversation history to.
|
|
53
64
|
* @param chatId The chat ID to add the conversation history to.
|
|
65
|
+
* @param name The new name of the conversation.
|
|
66
|
+
* @param metadata The metadata to associate to the conversation.
|
|
54
67
|
*
|
|
55
68
|
* @returns The output of the change operation.
|
|
56
69
|
*/
|
|
57
|
-
async
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
async putConversationAttributes(agentId, userId, chatId, name, metadata) {
|
|
71
|
+
if (!name && !metadata) {
|
|
72
|
+
throw new Error("Either name or metadata must be provided");
|
|
73
|
+
}
|
|
74
|
+
const payload = {
|
|
75
|
+
...name && { name: name },
|
|
76
|
+
...metadata && { metadata: metadata },
|
|
77
|
+
};
|
|
78
|
+
return this.put(this.formatUrl(chatId), agentId, payload, userId);
|
|
60
79
|
}
|
|
61
80
|
}
|
|
62
81
|
exports.ConversationEndpoint = ConversationEndpoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/endpoints/conversation.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAQ5C,MAAa,oBAAqB,SAAQ,2BAAgB;IAC5C,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/endpoints/conversation.ts"],"names":[],"mappings":";;;A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EACP,MAAM,CACT,CAAC;IACN,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,yBAAyB,CAC3B,OAAe,EACf,MAAc,EACd,MAAc,EACd,IAAoB,EACpB,QAA8B;QAE9B,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,OAAO,GAAQ;YACjB,GAAG,IAAI,IAAI,EAAC,IAAI,EAAE,IAAI,EAAC;YACvB,GAAG,QAAQ,IAAI,EAAC,QAAQ,EAAE,QAAQ,EAAC;SACtC,CAAC;QAEF,OAAO,IAAI,CAAC,GAAG,CAAqC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1G,CAAC;CACJ;AAvGD,oDAuGC"}
|
|
@@ -10,9 +10,10 @@ export declare class ConversationsResponse {
|
|
|
10
10
|
chat_id: string;
|
|
11
11
|
name: string;
|
|
12
12
|
num_messages: number;
|
|
13
|
+
metadata: Record<string, any>;
|
|
13
14
|
created_at: number | null;
|
|
14
15
|
updated_at: number | null;
|
|
15
16
|
}
|
|
16
|
-
export declare class
|
|
17
|
+
export declare class ConversationAttributesChangeOutput {
|
|
17
18
|
changed: boolean;
|
|
18
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ConversationAttributesChangeOutput = exports.ConversationsResponse = exports.ConversationHistoryOutput = void 0;
|
|
4
4
|
class ConversationHistoryOutput {
|
|
5
5
|
history;
|
|
6
6
|
toArray() {
|
|
@@ -13,12 +13,13 @@ class ConversationsResponse {
|
|
|
13
13
|
chat_id;
|
|
14
14
|
name;
|
|
15
15
|
num_messages;
|
|
16
|
+
metadata;
|
|
16
17
|
created_at;
|
|
17
18
|
updated_at;
|
|
18
19
|
}
|
|
19
20
|
exports.ConversationsResponse = ConversationsResponse;
|
|
20
|
-
class
|
|
21
|
+
class ConversationAttributesChangeOutput {
|
|
21
22
|
changed;
|
|
22
23
|
}
|
|
23
|
-
exports.
|
|
24
|
+
exports.ConversationAttributesChangeOutput = ConversationAttributesChangeOutput;
|
|
24
25
|
//# sourceMappingURL=conversations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/models/api/conversations.ts"],"names":[],"mappings":";;;AAMA,MAAa,yBAAyB;IAClC,OAAO,CAAwB;IAExB,OAAO;QACV,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,OAAO,EAAE,OAAO,EAAE,CAAC;IACvB,CAAC;CACJ;AAPD,8DAOC;AAED,MAAa,qBAAqB;IAC9B,OAAO,CAAS;IAChB,IAAI,CAAS;IACb,YAAY,CAAS;IACrB,UAAU,CAAgB;IAC1B,UAAU,CAAgB;CAC7B;
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/models/api/conversations.ts"],"names":[],"mappings":";;;AAMA,MAAa,yBAAyB;IAClC,OAAO,CAAwB;IAExB,OAAO;QACV,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,OAAO,EAAE,OAAO,EAAE,CAAC;IACvB,CAAC;CACJ;AAPD,8DAOC;AAED,MAAa,qBAAqB;IAC9B,OAAO,CAAS;IAChB,IAAI,CAAS;IACb,YAAY,CAAS;IACrB,QAAQ,CAAsB;IAC9B,UAAU,CAAgB;IAC1B,UAAU,CAAgB;CAC7B;AAPD,sDAOC;AAED,MAAa,kCAAkC;IAC3C,OAAO,CAAU;CACpB;AAFD,gFAEC"}
|