@zero-library/chat-copilot 3.2.0 → 3.2.2

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/index.d.ts CHANGED
@@ -610,14 +610,6 @@ interface ConversationMessage {
610
610
  toolCallId?: string;
611
611
  }
612
612
 
613
- /**
614
- * 智能体执行链展示模式
615
- * - aggregate:聚合模式(默认)。将每次执行压缩为「状态图标 + 类型标签 + 单行截断详情」的折叠列表,
616
- * 顶部展示「X 项完成 | Y 项失败」汇总头,最终回答独立渲染在列表下方。
617
- * - sequence:顺序模式(非聚合)。按真实事件顺序平铺渲染思维链(深度思考)、工具调用、文件、计划与回答,
618
- * 不做汇总折叠,忠实还原执行时间线。
619
- */
620
- type AgentExecMode = 'aggregate' | 'sequence';
621
613
  /**
622
614
  * 聊天布局会话列表配置接口
623
615
  * 控制会话列表区域的显示和功能
@@ -687,15 +679,21 @@ interface ChatLayoutHeader {
687
679
  interface CustomButtonProps extends Omit<ButtonProps, 'icon'> {
688
680
  icon?: () => ReactNode;
689
681
  }
690
- type CommandConfig = {
691
- component: string;
682
+ type AvailableResourceType = 'skill' | 'knowledge' | 'datasource' | 'mcp_server' | 'sub_agent' | 'tool';
683
+ type HashCommandConfig = {
684
+ component?: string;
692
685
  dataSource: CascadeCategory[];
693
686
  };
687
+ type CommandConfig = Partial<Record<string, AvailableResourceType[] | HashCommandConfig>>;
694
688
  type CascadeCategory = {
695
689
  value: string;
696
690
  label: string;
697
691
  ext?: string;
698
692
  children?: CascadeCategory[];
693
+ data?: CascadeCategory[];
694
+ };
695
+ type ResourceBtnProps = {
696
+ types?: AvailableResourceType[];
699
697
  };
700
698
  /**
701
699
  * 聊天布局输入框配置接口
@@ -727,6 +725,8 @@ interface ChatLayoutSender {
727
725
  skillsBtn?: RenderControl<void, void>;
728
726
  /** 知识库按钮渲染控制 */
729
727
  knowledgeBtn?: RenderControl<void, void>;
728
+ /** 资源按钮渲染控制 */
729
+ resourceBtn?: RenderControl<void, ResourceBtnProps>;
730
730
  /** 发送按钮属性配置函数 */
731
731
  sendBtnProps?: () => ButtonProps;
732
732
  /** 模型下拉选择配置控制 */
@@ -734,7 +734,7 @@ interface ChatLayoutSender {
734
734
  /** 深度思考按钮渲染控制 */
735
735
  reasonBtn?: RenderControl<void, void>;
736
736
  /** 特殊指令渲染控制 */
737
- commandConfig?: ObjectType<CommandConfig>;
737
+ commandConfig?: CommandConfig;
738
738
  /** 上传文件配置 */
739
739
  uploadConfig?: FileUploadConfig;
740
740
  }
