cheshirecat-typescript-client 1.6.1 → 1.7.0
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 +13 -18
- package/dist/endpoints/conversation.js +21 -26
- package/dist/endpoints/conversation.js.map +1 -1
- package/dist/models/api/conversations.d.ts +11 -3
- package/dist/models/api/conversations.js +11 -1
- package/dist/models/api/conversations.js.map +1 -1
- package/dist/models/api/nested/memories.d.ts +1 -1
- package/dist/models/api/nested/memories.js +3 -3
- package/dist/models/api/nested/memories.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AbstractEndpoint } from "./abstract";
|
|
2
|
-
import {
|
|
3
|
-
import { Role } from "../types";
|
|
4
|
-
import { Why } from "../models/dtos";
|
|
2
|
+
import { ConversationDeleteOutput, ConversationHistoryOutput, ConversationNameChangeOutput, ConversationsResponse } from "../models/api/conversations";
|
|
5
3
|
export declare class ConversationEndpoint extends AbstractEndpoint {
|
|
6
4
|
protected prefix: string;
|
|
7
5
|
/**
|
|
@@ -15,36 +13,33 @@ export declare class ConversationEndpoint extends AbstractEndpoint {
|
|
|
15
13
|
*/
|
|
16
14
|
getConversationHistory(agentId: string, userId: string, chatId: string): Promise<ConversationHistoryOutput>;
|
|
17
15
|
/**
|
|
18
|
-
* This endpoint returns all conversation
|
|
16
|
+
* This endpoint returns all conversation attributes for a given agent and user.
|
|
19
17
|
*
|
|
20
18
|
* @param agentId The agent ID.
|
|
21
|
-
* @param userId The user ID to filter the conversation
|
|
19
|
+
* @param userId The user ID to filter the conversation attributes by.
|
|
22
20
|
*
|
|
23
|
-
* @returns An
|
|
21
|
+
* @returns An array of conversation attributes.
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
getConversations(agentId: string, userId: string): Promise<ConversationsResponse[]>;
|
|
26
24
|
/**
|
|
27
|
-
* This endpoint deletes the conversation
|
|
25
|
+
* This endpoint deletes the conversation.
|
|
28
26
|
*
|
|
29
27
|
* @param agentId The agent ID.
|
|
30
|
-
* @param userId The user ID to filter the conversation
|
|
31
|
-
* @param chatId The chat ID to filter the conversation
|
|
28
|
+
* @param userId The user ID to filter the conversation by.
|
|
29
|
+
* @param chatId The chat ID to filter the conversation by.
|
|
32
30
|
*
|
|
33
31
|
* @returns The output of the deletion operation.
|
|
34
32
|
*/
|
|
35
|
-
|
|
33
|
+
deleteConversation(agentId: string, userId: string, chatId: string): Promise<ConversationDeleteOutput>;
|
|
36
34
|
/**
|
|
37
|
-
* This endpoint
|
|
35
|
+
* This endpoint changes the name of the conversation.
|
|
38
36
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param text The text of the conversation history.
|
|
37
|
+
* @param name The new name of the conversation.
|
|
41
38
|
* @param agentId The agent ID.
|
|
42
39
|
* @param userId The user ID to add the conversation history to.
|
|
43
40
|
* @param chatId The chat ID to add the conversation history to.
|
|
44
|
-
* @param image The image of the conversation history.
|
|
45
|
-
* @param why The reason for the conversation history.
|
|
46
41
|
*
|
|
47
|
-
* @returns The
|
|
42
|
+
* @returns The output of the change operation.
|
|
48
43
|
*/
|
|
49
|
-
|
|
44
|
+
postConversationName(name: string, agentId: string, userId: string, chatId: string): Promise<ConversationNameChangeOutput>;
|
|
50
45
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConversationEndpoint = void 0;
|
|
4
4
|
const abstract_1 = require("./abstract");
|
|
5
|
+
const conversations_1 = require("../models/api/conversations");
|
|
5
6
|
class ConversationEndpoint extends abstract_1.AbstractEndpoint {
|
|
6
7
|
prefix = "/conversation";
|
|
7
8
|
/**
|
|
@@ -17,56 +18,50 @@ class ConversationEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
17
18
|
return this.get(this.formatUrl(chatId), agentId, userId);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
|
-
* This endpoint returns all conversation
|
|
21
|
+
* This endpoint returns all conversation attributes for a given agent and user.
|
|
21
22
|
*
|
|
22
23
|
* @param agentId The agent ID.
|
|
23
|
-
* @param userId The user ID to filter the conversation
|
|
24
|
+
* @param userId The user ID to filter the conversation attributes by.
|
|
24
25
|
*
|
|
25
|
-
* @returns An
|
|
26
|
+
* @returns An array of conversation attributes.
|
|
26
27
|
*/
|
|
27
|
-
async
|
|
28
|
+
async getConversations(agentId, userId) {
|
|
28
29
|
const response = await this.getHttpClient(agentId, userId).get(this.prefix);
|
|
29
30
|
if (response.status !== 200) {
|
|
30
31
|
throw new Error(`Failed to fetch data from ${this.prefix}: ${response.statusText}`);
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
return response.data.map((item) => {
|
|
34
|
+
const conversation = new conversations_1.ConversationsResponse();
|
|
35
|
+
conversation.chat_id = item.chat_id;
|
|
36
|
+
conversation.name = item.name;
|
|
37
|
+
conversation.num_messages = item.num_messages;
|
|
38
|
+
return conversation;
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
|
-
* This endpoint deletes the conversation
|
|
42
|
+
* This endpoint deletes the conversation.
|
|
40
43
|
*
|
|
41
44
|
* @param agentId The agent ID.
|
|
42
|
-
* @param userId The user ID to filter the conversation
|
|
43
|
-
* @param chatId The chat ID to filter the conversation
|
|
45
|
+
* @param userId The user ID to filter the conversation by.
|
|
46
|
+
* @param chatId The chat ID to filter the conversation by.
|
|
44
47
|
*
|
|
45
48
|
* @returns The output of the deletion operation.
|
|
46
49
|
*/
|
|
47
|
-
async
|
|
50
|
+
async deleteConversation(agentId, userId, chatId) {
|
|
48
51
|
return this.delete(this.formatUrl(chatId), agentId, userId);
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
|
-
* This endpoint
|
|
54
|
+
* This endpoint changes the name of the conversation.
|
|
52
55
|
*
|
|
53
|
-
* @param
|
|
54
|
-
* @param text The text of the conversation history.
|
|
56
|
+
* @param name The new name of the conversation.
|
|
55
57
|
* @param agentId The agent ID.
|
|
56
58
|
* @param userId The user ID to add the conversation history to.
|
|
57
59
|
* @param chatId The chat ID to add the conversation history to.
|
|
58
|
-
* @param image The image of the conversation history.
|
|
59
|
-
* @param why The reason for the conversation history.
|
|
60
60
|
*
|
|
61
|
-
* @returns The
|
|
61
|
+
* @returns The output of the change operation.
|
|
62
62
|
*/
|
|
63
|
-
async
|
|
64
|
-
const payload = {
|
|
65
|
-
who: who,
|
|
66
|
-
text,
|
|
67
|
-
...(image && { image }),
|
|
68
|
-
...(why && { why: why.toArray() }),
|
|
69
|
-
};
|
|
63
|
+
async postConversationName(name, agentId, userId, chatId) {
|
|
64
|
+
const payload = { name };
|
|
70
65
|
return this.post(this.formatUrl(chatId), agentId, payload, userId);
|
|
71
66
|
}
|
|
72
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/endpoints/conversation.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/endpoints/conversation.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAC5C,+DAKqC;AAIrC,MAAa,oBAAqB,SAAQ,2BAAgB;IAC5C,MAAM,GAAG,eAAe,CAAC;IAEnC;;;;;;;;OAQG;IACH,KAAK,CAAC,sBAAsB,CACxB,OAAe,EACf,MAAc,EACd,MAAc;QAEd,OAAO,IAAI,CAAC,GAAG,CAA4B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAe,EAAE,MAAc;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5E,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACxF,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;YACnC,MAAM,YAAY,GAAG,IAAI,qCAAqB,EAAE,CAAC;YACjD,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YACpC,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YAC9B,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YAC9C,OAAO,YAAY,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,kBAAkB,CACpB,OAAe,EACf,MAAc,EACd,MAAc;QAEd,OAAO,IAAI,CAAC,MAAM,CACd,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EACtB,OAAO,EACP,MAAM,CACT,CAAC;IACN,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,oBAAoB,CACtB,IAAY,EACZ,OAAe,EACf,MAAc,EACd,MAAc;QAEd,MAAM,OAAO,GAAG,EAAC,IAAI,EAAC,CAAC;QAEvB,OAAO,IAAI,CAAC,IAAI,CAA+B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACrG,CAAC;CACJ;AApFD,oDAoFC"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface
|
|
1
|
+
import { ConversationMessage } from "./nested/memories";
|
|
2
|
+
export interface ConversationDeleteOutput {
|
|
3
3
|
deleted: boolean;
|
|
4
4
|
}
|
|
5
5
|
export declare class ConversationHistoryOutput {
|
|
6
|
-
history:
|
|
6
|
+
history: ConversationMessage[];
|
|
7
7
|
toArray(): Record<string, unknown>;
|
|
8
8
|
}
|
|
9
|
+
export declare class ConversationsResponse {
|
|
10
|
+
chat_id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
num_messages: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class ConversationNameChangeOutput {
|
|
15
|
+
changed: boolean;
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConversationHistoryOutput = void 0;
|
|
3
|
+
exports.ConversationNameChangeOutput = exports.ConversationsResponse = exports.ConversationHistoryOutput = void 0;
|
|
4
4
|
class ConversationHistoryOutput {
|
|
5
5
|
history;
|
|
6
6
|
toArray() {
|
|
@@ -9,4 +9,14 @@ class ConversationHistoryOutput {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.ConversationHistoryOutput = ConversationHistoryOutput;
|
|
12
|
+
class ConversationsResponse {
|
|
13
|
+
chat_id;
|
|
14
|
+
name;
|
|
15
|
+
num_messages;
|
|
16
|
+
}
|
|
17
|
+
exports.ConversationsResponse = ConversationsResponse;
|
|
18
|
+
class ConversationNameChangeOutput {
|
|
19
|
+
changed;
|
|
20
|
+
}
|
|
21
|
+
exports.ConversationNameChangeOutput = ConversationNameChangeOutput;
|
|
12
22
|
//# 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,
|
|
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;CACxB;AAJD,sDAIC;AAED,MAAa,4BAA4B;IACrC,OAAO,CAAU;CACpB;AAFD,oEAEC"}
|
|
@@ -7,7 +7,7 @@ export declare class ConversationHistoryItemContent extends MessageBase {
|
|
|
7
7
|
why?: Why | null;
|
|
8
8
|
toArray(): object;
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class ConversationMessage {
|
|
11
11
|
who: string;
|
|
12
12
|
when: number;
|
|
13
13
|
content: ConversationHistoryItemContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ConversationMessage = exports.ConversationHistoryItemContent = void 0;
|
|
4
4
|
const dtos_1 = require("../../dtos");
|
|
5
5
|
class ConversationHistoryItemContent extends dtos_1.MessageBase {
|
|
6
6
|
why = null;
|
|
@@ -19,7 +19,7 @@ class ConversationHistoryItemContent extends dtos_1.MessageBase {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.ConversationHistoryItemContent = ConversationHistoryItemContent;
|
|
22
|
-
class
|
|
22
|
+
class ConversationMessage {
|
|
23
23
|
who;
|
|
24
24
|
when;
|
|
25
25
|
content;
|
|
@@ -31,5 +31,5 @@ class ConversationHistoryItem {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
exports.
|
|
34
|
+
exports.ConversationMessage = ConversationMessage;
|
|
35
35
|
//# sourceMappingURL=memories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memories.js","sourceRoot":"","sources":["../../../../src/models/api/nested/memories.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAO5C,MAAa,8BAA+B,SAAQ,kBAAW;IAC3D,GAAG,GAAgB,IAAI,CAAC;IAEjB,OAAO;QACV,IAAI,IAAI,GAAW;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAC;QAEF,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,GAAG;gBACH,GAAG,IAAI;gBACP,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE;aAC3B,CAAC;QACN,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlBD,wEAkBC;AAED,MAAa,
|
|
1
|
+
{"version":3,"file":"memories.js","sourceRoot":"","sources":["../../../../src/models/api/nested/memories.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAO5C,MAAa,8BAA+B,SAAQ,kBAAW;IAC3D,GAAG,GAAgB,IAAI,CAAC;IAEjB,OAAO;QACV,IAAI,IAAI,GAAW;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAC;QAEF,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,GAAG;gBACH,GAAG,IAAI;gBACP,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE;aAC3B,CAAC;QACN,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlBD,wEAkBC;AAED,MAAa,mBAAmB;IAC5B,GAAG,CAAS;IACZ,IAAI,CAAS;IACb,OAAO,CAAiC;IAEjC,OAAO;QACV,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,GAAG;YACf,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACjC,MAAM,EAAE,IAAI,CAAC,IAAI;SACpB,CAAC;IACN,CAAC;CACJ;AAZD,kDAYC"}
|