@kweaver-ai/chatkit 0.1.1 → 0.1.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.
Files changed (49) hide show
  1. package/README.md +3 -3
  2. package/dist/chatkit.cjs.js +377 -22
  3. package/dist/chatkit.es.js +72685 -2011
  4. package/dist/components/Avatar/Avatar-1.d.ts +6 -0
  5. package/dist/components/Avatar/Avatar-10.d.ts +6 -0
  6. package/dist/components/Avatar/Avatar-2.d.ts +6 -0
  7. package/dist/components/Avatar/Avatar-3.d.ts +6 -0
  8. package/dist/components/Avatar/Avatar-4.d.ts +6 -0
  9. package/dist/components/Avatar/Avatar-5.d.ts +6 -0
  10. package/dist/components/Avatar/Avatar-6.d.ts +6 -0
  11. package/dist/components/Avatar/Avatar-7.d.ts +6 -0
  12. package/dist/components/Avatar/Avatar-8.d.ts +6 -0
  13. package/dist/components/Avatar/Avatar-9.d.ts +6 -0
  14. package/dist/components/Avatar/index.d.ts +38 -0
  15. package/dist/components/base/ChatKitBase.d.ts +17 -2
  16. package/dist/components/base/assistant/AssistantBase.d.ts +47 -4
  17. package/dist/components/base/assistant/ConversationHistory.d.ts +26 -0
  18. package/dist/components/base/assistant/MessageItem.d.ts +4 -0
  19. package/dist/components/base/assistant/MessageList.d.ts +4 -0
  20. package/dist/components/base/assistant/Prologue.d.ts +2 -0
  21. package/dist/components/base/assistant/blocks/CodeViewTool/CodeViewTool.d.ts +22 -0
  22. package/dist/components/base/assistant/blocks/CodeViewTool/SqlFormatter.d.ts +24 -0
  23. package/dist/components/base/assistant/blocks/CodeViewTool/index.d.ts +4 -0
  24. package/dist/components/base/assistant/blocks/Json2PlotBlock/EChartsView.d.ts +25 -0
  25. package/dist/components/base/assistant/blocks/Json2PlotBlock/Json2PlotContentView.d.ts +21 -0
  26. package/dist/components/base/assistant/blocks/Json2PlotBlock/Json2PlotModal.d.ts +21 -0
  27. package/dist/components/base/assistant/blocks/Json2PlotBlock/TableView.d.ts +21 -0
  28. package/dist/components/base/assistant/blocks/Json2PlotBlock/index.d.ts +9 -0
  29. package/dist/components/base/assistant/blocks/Json2PlotBlock/utils.d.ts +14 -0
  30. package/dist/components/base/assistant/blocks/Json2PlotBlock.d.ts +20 -0
  31. package/dist/components/base/assistant/blocks/MarkdownBlock.d.ts +4 -0
  32. package/dist/components/base/assistant/blocks/index.d.ts +3 -0
  33. package/dist/components/base/copilot/MessageItem.d.ts +2 -0
  34. package/dist/components/base/copilot/MessageList.d.ts +2 -0
  35. package/dist/components/base/copilot/blocks/MarkdownBlock.d.ts +4 -0
  36. package/dist/components/dip/DIPBase.d.ts +73 -35
  37. package/dist/components/icons/AssistantIcon.d.ts +6 -0
  38. package/dist/components/icons/ColumnIcon.d.ts +6 -0
  39. package/dist/components/icons/ExpandIcon.d.ts +6 -0
  40. package/dist/components/icons/JsonPlotIcon.d.ts +6 -0
  41. package/dist/components/icons/LineIcon.d.ts +6 -0
  42. package/dist/components/icons/MoreIcon.d.ts +6 -0
  43. package/dist/components/icons/NewIcon.d.ts +6 -0
  44. package/dist/components/icons/PieIcon.d.ts +6 -0
  45. package/dist/components/icons/TableIcon.d.ts +6 -0
  46. package/dist/components/icons/Text2SqlIcon.d.ts +6 -0
  47. package/dist/components/icons/index.d.ts +10 -0
  48. package/dist/types/index.d.ts +86 -3
  49. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, ChatMessage, OnboardingInfo, WebSearchQuery, ConversationHistory } from '../../types';