@@ -859,7 +859,7 @@ interface SenderProps {
859
859
  /** 输入框占位符 */
860
860
  placeholder?: string;
861
861
  /** 特殊指令配置 */
862
- commandConfig?: ObjectType<CommandConfig>;
862
+ commandConfig?: CommandConfig;
863
863
  /** 输入框内容 */
864
864
  content?: string;
865
865
  /** 文件列表 */
@@ -931,6 +931,7 @@ declare const createChatService: (request: ReturnType<typeof createRequest>, con
931
931
  conversationFavorite: (conversationId: string, isFavorite: boolean) => Promise<R<boolean>>;
932
932
  shareConversation: (conversationId: string) => Promise<R<ShareConversationResponse>>;
933
933
  fetchExecutionDebug: (conversationId: string) => Promise<R<PageRes<ExecutionDebug>>>;
934
+ fetchAvailableResources: (types?: AvailableResourceType[] | string) => Promise<R<AgentResourcesResp>>;
934
935
  };
935
936
 
936
937
  type RequestInstance = Partial<ReturnType<typeof createChatService>>;
@@ -1723,6 +1724,8 @@ interface ChatConfig {
1723
1724
  agent?: AgentInfo;
1724
1725
  conversationId?: string;
1725
1726
  conversationStrategy?: ConversationStrategy;
1727
+ /** 是否显示执行轨迹日志面板 */
1728
+ showDebugLog?: boolean;
1726
1729
  }
1727
1730
  interface ChatParams {
1728
1731
  convMeta?: ConvMeta;
@@ -1829,6 +1832,59 @@ interface Datasource {
1829
1832
  createdAt: string;
1830
1833
  updatedAt: string;
1831
1834
  }
1835
+ interface SkillSummary {
1836
+ id: string;
1837
+ name: string;
1838
+ aliasName: string;
1839
+ description: string;
1840
+ type: number;
1841
+ state: number;
1842
+ }
1843
+ interface KnowledgeSummary {
1844
+ id: string;
1845
+ name: string;
1846
+ description: string;
1847
+ icon: string;
1848
+ libraryType: number;
1849
+ }
1850
+ interface DatasourceSummary {
1851
+ id: string;
1852
+ name: string;
1853
+ type: number;
1854
+ state: number;
1855
+ }
1856
+ interface McpServerSummary {
1857
+ id: string;
1858
+ serverName: string;
1859
+ displayName?: string;
1860
+ description?: string;
1861
+ transportType: string;
1862
+ state: number;
1863
+ /** 兼容部分接口直接返回 name 字段 */
1864
+ name?: string;
1865
+ }
1866
+ interface SubAgentSummary {
1867
+ id: string;
1868
+ name: string;
1869
+ description?: string;
1870
+ iconUrl?: string;
1871
+ agentType: number;
1872
+ kind: number;
1873
+ }
1874
+ interface ToolSummary {
1875
+ name: string;
1876
+ description: string;
1877
+ category?: string;
1878
+ icon?: string;
1879
+ }
1880
+ interface AgentResourcesResp {
1881
+ skills: SkillSummary[];
1882
+ knowledges: KnowledgeSummary[];
1883
+ datasources: DatasourceSummary[];
1884
+ mcpServers: McpServerSummary[];
1885
+ subAgents: SubAgentSummary[];
1886
+ tools: ToolSummary[];
1887
+ }
1832
1888
  interface DownloadFileReq {
1833
1889
  workspaceType?: WorkspaceTypeEnum;
1834
1890
  workspaceId?: string;
@@ -1856,11 +1912,20 @@ interface AttachmentsProps {
1856
1912
  /** 文件列表变化回调函数 */
1857
1913
  onChange: (fileList: InputFile[]) => void;
1858
1914
  }
1915
+ /**
1916
+ * 附件组件暴露的方法接口
1917
+ */
1918
+ interface AttachmentsHandle {
1919
+ /** 校验当前附件状态是否允许发送 */
1920
+ validateFile: () => boolean;
1921
+ /** 复用同一套上传逻辑处理外部传入的文件 */
1922
+ uploadFiles: (files: File[]) => Promise<void>;
1923
+ }
1859
1924
  /**
1860
1925
  * 附件上传组件
1861
1926
  * 支持多文件上传、文件类型验证、文件大小限制等功能
1862
1927
  */
1863
- declare const _default$1: react.ForwardRefExoticComponent<AttachmentsProps & react.RefAttributes<unknown>>;
1928
+ declare const _default$1: react.ForwardRefExoticComponent<AttachmentsProps & react.RefAttributes<AttachmentsHandle>>;
1864
1929
 
1865
1930
  interface RoleContent {
1866
1931
  role: number;
@@ -1935,12 +2000,26 @@ declare const chatCopilotEnUS: {
1935
2000
  summaryAnalysis: string;
1936
2001
  headerClose: string;
1937
2002
  deepThinking: string;
2003
+ resource: string;
1938
2004
  skill: string;
1939
2005
  knowledge: string;
2006
+ datasource: string;
2007
+ mcpServer: string;
2008
+ subAgent: string;
2009
+ tool: string;
2010
+ loading: string;
1940
2011
  supportedExtensions: string;
1941
2012
  empty: string;
1942
- chatPlaceholder: string;
1943
2013
  selectFile: string;
2014
+ unsupportedType: string;
2015
+ maxFileCountExceed: string;
2016
+ maxFileSizeExceed: string;
2017
+ waitUpload: string;
2018
+ checkFailed: string;
2019
+ dropTitle: string;
2020
+ uploadTitle: string;
2021
+ uploadDescription: string;
2022
+ chatPlaceholder: string;
1944
2023
  selectPlaceholder: string;
1945
2024
  unnamedReport: string;
1946
2025
  unnamedChart: string;
@@ -1961,6 +2040,8 @@ declare const chatCopilotEnUS: {
1961
2040
  nextStep: string;
1962
2041
  submit: string;
1963
2042
  submitFailed: string;
2043
+ questionTitle: string;
2044
+ questionSummary: string;
1964
2045
  questionCancelled: string;
1965
2046
  questionAnswered: string;
1966
2047
  questionDetails: string;
@@ -1986,24 +2067,83 @@ declare const chatCopilotEnUS: {
1986
2067
  previewEdit: string;
1987
2068
  copy: string;
1988
2069
  continueText: string;
2070
+ chatTab: string;
2071
+ traceTab: string;
2072
+ previewTab: string;
2073
+ subAgentTab: string;
2074
+ subAgentExecutionDetail: string;
2075
+ closeSubAgentDetail: string;
2076
+ execItemRunning: string;
2077
+ execItemDone: string;
2078
+ execItemFailed: string;
2079
+ execItemThinking: string;
2080
+ execItemFile: string;
2081
+ execItemPlan: string;
2082
+ toolCallFallback: string;
2083
+ viewExecutionDetail: string;
2084
+ executionStart: string;
2085
+ executionEnd: string;
2086
+ unmatchedStep: string;
2087
+ totalDuration: string;
2088
+ contextSummary: string;
2089
+ tokenUsage: string;
2090
+ modelRequestStarted: string;
2091
+ modelRequest: string;
2092
+ executionMetaModel: string;
2093
+ traceMessages: string;
2094
+ traceTools: string;
2095
+ thoughtChain: string;
2096
+ mainContent: string;
2097
+ toolCall: string;
2098
+ result: string;
2099
+ metadata: string;
2100
+ params: string;
2101
+ userInput: string;
2102
+ output: string;
2103
+ executionFinished: string;
2104
+ executionRunning: string;
2105
+ executionLabel: string;
2106
+ duration: string;
2107
+ inputCount: string;
2108
+ outputCount: string;
2109
+ turnsCount: string;
2110
+ toolsCount: string;
2111
+ eventsCount: string;
2112
+ userMessage: string;
2113
+ turnLabel: string;
2114
+ turnFallback: string;
2115
+ executionCountSorted: string;
2116
+ eventDetail: string;
2117
+ traceSelectHint: string;
2118
+ executionTraceEmpty: string;
2119
+ roleUser: string;
2120
+ roleAssistant: string;
2121
+ roleTool: string;
2122
+ roleSystem: string;
1989
2123
  noVariables: string;
2124
+ dateToday: string;
2125
+ dateLast7Days: string;
2126
+ dateLast30Days: string;
2127
+ dateLastHalfYear: string;
2128
+ dateEarlier: string;
2129
+ previewNotSupported: string;
2130
+ deleteSuccess: string;
2131
+ operationBlocked: string;
2132
+ favoriteSuccess: string;
2133
+ unfavoriteSuccess: string;
2134
+ feedbackThanks: string;
2135
+ sendFailed: string;
2136
+ newConversationTitle: string;
1990
2137
  stopped: string;
1991
2138
  greetingHello: string;
1992
2139
  greetingSubtitle: string;
1993
2140
  disclaimer: string;
2141
+ helloIam: string;
2142
+ newConversation: string;
1994
2143
  uploadFromLocal: string;
1995
2144
  edit: string;
1996
2145
  noUserInputFields: string;
1997
2146
  startConversation: string;
1998
- helloIam: string;
1999
- newConversation: string;
2000
- sendFailed: string;
2001
- previewNotSupported: string;
2002
- operationBlocked: string;
2003
- deleteSuccess: string;
2004
- favoriteSuccess: string;
2005
- unfavoriteSuccess: string;
2006
- feedbackThanks: string;
2007
2147
  };
2008
2148
 
2009
2149
  /**
@@ -2050,8 +2190,14 @@ declare const chatCopilotJaJP: {
2050
2190
  summaryAnalysis: string;
2051
2191
  headerClose: string;
2052
2192
  deepThinking: string;
2193
+ resource: string;
2053
2194
  skill: string;
2054
2195
  knowledge: string;
2196
+ datasource: string;
2197
+ mcpServer: string;
2198
+ subAgent: string;
2199
+ tool: string;
2200
+ loading: string;
2055
2201
  supportedExtensions: string;
2056
2202
  empty: string;
2057
2203
  selectFile: string;
@@ -2084,6 +2230,8 @@ declare const chatCopilotJaJP: {
2084
2230
  nextStep: string;
2085
2231
  submit: string;
2086
2232
  submitFailed: string;
2233
+ questionTitle: string;
2234
+ questionSummary: string;
2087
2235
  questionCancelled: string;
2088
2236
  questionAnswered: string;
2089
2237
  questionDetails: string;
@@ -2109,6 +2257,59 @@ declare const chatCopilotJaJP: {
2109
2257
  previewEdit: string;
2110
2258
  copy: string;
2111
2259
  continueText: string;
2260
+ chatTab: string;
2261
+ traceTab: string;
2262
+ previewTab: string;
2263
+ subAgentTab: string;
2264
+ subAgentExecutionDetail: string;
2265
+ closeSubAgentDetail: string;
2266
+ execItemRunning: string;
2267
+ execItemDone: string;
2268
+ execItemFailed: string;
2269
+ execItemThinking: string;
2270
+ execItemFile: string;
2271
+ execItemPlan: string;
2272
+ toolCallFallback: string;
2273
+ viewExecutionDetail: string;
2274
+ executionStart: string;
2275
+ executionEnd: string;
2276
+ unmatchedStep: string;
2277
+ totalDuration: string;
2278
+ contextSummary: string;
2279
+ tokenUsage: string;
2280
+ modelRequestStarted: string;
2281
+ modelRequest: string;
2282
+ executionMetaModel: string;
2283
+ traceMessages: string;
2284
+ traceTools: string;
2285
+ thoughtChain: string;
2286
+ mainContent: string;
2287
+ toolCall: string;
2288
+ result: string;
2289
+ metadata: string;
2290
+ params: string;
2291
+ userInput: string;
2292
+ output: string;
2293
+ executionFinished: string;
2294
+ executionRunning: string;
2295
+ executionLabel: string;
2296
+ duration: string;
2297
+ inputCount: string;
2298
+ outputCount: string;
2299
+ turnsCount: string;
2300
+ toolsCount: string;
2301
+ eventsCount: string;
2302
+ userMessage: string;
2303
+ turnLabel: string;
2304
+ turnFallback: string;
2305
+ executionCountSorted: string;
2306
+ eventDetail: string;
2307
+ traceSelectHint: string;
2308
+ executionTraceEmpty: string;
2309
+ roleUser: string;
2310
+ roleAssistant: string;
2311
+ roleTool: string;
2312
+ roleSystem: string;
2112
2313
  noVariables: string;
2113
2314
  dateToday: string;
2114
2315
  dateLast7Days: string;
@@ -2179,8 +2380,14 @@ declare const chatCopilotZhCN: {
2179
2380
  readonly summaryAnalysis: "概要解读";
2180
2381
  readonly headerClose: "关闭";
2181
2382
  readonly deepThinking: "深度思考";
2383
+ readonly resource: "资源";
2182
2384
  readonly skill: "技能";
2183
2385
  readonly knowledge: "知识库";
2386
+ readonly datasource: "数据源";
2387
+ readonly mcpServer: "MCP Server";
2388
+ readonly subAgent: "子智能体";
2389
+ readonly tool: "工具";
2390
+ readonly loading: "加载中...";
2184
2391
  readonly supportedExtensions: "支持扩展名:{{types}}";
2185
2392
  readonly empty: "暂无数据";
2186
2393
  readonly selectFile: "选择文件";
@@ -2213,9 +2420,11 @@ declare const chatCopilotZhCN: {
2213
2420
  readonly nextStep: "下一步";
2214
2421
  readonly submit: "提交";
2215
2422
  readonly submitFailed: "提交失败,请稍后重试";
2216
- readonly questionCancelled: "Question: 已取消";
2217
- readonly questionAnswered: "Question: 已回答";
2218
- readonly questionDetails: "Question: {{details}}";
2423
+ readonly questionTitle: "问题";
2424
+ readonly questionSummary: "{{label}}:{{content}}";
2425
+ readonly questionCancelled: "已取消";
2426
+ readonly questionAnswered: "已回答";
2427
+ readonly questionDetails: "{{details}}";
2219
2428
  readonly basicInfoSubmitted: "已提交基础信息";
2220
2429
  readonly paramsSubmitted: "已提交参数配置";
2221
2430
  readonly backToBasic: "已返回修改基础信息";
@@ -2238,6 +2447,59 @@ declare const chatCopilotZhCN: {
2238
2447
  readonly previewEdit: "预览编辑";
2239
2448
  readonly copy: "复制";
2240
2449
  readonly continueText: "继续";
2450
+ readonly chatTab: "对话";
2451
+ readonly traceTab: "执行轨迹";
2452
+ readonly previewTab: "文件预览";
2453
+ readonly subAgentTab: "子智能体";
2454
+ readonly subAgentExecutionDetail: "子智能体执行详情";
2455
+ readonly closeSubAgentDetail: "关闭子智能体详情";
2456
+ readonly execItemRunning: "执行中";
2457
+ readonly execItemDone: "已执行";
2458
+ readonly execItemFailed: "执行失败";
2459
+ readonly execItemThinking: "思考过程";
2460
+ readonly execItemFile: "文件";
2461
+ readonly execItemPlan: "执行计划";
2462
+ readonly toolCallFallback: "工具调用";
2463
+ readonly viewExecutionDetail: "查看执行详情";
2464
+ readonly executionStart: "开始";
2465
+ readonly executionEnd: "结束";
2466
+ readonly unmatchedStep: "未匹配步骤";
2467
+ readonly totalDuration: "总耗时 {{value}}";
2468
+ readonly contextSummary: "上下文 {{messages}} 条消息 · {{tools}} 个工具 · {{model}}";
2469
+ readonly tokenUsage: "输入 {{input}} -> 输出 {{output}} tokens";
2470
+ readonly modelRequestStarted: "发起模型调用";
2471
+ readonly modelRequest: "模型请求";
2472
+ readonly executionMetaModel: "模型 {{model}} · 上下文窗口 {{contextWindow}}";
2473
+ readonly traceMessages: "消息({{count}})";
2474
+ readonly traceTools: "工具({{count}})";
2475
+ readonly thoughtChain: "思维链";
2476
+ readonly mainContent: "正文";
2477
+ readonly toolCall: "工具调用";
2478
+ readonly result: "结果";
2479
+ readonly metadata: "元数据";
2480
+ readonly params: "参数";
2481
+ readonly userInput: "用户输入";
2482
+ readonly output: "输出";
2483
+ readonly executionFinished: "执行完成";
2484
+ readonly executionRunning: "执行中";
2485
+ readonly executionLabel: "执行 #{{id}}";
2486
+ readonly duration: "耗时 {{value}}";
2487
+ readonly inputCount: "输入 {{count}}";
2488
+ readonly outputCount: "输出 {{count}}";
2489
+ readonly turnsCount: "{{count}} 轮";
2490
+ readonly toolsCount: "{{count}} 次工具";
2491
+ readonly eventsCount: "{{count}} 个事件";
2492
+ readonly userMessage: "用户消息";
2493
+ readonly turnLabel: "轮次 {{index}} · {{title}}";
2494
+ readonly turnFallback: "轮次 {{index}}";
2495
+ readonly executionCountSorted: "共 {{count}} 次执行 · 按时间正序";
2496
+ readonly eventDetail: "事件详情";
2497
+ readonly traceSelectHint: "点击左侧事件查看详情";
2498
+ readonly executionTraceEmpty: "暂无执行轨迹数据";
2499
+ readonly roleUser: "用户";
2500
+ readonly roleAssistant: "助手";
2501
+ readonly roleTool: "工具";
2502
+ readonly roleSystem: "系统";
2241
2503
  readonly noVariables: "暂无可用变量";
2242
2504
  readonly dateToday: "今天";
2243
2505
  readonly dateLast7Days: "最近 7 天";
@@ -2264,4 +2526,4 @@ declare const chatCopilotZhCN: {
2264
2526
  readonly startConversation: "开始会话";
2265
2527
  };
2266
2528
 
2267
- export { type AgentConfig, type AgentExecMode, type AgentInfo, type AgentSpec, _default$1 as Attachments, type AttachmentsProps, type ChatConfig, _default as ChatCopilot, type ChatHandle, type ChatHooks, type ChatLayout, type ChatParams, type ChatProps, _default$2 as ChatSender, type ChatServices, type ConversationMessage, type ConversationMessageSend, type ConversationStrategy, type CustomButtonProps, type FileTextType, type FileUploadConfig, type FileUrlType, type InputFile, type MessageRenderProps, NS_CHAT_COPILOT, type ReferencesType, type RequestInstance, type SenderProps, WorkspaceTypeEnum, chatCopilotEnUS, chatCopilotJaJP, chatCopilotZhCN, getFileIcon, getFileUrl };
2529
+ export { type AgentConfig, type AgentInfo, type AgentSpec, _default$1 as Attachments, type AttachmentsProps, type AvailableResourceType, type ChatConfig, _default as ChatCopilot, type ChatHandle, type ChatHooks, type ChatLayout, type ChatParams, type ChatProps, _default$2 as ChatSender, type ChatServices, type CommandConfig, type ConversationMessage, type ConversationMessageSend, type ConversationStrategy, type CustomButtonProps, type FileTextType, type FileUploadConfig, type FileUrlType, type HashCommandConfig, type InputFile, type MessageRenderProps, NS_CHAT_COPILOT, type ReferencesType, type RequestInstance, type ResourceBtnProps, type SenderProps, WorkspaceTypeEnum, chatCopilotEnUS, chatCopilotJaJP, chatCopilotZhCN, getFileIcon, getFileUrl };