@xpert-ai/chatkit-types 0.0.1 → 0.0.3
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/index.d.ts +205 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -11
- package/index.js +0 -1
- package/types/index.d.ts +0 -193
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Quick local publish (interactive)
|
|
|
7
7
|
```bash
|
|
8
8
|
cd packages/chatkit
|
|
9
9
|
# (optional) generate/verify type declarations
|
|
10
|
-
pnpm run
|
|
10
|
+
pnpm run build
|
|
11
11
|
# increment version (optional but recommended)
|
|
12
12
|
pnpm version patch
|
|
13
13
|
# publish (scoped packages require --access public)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
export declare interface ChatkitMessage {
|
|
2
|
+
status?: string
|
|
3
|
+
content: TMessageItems
|
|
4
|
+
reasoning?: TMessageContentReasoning[]
|
|
5
|
+
type: 'user' | 'assistant' | 'system' | 'tool' | 'event'
|
|
6
|
+
id: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* https://js.langchain.com/docs/how_to/streaming/#event-reference
|
|
11
|
+
*/
|
|
12
|
+
export declare enum ChatMessageEventTypeEnum {
|
|
13
|
+
ON_CONVERSATION_START = 'on_conversation_start',
|
|
14
|
+
ON_CONVERSATION_END = 'on_conversation_end',
|
|
15
|
+
ON_MESSAGE_START = 'on_message_start',
|
|
16
|
+
ON_MESSAGE_END = 'on_message_end',
|
|
17
|
+
ON_TOOL_START = 'on_tool_start',
|
|
18
|
+
ON_TOOL_END = 'on_tool_end',
|
|
19
|
+
ON_TOOL_ERROR = 'on_tool_error',
|
|
20
|
+
/**
|
|
21
|
+
* Step message in tool call
|
|
22
|
+
*/
|
|
23
|
+
ON_TOOL_MESSAGE = 'on_tool_message',
|
|
24
|
+
ON_AGENT_START = 'on_agent_start',
|
|
25
|
+
ON_AGENT_END = 'on_agent_end',
|
|
26
|
+
ON_RETRIEVER_START = 'on_retriever_start',
|
|
27
|
+
ON_RETRIEVER_END = 'on_retriever_end',
|
|
28
|
+
ON_RETRIEVER_ERROR = 'on_retriever_error',
|
|
29
|
+
ON_INTERRUPT = 'on_interrupt',
|
|
30
|
+
ON_ERROR = 'on_error',
|
|
31
|
+
ON_CHAT_EVENT = 'on_chat_event',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Category of step message: determines the display components of computer use
|
|
36
|
+
*/
|
|
37
|
+
export declare enum ChatMessageStepCategory {
|
|
38
|
+
/**
|
|
39
|
+
* List of items: urls, files, etc.
|
|
40
|
+
*/
|
|
41
|
+
List = 'list',
|
|
42
|
+
/**
|
|
43
|
+
* Websearch results
|
|
44
|
+
*/
|
|
45
|
+
WebSearch = 'web_search',
|
|
46
|
+
/**
|
|
47
|
+
* Files list
|
|
48
|
+
*/
|
|
49
|
+
Files = 'files',
|
|
50
|
+
/**
|
|
51
|
+
* View a file
|
|
52
|
+
*/
|
|
53
|
+
File = 'file',
|
|
54
|
+
/**
|
|
55
|
+
* Program Execution
|
|
56
|
+
*/
|
|
57
|
+
Program = 'program',
|
|
58
|
+
/**
|
|
59
|
+
* Iframe
|
|
60
|
+
*/
|
|
61
|
+
Iframe = 'iframe',
|
|
62
|
+
|
|
63
|
+
Memory = 'memory',
|
|
64
|
+
|
|
65
|
+
Tasks = 'tasks',
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Knowledges (knowledge base retriever results)
|
|
69
|
+
*/
|
|
70
|
+
Knowledges = 'knowledges'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export declare enum ChatMessageTypeEnum {
|
|
74
|
+
// LOG = 'log',
|
|
75
|
+
MESSAGE = 'message',
|
|
76
|
+
EVENT = 'event'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export declare type ImageDetail = "auto" | "low" | "high";
|
|
80
|
+
|
|
81
|
+
export declare type MessageContentImageUrl = {
|
|
82
|
+
type: "image_url";
|
|
83
|
+
image_url: string | {
|
|
84
|
+
url: string;
|
|
85
|
+
detail?: ImageDetail;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export declare type MessageContentText = {
|
|
90
|
+
type: "text";
|
|
91
|
+
text: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Data type for chat event message
|
|
96
|
+
*/
|
|
97
|
+
export declare type TChatEventMessage = {
|
|
98
|
+
type?: string
|
|
99
|
+
title?: string
|
|
100
|
+
message?: string
|
|
101
|
+
status?: 'success' | 'fail' | 'running'
|
|
102
|
+
created_date?: Date | string
|
|
103
|
+
end_date?: Date | string
|
|
104
|
+
error?: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Step message type, in canvas and ai message.
|
|
109
|
+
*/
|
|
110
|
+
export declare type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}
|
|
114
|
+
*/
|
|
115
|
+
export declare type TMessageComponent<T extends object = object> = T & {
|
|
116
|
+
id?: string
|
|
117
|
+
category: 'Dashboard' | 'Computer' | 'Tool'
|
|
118
|
+
type?: string
|
|
119
|
+
created_date?: Date | string
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare type TMessageComponentIframe = {
|
|
123
|
+
type: 'iframe'
|
|
124
|
+
title: string
|
|
125
|
+
url?: string
|
|
126
|
+
data?: {
|
|
127
|
+
url?: string
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export declare type TMessageComponentStep<T = unknown> = {
|
|
132
|
+
type: ChatMessageStepCategory
|
|
133
|
+
toolset: string
|
|
134
|
+
toolset_id: string
|
|
135
|
+
tool?: string
|
|
136
|
+
title: string
|
|
137
|
+
message: string
|
|
138
|
+
status: 'success' | 'fail' | 'running'
|
|
139
|
+
created_date: Date | string
|
|
140
|
+
end_date: Date | string
|
|
141
|
+
error?: string
|
|
142
|
+
data?: T
|
|
143
|
+
input?: any
|
|
144
|
+
output?: string
|
|
145
|
+
artifact?: any
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Enhance {@link MessageContent} in Langchain.js
|
|
150
|
+
*
|
|
151
|
+
* @deprecated use {@link TMessageItems} instead
|
|
152
|
+
*/
|
|
153
|
+
export declare type TMessageContent = string | TMessageContentComplex[];
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Enhance {@link MessageContentComplex} in Langchain.js
|
|
157
|
+
*/
|
|
158
|
+
export declare type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentMemory | (Record<string, any> & {
|
|
159
|
+
type?: "text" | "image_url" | string;
|
|
160
|
+
}) | (Record<string, any> & {
|
|
161
|
+
type?: never;
|
|
162
|
+
})) & {
|
|
163
|
+
id?: string
|
|
164
|
+
xpertName?: string
|
|
165
|
+
agentKey?: string;
|
|
166
|
+
created_date?: Date | string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}
|
|
171
|
+
*/
|
|
172
|
+
export declare type TMessageContentComponent<T extends object = object> = {
|
|
173
|
+
id: string
|
|
174
|
+
type: 'component'
|
|
175
|
+
data: TMessageComponent<T>
|
|
176
|
+
xpertName?: string
|
|
177
|
+
agentKey?: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export declare type TMessageContentMemory = {
|
|
181
|
+
id?: string
|
|
182
|
+
agentKey?: string
|
|
183
|
+
type: "memory";
|
|
184
|
+
data: any[];
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export declare type TMessageContentReasoning = {
|
|
188
|
+
id?: string
|
|
189
|
+
xpertName?: string
|
|
190
|
+
agentKey?: string
|
|
191
|
+
type: "reasoning";
|
|
192
|
+
text: string;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export declare type TMessageContentText = {
|
|
196
|
+
id?: string
|
|
197
|
+
xpertName?: string
|
|
198
|
+
agentKey?: string
|
|
199
|
+
type: "text";
|
|
200
|
+
text: string;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export declare type TMessageItems = TMessageContentComplex[];
|
|
204
|
+
|
|
205
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var ChatMessageTypeEnum = /* @__PURE__ */ ((ChatMessageTypeEnum2) => {
|
|
2
|
+
ChatMessageTypeEnum2["MESSAGE"] = "message";
|
|
3
|
+
ChatMessageTypeEnum2["EVENT"] = "event";
|
|
4
|
+
return ChatMessageTypeEnum2;
|
|
5
|
+
})(ChatMessageTypeEnum || {});
|
|
6
|
+
var ChatMessageEventTypeEnum = /* @__PURE__ */ ((ChatMessageEventTypeEnum2) => {
|
|
7
|
+
ChatMessageEventTypeEnum2["ON_CONVERSATION_START"] = "on_conversation_start";
|
|
8
|
+
ChatMessageEventTypeEnum2["ON_CONVERSATION_END"] = "on_conversation_end";
|
|
9
|
+
ChatMessageEventTypeEnum2["ON_MESSAGE_START"] = "on_message_start";
|
|
10
|
+
ChatMessageEventTypeEnum2["ON_MESSAGE_END"] = "on_message_end";
|
|
11
|
+
ChatMessageEventTypeEnum2["ON_TOOL_START"] = "on_tool_start";
|
|
12
|
+
ChatMessageEventTypeEnum2["ON_TOOL_END"] = "on_tool_end";
|
|
13
|
+
ChatMessageEventTypeEnum2["ON_TOOL_ERROR"] = "on_tool_error";
|
|
14
|
+
ChatMessageEventTypeEnum2["ON_TOOL_MESSAGE"] = "on_tool_message";
|
|
15
|
+
ChatMessageEventTypeEnum2["ON_AGENT_START"] = "on_agent_start";
|
|
16
|
+
ChatMessageEventTypeEnum2["ON_AGENT_END"] = "on_agent_end";
|
|
17
|
+
ChatMessageEventTypeEnum2["ON_RETRIEVER_START"] = "on_retriever_start";
|
|
18
|
+
ChatMessageEventTypeEnum2["ON_RETRIEVER_END"] = "on_retriever_end";
|
|
19
|
+
ChatMessageEventTypeEnum2["ON_RETRIEVER_ERROR"] = "on_retriever_error";
|
|
20
|
+
ChatMessageEventTypeEnum2["ON_INTERRUPT"] = "on_interrupt";
|
|
21
|
+
ChatMessageEventTypeEnum2["ON_ERROR"] = "on_error";
|
|
22
|
+
ChatMessageEventTypeEnum2["ON_CHAT_EVENT"] = "on_chat_event";
|
|
23
|
+
return ChatMessageEventTypeEnum2;
|
|
24
|
+
})(ChatMessageEventTypeEnum || {});
|
|
25
|
+
var ChatMessageStepCategory = /* @__PURE__ */ ((ChatMessageStepCategory2) => {
|
|
26
|
+
ChatMessageStepCategory2["List"] = "list";
|
|
27
|
+
ChatMessageStepCategory2["WebSearch"] = "web_search";
|
|
28
|
+
ChatMessageStepCategory2["Files"] = "files";
|
|
29
|
+
ChatMessageStepCategory2["File"] = "file";
|
|
30
|
+
ChatMessageStepCategory2["Program"] = "program";
|
|
31
|
+
ChatMessageStepCategory2["Iframe"] = "iframe";
|
|
32
|
+
ChatMessageStepCategory2["Memory"] = "memory";
|
|
33
|
+
ChatMessageStepCategory2["Tasks"] = "tasks";
|
|
34
|
+
ChatMessageStepCategory2["Knowledges"] = "knowledges";
|
|
35
|
+
return ChatMessageStepCategory2;
|
|
36
|
+
})(ChatMessageStepCategory || {});
|
|
37
|
+
export {
|
|
38
|
+
ChatMessageEventTypeEnum,
|
|
39
|
+
ChatMessageStepCategory,
|
|
40
|
+
ChatMessageTypeEnum
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export enum ChatMessageTypeEnum {\n // LOG = 'log',\n MESSAGE = 'message',\n EVENT = 'event'\n}\n\n/**\n * https://js.langchain.com/docs/how_to/streaming/#event-reference\n */\nexport enum ChatMessageEventTypeEnum {\n ON_CONVERSATION_START = 'on_conversation_start',\n ON_CONVERSATION_END = 'on_conversation_end',\n ON_MESSAGE_START = 'on_message_start',\n ON_MESSAGE_END = 'on_message_end',\n ON_TOOL_START = 'on_tool_start',\n ON_TOOL_END = 'on_tool_end',\n ON_TOOL_ERROR = 'on_tool_error',\n /**\n * Step message in tool call\n */\n ON_TOOL_MESSAGE = 'on_tool_message',\n ON_AGENT_START = 'on_agent_start',\n ON_AGENT_END = 'on_agent_end',\n ON_RETRIEVER_START = 'on_retriever_start',\n ON_RETRIEVER_END = 'on_retriever_end',\n ON_RETRIEVER_ERROR = 'on_retriever_error',\n ON_INTERRUPT = 'on_interrupt',\n ON_ERROR = 'on_error',\n ON_CHAT_EVENT = 'on_chat_event',\n}\n\n/**\n * Category of step message: determines the display components of computer use\n */\nexport enum ChatMessageStepCategory {\n /**\n * List of items: urls, files, etc.\n */\n List = 'list',\n /**\n * Websearch results\n */\n WebSearch = 'web_search',\n /**\n * Files list\n */\n Files = 'files',\n /**\n * View a file\n */\n File = 'file',\n /**\n * Program Execution\n */\n Program = 'program',\n /**\n * Iframe\n */\n Iframe = 'iframe',\n\n Memory = 'memory',\n\n Tasks = 'tasks',\n\n /**\n * Knowledges (knowledge base retriever results)\n */\n Knowledges = 'knowledges'\n}\n\n/**\n * Step message type, in canvas and ai message.\n */\nexport type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>\n\nexport type ImageDetail = \"auto\" | \"low\" | \"high\";\nexport type MessageContentText = {\n type: \"text\";\n text: string;\n};\nexport type MessageContentImageUrl = {\n type: \"image_url\";\n image_url: string | {\n url: string;\n detail?: ImageDetail;\n };\n};\n\n/**\n * Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}\n */\nexport type TMessageContentComponent<T extends object = object> = {\n id: string\n type: 'component'\n data: TMessageComponent<T>\n xpertName?: string\n agentKey?: string;\n}\n\n/**\n * Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}\n */\nexport type TMessageComponent<T extends object = object> = T & {\n id?: string\n category: 'Dashboard' | 'Computer' | 'Tool'\n type?: string\n created_date?: Date | string\n}\n\nexport type TMessageContentText = {\n id?: string\n xpertName?: string\n agentKey?: string\n type: \"text\";\n text: string;\n};\nexport type TMessageContentMemory = {\n id?: string\n agentKey?: string\n type: \"memory\";\n data: any[];\n};\nexport type TMessageContentReasoning = {\n id?: string\n xpertName?: string\n agentKey?: string\n type: \"reasoning\";\n text: string;\n};\n/**\n * Enhance {@link MessageContentComplex} in Langchain.js\n */\nexport type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentMemory | (Record<string, any> & {\n type?: \"text\" | \"image_url\" | string;\n}) | (Record<string, any> & {\n type?: never;\n})) & {\n id?: string\n xpertName?: string\n agentKey?: string;\n created_date?: Date | string\n}\n\n/**\n * Enhance {@link MessageContent} in Langchain.js\n * \n * @deprecated use {@link TMessageItems} instead\n */\nexport type TMessageContent = string | TMessageContentComplex[];\n\nexport type TMessageComponentIframe = {\n type: 'iframe'\n title: string\n url?: string\n data?: {\n url?: string\n }\n}\n\nexport type TMessageComponentStep<T = unknown> = {\n type: ChatMessageStepCategory\n toolset: string\n toolset_id: string\n tool?: string\n title: string\n message: string\n status: 'success' | 'fail' | 'running'\n created_date: Date | string\n end_date: Date | string\n error?: string\n data?: T\n input?: any\n output?: string\n artifact?: any\n}\n\n/**\n * Data type for chat event message\n */\nexport type TChatEventMessage = {\n type?: string\n title?: string\n message?: string\n status?: 'success' | 'fail' | 'running'\n created_date?: Date | string\n end_date?: Date | string\n error?: string\n}\n\nexport interface ChatkitMessage {\n status?: string\n content: TMessageItems\n reasoning?: TMessageContentReasoning[]\n type: 'user' | 'assistant' | 'system' | 'tool' | 'event'\n id: string\n}\n\nexport type TMessageItems = TMessageContentComplex[];"],"names":["ChatMessageTypeEnum","ChatMessageEventTypeEnum","ChatMessageStepCategory"],"mappings":"AAAO,IAAK,wCAAAA,yBAAL;AAELA,uBAAA,SAAA,IAAU;AACVA,uBAAA,OAAA,IAAQ;AAHE,SAAAA;AAAA,GAAA,uBAAA,CAAA,CAAA;AASL,IAAK,6CAAAC,8BAAL;AACLA,4BAAA,uBAAA,IAAwB;AACxBA,4BAAA,qBAAA,IAAsB;AACtBA,4BAAA,kBAAA,IAAmB;AACnBA,4BAAA,gBAAA,IAAiB;AACjBA,4BAAA,eAAA,IAAgB;AAChBA,4BAAA,aAAA,IAAc;AACdA,4BAAA,eAAA,IAAgB;AAIhBA,4BAAA,iBAAA,IAAkB;AAClBA,4BAAA,gBAAA,IAAiB;AACjBA,4BAAA,cAAA,IAAe;AACfA,4BAAA,oBAAA,IAAqB;AACrBA,4BAAA,kBAAA,IAAmB;AACnBA,4BAAA,oBAAA,IAAqB;AACrBA,4BAAA,cAAA,IAAe;AACfA,4BAAA,UAAA,IAAW;AACXA,4BAAA,eAAA,IAAgB;AAnBN,SAAAA;AAAA,GAAA,4BAAA,CAAA,CAAA;AAyBL,IAAK,4CAAAC,6BAAL;AAILA,2BAAA,MAAA,IAAO;AAIPA,2BAAA,WAAA,IAAY;AAIZA,2BAAA,OAAA,IAAQ;AAIRA,2BAAA,MAAA,IAAO;AAIPA,2BAAA,SAAA,IAAU;AAIVA,2BAAA,QAAA,IAAS;AAETA,2BAAA,QAAA,IAAS;AAETA,2BAAA,OAAA,IAAQ;AAKRA,2BAAA,YAAA,IAAa;AAjCH,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/chatkit-types",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "0.0.3",
|
|
5
4
|
"description": "Type definitions for the ChatKit Web Component.",
|
|
6
5
|
"sideEffects": false,
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
],
|
|
12
|
-
"types": "./types/index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
13
10
|
"exports": {
|
|
11
|
+
"./package.json": "./package.json",
|
|
14
12
|
".": {
|
|
15
|
-
"types": "./
|
|
16
|
-
"import": "./index.js",
|
|
17
|
-
"default": "./index.js"
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"default": "./dist/index.js"
|
|
18
16
|
}
|
|
19
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"!**/*.tsbuildinfo"
|
|
22
|
+
],
|
|
20
23
|
"scripts": {
|
|
24
|
+
"build": "vite build",
|
|
21
25
|
"types": "tsc",
|
|
22
26
|
"clean": "rimraf dist"
|
|
23
27
|
},
|
|
@@ -33,5 +37,9 @@
|
|
|
33
37
|
"peerDependencies": {
|
|
34
38
|
"@langchain/core": "^1.0.2",
|
|
35
39
|
"@langchain/langgraph-sdk": "^1.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"vite": "^5.0.0",
|
|
43
|
+
"vite-plugin-dts": "^3.7.0"
|
|
36
44
|
}
|
|
37
45
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types/index.d'
|
package/types/index.d.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
export enum ChatMessageTypeEnum {
|
|
2
|
-
// LOG = 'log',
|
|
3
|
-
MESSAGE = 'message',
|
|
4
|
-
EVENT = 'event'
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* https://js.langchain.com/docs/how_to/streaming/#event-reference
|
|
9
|
-
*/
|
|
10
|
-
export enum ChatMessageEventTypeEnum {
|
|
11
|
-
ON_CONVERSATION_START = 'on_conversation_start',
|
|
12
|
-
ON_CONVERSATION_END = 'on_conversation_end',
|
|
13
|
-
ON_MESSAGE_START = 'on_message_start',
|
|
14
|
-
ON_MESSAGE_END = 'on_message_end',
|
|
15
|
-
ON_TOOL_START = 'on_tool_start',
|
|
16
|
-
ON_TOOL_END = 'on_tool_end',
|
|
17
|
-
ON_TOOL_ERROR = 'on_tool_error',
|
|
18
|
-
/**
|
|
19
|
-
* Step message in tool call
|
|
20
|
-
*/
|
|
21
|
-
ON_TOOL_MESSAGE = 'on_tool_message',
|
|
22
|
-
ON_AGENT_START = 'on_agent_start',
|
|
23
|
-
ON_AGENT_END = 'on_agent_end',
|
|
24
|
-
ON_RETRIEVER_START = 'on_retriever_start',
|
|
25
|
-
ON_RETRIEVER_END = 'on_retriever_end',
|
|
26
|
-
ON_RETRIEVER_ERROR = 'on_retriever_error',
|
|
27
|
-
ON_INTERRUPT = 'on_interrupt',
|
|
28
|
-
ON_ERROR = 'on_error',
|
|
29
|
-
ON_CHAT_EVENT = 'on_chat_event',
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Category of step message: determines the display components of computer use
|
|
34
|
-
*/
|
|
35
|
-
export enum ChatMessageStepCategory {
|
|
36
|
-
/**
|
|
37
|
-
* List of items: urls, files, etc.
|
|
38
|
-
*/
|
|
39
|
-
List = 'list',
|
|
40
|
-
/**
|
|
41
|
-
* Websearch results
|
|
42
|
-
*/
|
|
43
|
-
WebSearch = 'web_search',
|
|
44
|
-
/**
|
|
45
|
-
* Files list
|
|
46
|
-
*/
|
|
47
|
-
Files = 'files',
|
|
48
|
-
/**
|
|
49
|
-
* View a file
|
|
50
|
-
*/
|
|
51
|
-
File = 'file',
|
|
52
|
-
/**
|
|
53
|
-
* Program Execution
|
|
54
|
-
*/
|
|
55
|
-
Program = 'program',
|
|
56
|
-
/**
|
|
57
|
-
* Iframe
|
|
58
|
-
*/
|
|
59
|
-
Iframe = 'iframe',
|
|
60
|
-
|
|
61
|
-
Memory = 'memory',
|
|
62
|
-
|
|
63
|
-
Tasks = 'tasks',
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Knowledges (knowledge base retriever results)
|
|
67
|
-
*/
|
|
68
|
-
Knowledges = 'knowledges'
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Step message type, in canvas and ai message.
|
|
73
|
-
*/
|
|
74
|
-
export type TChatMessageStep<T = any> = TMessageComponent<TMessageComponentStep<T>>
|
|
75
|
-
|
|
76
|
-
export type ImageDetail = "auto" | "low" | "high";
|
|
77
|
-
export type MessageContentText = {
|
|
78
|
-
type: "text";
|
|
79
|
-
text: string;
|
|
80
|
-
};
|
|
81
|
-
export type MessageContentImageUrl = {
|
|
82
|
-
type: "image_url";
|
|
83
|
-
image_url: string | {
|
|
84
|
-
url: string;
|
|
85
|
-
detail?: ImageDetail;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Similar to {@link MessageContentText} | {@link MessageContentImageUrl}, which together form {@link MessageContentComplex}
|
|
91
|
-
*/
|
|
92
|
-
export type TMessageContentComponent<T extends object = object> = {
|
|
93
|
-
id: string
|
|
94
|
-
type: 'component'
|
|
95
|
-
data: TMessageComponent<T>
|
|
96
|
-
xpertName?: string
|
|
97
|
-
agentKey?: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Defines the data type of the sub-message of `component` type in the message `content` {@link MessageContentComplex}
|
|
102
|
-
*/
|
|
103
|
-
export type TMessageComponent<T extends object = object> = T & {
|
|
104
|
-
id?: string
|
|
105
|
-
category: 'Dashboard' | 'Computer' | 'Tool'
|
|
106
|
-
type?: string
|
|
107
|
-
created_date?: Date | string
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export type TMessageContentText = {
|
|
111
|
-
id?: string
|
|
112
|
-
xpertName?: string
|
|
113
|
-
agentKey?: string
|
|
114
|
-
type: "text";
|
|
115
|
-
text: string;
|
|
116
|
-
};
|
|
117
|
-
export type TMessageContentMemory = {
|
|
118
|
-
id?: string
|
|
119
|
-
agentKey?: string
|
|
120
|
-
type: "memory";
|
|
121
|
-
data: any[];
|
|
122
|
-
};
|
|
123
|
-
export type TMessageContentReasoning = {
|
|
124
|
-
id?: string
|
|
125
|
-
xpertName?: string
|
|
126
|
-
agentKey?: string
|
|
127
|
-
type: "reasoning";
|
|
128
|
-
text: string;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Enhance {@link MessageContentComplex} in Langchain.js
|
|
132
|
-
*/
|
|
133
|
-
export type TMessageContentComplex = (TMessageContentText | TMessageContentReasoning | MessageContentImageUrl | TMessageContentComponent | TMessageContentMemory | (Record<string, any> & {
|
|
134
|
-
type?: "text" | "image_url" | string;
|
|
135
|
-
}) | (Record<string, any> & {
|
|
136
|
-
type?: never;
|
|
137
|
-
})) & {
|
|
138
|
-
id?: string
|
|
139
|
-
xpertName?: string
|
|
140
|
-
agentKey?: string;
|
|
141
|
-
created_date?: Date | string
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Enhance {@link MessageContent} in Langchain.js
|
|
145
|
-
*/
|
|
146
|
-
export type TMessageContent = string | TMessageContentComplex[];
|
|
147
|
-
|
|
148
|
-
export type TMessageComponentIframe = {
|
|
149
|
-
type: 'iframe'
|
|
150
|
-
title: string
|
|
151
|
-
url?: string
|
|
152
|
-
data?: {
|
|
153
|
-
url?: string
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export type TMessageComponentStep<T = unknown> = {
|
|
158
|
-
type: ChatMessageStepCategory
|
|
159
|
-
toolset: string
|
|
160
|
-
toolset_id: string
|
|
161
|
-
tool?: string
|
|
162
|
-
title: string
|
|
163
|
-
message: string
|
|
164
|
-
status: 'success' | 'fail' | 'running'
|
|
165
|
-
created_date: Date | string
|
|
166
|
-
end_date: Date | string
|
|
167
|
-
error?: string
|
|
168
|
-
data?: T
|
|
169
|
-
input?: any
|
|
170
|
-
output?: string
|
|
171
|
-
artifact?: any
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Data type for chat event message
|
|
176
|
-
*/
|
|
177
|
-
export type TChatEventMessage = {
|
|
178
|
-
type?: string
|
|
179
|
-
title?: string
|
|
180
|
-
message?: string
|
|
181
|
-
status?: 'success' | 'fail' | 'running'
|
|
182
|
-
created_date?: Date | string
|
|
183
|
-
end_date?: Date | string
|
|
184
|
-
error?: string
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export interface ChatkitMessage {
|
|
188
|
-
status?: string
|
|
189
|
-
content: TMessageContent
|
|
190
|
-
reasoning?: TMessageContentReasoning[]
|
|
191
|
-
type: 'user' | 'assistant' | 'system' | 'tool' | 'event'
|
|
192
|
-
id: string
|
|
193
|
-
}
|