1
+ import { ApplicationContext, ChatMessage, OnboardingInfo, WebSearchQuery, ChartDataSchema, ConversationHistory } from '../../types';
2
2
  import { Constructor } from '../../utils/mixins';
3
3
  /**
4
4
  * DIP 的 AssistantMessage 接口
@@ -10,13 +10,6 @@ interface AssistantMessage {
10
10
  conversation_id?: string;
11
11
  role?: string;
12
12
  content?: {
13
- final_answer?: {
14
- thinking?: string;
15
- answer?: {
16
- text?: string;
17
- };
18
- answer_type_other?: OtherTypeAnswer;
19
- };
20
13
  middle_answer?: {
21
14
  progress?: Progress[];
22
15
  };
@@ -71,8 +64,8 @@ interface EventMessage {
71
64
  * DIPBase 的 props 接口
72
65
  */
73
66
  export interface DIPBaseProps {
74
- /** AISHU DIP 的 Agent ID,用作路径参数 */
75
- agentId: string;
67
+ /** AISHU DIP 的 Agent Key,用作路径参数 */
68
+ agentKey: string;
76
69
  /** 访问令牌,需要包含 Bearer 前缀 (已废弃,请使用 token 属性) */
77
70
  bearerToken?: string;
78
71
  /** 服务端基础地址,应包含 /api/agent-app/v1 前缀 */
@@ -106,8 +99,10 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
106
99
  new (...args: any[]): {
107
100
  /** 服务端基础地址 */
108
101
  dipBaseUrl: string;
109
- /** Agent ID */
110
- dipId: string;
102
+ /** Agent Key (agent 标识) */
103
+ dipKey: string;
104
+ /** Agent 信息 */
105
+ agentInfo: any;
111
106
  /** agent 版本 */
112
107
  dipVersion: string;
113
108
  /** 智能体执行引擎版本 */
@@ -121,7 +116,7 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
121
116
  /**
122
117
  * 获取开场白和预置问题
123
118
  * 调用 AISHU DIP 的 agent-factory API 获取智能体配置信息,提取开场白和预置问题
124
- * API 端点: GET /api/agent-factory/v3/agent-market/agent/{agent_id}/version/v0
119
+ * API 端点: GET /api/agent-factory/v3/agent-market/agent/{agent_key}/version/v0
125
120
  * 注意:该方法是一个无状态无副作用的函数,不允许修改 state
126
121
  * @returns 返回开场白信息,包含开场白文案和预置问题
127
122
  */
@@ -129,11 +124,12 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
129
124
  /**
130
125
  * 创建新的会话
131
126
  * 调用 DIP API 创建新的会话,返回会话 ID
132
- * API 端点: POST /app/{agent_id}/conversation
127
+ * API 端点: POST /app/{agent_key}/conversation
133
128
  * 注意:该方法是一个无状态无副作用的函数,不允许修改 state
129
+ * @param title 会话标题,通常是用户发送的第一条消息内容
134
130
  * @returns 返回新创建的会话 ID
135
131
  */
136
- generateConversation(): Promise<string>;
132
+ generateConversation(title?: string): Promise<string>;
137
133
  /**
138
134
  * 调用 DIP API 发送消息(流式)
139
135
  * 该方法实现了完整的消息发送逻辑,子类无需覆盖
@@ -158,8 +154,8 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
158
154
  parseEventMessage(raw: any): EventMessage;
159
155
  /**
160
156
  * 将 key 数组转换为 JSONPath 字符串
161
- * 例如: ["message", "content", "final_answer", "answer", "text"]
162
- * => "message.content.final_answer.answer.text"
157
+ * 例如: ["message", "content", "middle_answer", "progress", 0]
158
+ * => "message.content.middle_answer.progress[0]"
163
159
  */
164
160
  keyToJSONPath(key: Array<string | number>): string;
165
161
  /**
@@ -178,6 +174,19 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
178
174
  * tool_calls[0] 是 SearchIntent(输入),tool_calls[1] 是 SearchResult(输出)
179
175
  */
180
176
  extractWebSearchQuery(progress: any): WebSearchQuery | null;
177
+ /**
178
+ * 从 Progress 对象中提取 Json2Plot 图表数据
179
+ * 根据 OpenAPI 规范,Json2Plot 数据在 answer.choices[0].message.tool_calls 中
180
+ * tool_calls 中包含 Json2PlotAnswer,格式为 { result: Json2PlotResult, full_result: Json2PlotFullResult }
181
+ * Json2PlotResult 包含: data_sample, chart_config, title, text
182
+ * Json2PlotFullResult 包含: data, chart_config, title, text
183
+ * ChartConfig 包含: xField, yField, seriesField, chart_type, groupField, isStack, isGroup
184
+ */
185
+ extractJson2PlotData(progress: any): ChartDataSchema | null;
186
+ /**
187
+ * 推断数据类型
188
+ */
189
+ inferDataType(value: any): "string" | "number" | "date" | "boolean";
181
190
  /**
182
191
  * 处理技能调用的统一方法
183
192
  * 根据设计文档 3.2 Event Message 白名单中的后处理逻辑
@@ -186,13 +195,6 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
186
195
  * @param messageId 消息 ID
187
196
  */
188
197
  processSkillExecution(skillInfo: SkillInfo | undefined, answer: any, messageId: string): void;
189
- /**
190
- * 处理 final_answer.answer_type_other
191
- * 根据设计文档 3.2 Event Message 白名单中的后处理逻辑
192
- * @param content OtherTypeAnswer 对象
193
- * @param messageId 消息 ID
194
- */
195
- processFinalAnswerTypeOther(content: OtherTypeAnswer, messageId: string): void;
196
198
  /**
197
199
  * 处理 middle_answer.progress 中的一个元素
198
200
  * 根据设计文档 3.2 Event Message 白名单中的后处理逻辑
@@ -202,18 +204,21 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
202
204
  processMiddleAnswerProgress(content: Progress, messageId: string): void;
203
205
  /**
204
206
  * 从 answer.choices 中提取 Web 搜索查询
205
- * 用于处理 final_answer.answer_type_other 和 middle_answer.progress 中的搜索结果
207
+ * 用于处理 middle_answer.progress 中的搜索结果
206
208
  */
207
209
  extractWebSearchQueryFromAnswer(answer: any): WebSearchQuery | null;
208
210
  /**
209
- * 从 skill_info.args 中提取图表数据
211
+ * 从 skill_info.args 和 answer 中提取图表数据并转换为 ChartDataSchema
210
212
  * 用于处理 json2plot 工具的输出
213
+ * @param args 技能参数数组(保留用于 API 一致性,实际数据从 answer 中提取)
214
+ * @param answer 技能执行的 answer 字段,包含 result 或 full_result
215
+ * @returns ChartDataSchema 对象,如果解析失败则返回 null
211
216
  */
212
- extractChartDataFromArgs(args: Array<{
217
+ extractChartDataFromArgs(_args: Array<{
213
218
  name?: string;
214
219
  type?: string;
215
220
  value?: string;
216
- }> | undefined): any;
221
+ }> | undefined, answer: any): ChartDataSchema | null;
217
222
  /**
218
223
  * 从 skill_info.args 和 answer 中提取代码执行结果
219
224
  * 用于处理 execute_code 工具的输入和输出
@@ -229,6 +234,39 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
229
234
  input: string;
230
235
  output: string;
231
236
  } | null;
237
+ /**
238
+ * 从 skill_info.args 和 answer 中提取 Text2SQL 结果
239
+ * 用于处理 text2sql 工具的输入和输出
240
+ * 根据 OpenAPI 规范,Text2SqlResult 包含 result 和 full_result
241
+ * - result: Text2SqlResultData(包含 data_desc,但可能只有数据样本)
242
+ * - full_result: Text2SqlFullResultData(包含完整数据,但没有 data_desc)
243
+ * 优先使用 full_result,如果没有则使用 result
244
+ * @param args skill_info.args 数组,包含查询文本
245
+ * @param answer 技能执行的 answer 字段,包含 SQL 执行结果
246
+ * @returns Text2SqlResult 对象,包含 input、sql、data 等信息
247
+ */
248
+ extractText2SqlResult(args: Array<{
249
+ name?: string;
250
+ type?: string;
251
+ value?: string;
252
+ }> | undefined, answer: any): {
253
+ input: string;
254
+ sql: string;
255
+ data?: Array<Record<string, any>>;
256
+ cites?: Array<{
257
+ id: string;
258
+ name: string;
259
+ type: string;
260
+ description?: string;
261
+ }>;
262
+ title?: string;
263
+ message?: string;
264
+ dataDesc?: {
265
+ return_records_num?: number;
266
+ real_records_num?: number;
267
+ };
268
+ explanation?: any;
269
+ } | null;
232
270
  /**
233
271
  * 将技能调用或 LLM 回答的内容追加到消息中
234
272
  * 用于历史消息解析,根据 stage 和 skill_info 将内容添加到 ChatMessage.content 数组
@@ -265,7 +303,7 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
265
303
  shouldRefreshToken(status: number, _error: any): boolean;
266
304
  /**
267
305
  * 终止会话
268
- * 调用 DIP 的 /app/{agent_id}/chat/termination 接口终止指定会话
306
+ * 调用 DIP 的 /app/{agent_key}/chat/termination 接口终止指定会话
269
307
  * @param conversationId 要终止的会话 ID
270
308
  * @returns 返回 Promise,成功时 resolve,失败时 reject
271
309
  */
@@ -278,8 +316,8 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
278
316
  executeDataAgentWithTokenRefresh<T>(apiCall: () => Promise<T>): Promise<T>;
279
317
  /**
280
318
  * 获取历史会话列表
281
- * 调用 DIP 的 GET /app/{agent_id}/conversation 接口获取会话列表
282
- * API 端点: GET /app/{agent_id}/conversation?page={page}&size={size}
319
+ * 调用 DIP 的 GET /app/{agent_key}/conversation 接口获取会话列表
320
+ * API 端点: GET /app/{agent_key}/conversation?page={page}&size={size}
283
321
  * 注意:该方法是一个无状态无副作用的函数,不允许修改 state
284
322
  * @param page 分页页码,默认为 1
285
323
  * @param size 每页返回条数,默认为 10
@@ -288,9 +326,9 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
288
326
  getConversations(page?: number, size?: number): Promise<ConversationHistory[]>;
289
327
  /**
290
328
  * 获取指定会话 ID 的对话消息列表
291
- * 调用 DIP 的 GET /app/{agent_id}/conversation/{conversation_id} 接口获取会话详情
329
+ * 调用 DIP 的 GET /app/{agent_key}/conversation/{conversation_id} 接口获取会话详情
292
330
  * 如果对话消息是 AI 助手消息,则需要调用 reduceAssistantMessage() 解析消息
293
- * API 端点: GET /app/{agent_id}/conversation/{conversation_id}
331
+ * API 端点: GET /app/{agent_key}/conversation/{conversation_id}
294
332
  * 注意:该方法是一个无状态无副作用的函数,不允许修改 state
295
333
  * @param conversationId 会话 ID
296
334
  * @returns 返回对话消息列表
@@ -298,8 +336,8 @@ export declare function DIPBaseMixin<TBase extends Constructor>(Base: TBase): {
298
336
  getConversationMessages(conversationId: string): Promise<ChatMessage[]>;
299
337
  /**
300
338
  * 删除指定 ID 的会话
301
- * 调用 DIP 的 DELETE /app/{agent_id}/conversation/{conversation_id} 接口删除会话
302
- * API 端点: DELETE /app/{agent_id}/conversation/{conversation_id}
339
+ * 调用 DIP 的 DELETE /app/{agent_key}/conversation/{conversation_id} 接口删除会话
340
+ * API 端点: DELETE /app/{agent_key}/conversation/{conversation_id}
303
341
  * 注意:该方法是一个无状态无副作用的函数,不允许修改 state
304
342
  * @param conversationID 会话 ID
305
343
  * @returns 返回 Promise,成功时 resolve,失败时 reject
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * Assistant 图标组件
4
+ */
5
+ export declare const AssistantIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default AssistantIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 柱状图图标组件
4
+ */
5
+ export declare const ColumnIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default ColumnIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 展开图标组件
4
+ */
5
+ export declare const ExpandIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default ExpandIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * JSON Plot 图标组件
4
+ */
5
+ export declare const JsonPlotIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default JsonPlotIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 折线图图标组件
4
+ */
5
+ export declare const LineIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default LineIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 更多图标组件
4
+ */
5
+ export declare const MoreIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default MoreIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 新建图标组件
4
+ */
5
+ export declare const NewIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default NewIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 饼图图标组件
4
+ */
5
+ export declare const PieIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default PieIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 表格图标组件
4
+ */
5
+ export declare const TableIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default TableIcon;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * Text2Plot 图标组件
4
+ */
5
+ export declare const Text2SqlIcon: React.FC<React.SVGProps<SVGSVGElement>>;
6
+ export default Text2SqlIcon;
@@ -5,3 +5,13 @@ export { CloseIcon } from './CloseIcon';
5
5
  export { StopIcon } from './StopIcon';
6
6
  export { SendIcon } from './SendIcon';
7
7
  export { ClockIcon } from './ClockIcon';
8
+ export { PieIcon } from './PieIcon';
9
+ export { LineIcon } from './LineIcon';
10
+ export { ColumnIcon } from './ColumnIcon';
11
+ export { TableIcon } from './TableIcon';
12
+ export { JsonPlotIcon } from './JsonPlotIcon';
13
+ export { Text2SqlIcon } from './Text2SqlIcon';
14
+ export { AssistantIcon } from './AssistantIcon';
15
+ export { MoreIcon } from './MoreIcon';
16
+ export { NewIcon } from './NewIcon';
17
+ export { ExpandIcon } from './ExpandIcon';
@@ -32,7 +32,11 @@ export declare enum BlockType {
32
32
  /** Web 搜索类型 */
33
33
  WEB_SEARCH = "WebSearch",
34
34
  /** 工具调用类型 */
35
- TOOL = "Tool"
35
+ TOOL = "Tool",
36
+ /** JSON2Plot 图表类型 */
37
+ JSON2PLOT = "Json2Plot",
38
+ /** Text2SQL 类型 */
39
+ Text2Sql = "Text2Sql"
36
40
  }
37
41
  /**
38
42
  * 角色接口
@@ -79,6 +83,11 @@ export interface WebSearchBlock extends ContentBlock<BlockType.WEB_SEARCH, WebSe
79
83
  */
80
84
  export interface ToolBlock extends ContentBlock<BlockType.TOOL, ToolCallData> {
81
85
  }
86
+ /**
87
+ * JSON2Plot 图表类型的消息块
88
+ */
89
+ export interface Json2PlotBlock extends ContentBlock<BlockType.JSON2PLOT, ChartDataSchema> {
90
+ }
82
91
  /**
83
92
  * 消息接口
84
93
  * 展示在消息区消息列表中的一条消息
@@ -91,7 +100,7 @@ export interface ChatMessage {
91
100
  /** 该条消息的类型(已废弃,保留用于向后兼容) */
92
101
  type?: ChatMessageType;
93
102
  /** 该条消息的内容。一条消息可以由许多不同类型的消息块组成 */
94
- content: Array<TextBlock | MarkdownBlock | WebSearchBlock | ToolBlock>;
103
+ content: Array<TextBlock | MarkdownBlock | WebSearchBlock | ToolBlock | Json2PlotBlock>;
95
104
  /** 与该消息关联的应用上下文(可选),仅用户消息可能包含此字段 */
96
105
  applicationContext?: ApplicationContext;
97
106
  }
@@ -161,6 +170,19 @@ export interface ExecuteCodeResult {
161
170
  /** 代码执行后转为自然语言的输出结果,以 Markdown 格式显示 */
162
171
  output: string;
163
172
  }
173
+ /**
174
+ * Text2SQL 结果接口
175
+ * Text2SQL 工具的输入和输出信息
176
+ * 根据 OpenAPI 规范,answer 包含 result 和 full_result
177
+ * - result: Text2SqlResultData(包含 data_desc,但可能只有数据样本)
178
+ * - full_result: Text2SqlFullResultData(包含完整数据,但没有 data_desc)
179
+ */
180
+ export interface Text2SqlResult {
181
+ /** 输入的查询文本 */
182
+ title: string;
183
+ data: Array<Record<string, any>>;
184
+ sql: string;
185
+ }
164
186
  /**
165
187
  * 工具调用数据接口
166
188
  * 工具调用的输入和输出信息
@@ -213,9 +235,10 @@ export interface ChatKitInterface {
213
235
  * 该方法需要由子类继承并重写,以适配扣子、Dify 等 LLMOps 平台的接口
214
236
  * 成功返回会话 ID
215
237
  * 注意:该方法是一个无状态无副作用的函数,不允许修改 state
238
+ * @param title 会话标题,通常是用户发送的第一条消息内容
216
239
  * @returns 返回新创建的会话 ID
217
240
  */
218
- generateConversation(): Promise<string>;
241
+ generateConversation(title?: string): Promise<string>;
219
242
  /**
220
243
  * 向后端发送消息
221
244
  * 该方法需要由开发者实现,以适配扣子、Dify等 LLMOps 平台的接口
@@ -283,3 +306,63 @@ export interface ChatKitInterface {
283
306
  */
284
307
  deleteConversation(conversationID: string): Promise<void>;
285
308
  }
309
+ /**
310
+ * 图表类型枚举
311
+ * 支持的图表类型
312
+ */
313
+ export type ChartType = 'Line' | 'Column' | 'Pie' | 'Circle';
314
+ /**
315
+ * 数据行
316
+ */
317
+ export type DataRow = Record<string, any>;
318
+ /**
319
+ * 维度接口
320
+ */
321
+ export interface Dimension {
322
+ /** 字段名 */
323
+ name: string;
324
+ /** 显示名称 */
325
+ displayName: string;
326
+ /** 数据类型 */
327
+ dataType: 'string' | 'number' | 'date' | 'boolean';
328
+ }
329
+ /**
330
+ * 度量接口
331
+ */
332
+ export interface Measure {
333
+ /** 字段名 */
334
+ name: string;
335
+ /** 显示名称 */
336
+ displayName: string;
337
+ /** 数据类型 */
338
+ dataType: 'number' | 'string';
339
+ /** 聚合方式 */
340
+ aggregation?: 'sum' | 'avg' | 'count' | 'max' | 'min';
341
+ }
342
+ /**
343
+ * 图表数据 Schema
344
+ */
345
+ export interface ChartDataSchema {
346
+ /** 图表类型 */
347
+ chartType: ChartType;
348
+ /** 图表名称/标题(可选) */
349
+ title?: string;
350
+ /** 维度列表 */
351
+ dimensions: Dimension[];
352
+ /** 度量列表 */
353
+ measures: Measure[];
354
+ /** 数据行列表 */
355
+ rows: DataRow[];
356
+ }
357
+ /**
358
+ * 日期范围枚举
359
+ */
360
+ export declare enum DateRange {
361
+ Minute = "minute",
362
+ Hour = "hour",
363
+ ToDay = "toDay",
364
+ Yesterday = "yesterday",
365
+ SixDay = "sixDay",
366
+ Month = "month",
367
+ Year = "year"
368
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kweaver-ai/chatkit",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,7 +24,8 @@
24
24
  "build": "npm run build:lib && npm run build:types",
25
25
  "build:lib": "vite build --config vite.config.lib.ts",
26
26
  "build:types": "tsc --project tsconfig.lib.json",
27
- "preview": "vite preview"
27
+ "preview": "vite preview",
28
+ "prepare": "npm run build"
28
29
  },
29
30
  "keywords": [
30
31
  "chat",