@vegintech/langchain-react-agent 0.0.17 → 0.0.18

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.mts CHANGED
@@ -1,41 +1,17 @@
1
1
  import * as react from "react";
2
- import React$1, { CSSProperties, ReactNode } from "react";
2
+ import React$1, { ReactNode } from "react";
3
+ import { ThoughtChainItemProps } from "@ant-design/x";
3
4
  import { Components } from "streamdown";
4
5
  import { BaseNode, InsertPosition, NodeRender, SenderProps, SkillType, SlotConfigType } from "@ant-design/x/es/sender/interface.ts";
5
6
  import { Message } from "@langchain/langgraph-sdk";
6
7
 
7
8
  //#region src/types.d.ts
8
- /** ToolCard 各部件的样式配置 */
9
- interface ToolCardStyles {
10
- /** icon 容器的样式 */
11
- icon?: CSSProperties;
12
- /** prefix 文本的样式 */
13
- prefix?: CSSProperties;
14
- /** content 文本的样式 */
15
- content?: CSSProperties;
16
- }
17
9
  /** ToolCard 组件 Props */
18
- interface ToolCardProps {
19
- /**
20
- * 前缀文本(中文,使用小字体)
21
- */
22
- prefix: string;
23
- /**
24
- * 正文内容(英文/文件名,保持默认大小)
25
- */
26
- content?: string;
27
- /**
28
- * 左侧图标
29
- */
30
- icon: ReactNode;
31
- /**
32
- * 根节点样式
33
- */
34
- style?: CSSProperties;
10
+ interface ToolCardProps extends Omit<ThoughtChainItemProps, "children"> {
35
11
  /**
36
- * 各部件的样式配置,可分别设置 icon、prefix、content 的样式
12
+ * 子组件,会作为 ThoughtChain.Item 的内容
37
13
  */
38
- styles?: ToolCardStyles;
14
+ children?: ReactNode;
39
15
  }
40
16
  /** Interrupt 事件数据结构 */
41
17
  interface InterruptEvent {
@@ -321,4 +297,4 @@ interface MessageContentRendererProps {
321
297
  /** 消息内容渲染组件 - 支持字符串和多模态内容块 */
322
298
  declare const MessageContentRenderer: React$1.FC<MessageContentRendererProps>;
323
299
  //#endregion
324
- export { AgentChat, type AgentChatInputRef, type AgentChatProps, type AgentChatRef, type BackendTool, type ChatMessage, type ContextItem, type EmptyStateConfig, type FrontendTool, type InputConfig, type InterruptConfig, type InterruptEvent, type InterruptManagerProps, type InterruptRenderProps, type MessageConfig, type MessageContent, type MessageContentBlock, MessageContentRenderer, type MessageContentRendererProps, type MessageType, type SenderCustomizationProps, type SenderSlotConfig, type SenderSubmitParams, type ToolCallInput, ToolCard, type ToolCardProps, type ToolCardStyles, type ToolDefinition, type ToolExecutionRecord, type ToolExecutionStatus, type ToolParameterSchema, type ToolRenderProps };
300
+ export { AgentChat, type AgentChatInputRef, type AgentChatProps, type AgentChatRef, type BackendTool, type ChatMessage, type ContextItem, type EmptyStateConfig, type FrontendTool, type InputConfig, type InterruptConfig, type InterruptEvent, type InterruptManagerProps, type InterruptRenderProps, type MessageConfig, type MessageContent, type MessageContentBlock, MessageContentRenderer, type MessageContentRendererProps, type MessageType, type SenderCustomizationProps, type SenderSlotConfig, type SenderSubmitParams, type ToolCallInput, ToolCard, type ToolCardProps, type ToolDefinition, type ToolExecutionRecord, type ToolExecutionStatus, type ToolParameterSchema, type ToolRenderProps };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
2
- import { Actions, Bubble, Sender, Think } from "@ant-design/x";
2
+ import { Actions, Bubble, Sender, Think, ThoughtChain } from "@ant-design/x";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Streamdown } from "streamdown";
5
5
  import { useStream } from "@langchain/langgraph-sdk/react";
@@ -1517,41 +1517,15 @@ AgentChat.displayName = "AgentChat";
1517
1517
  * ToolCard 组件 - 用于展示工具调用结果
1518
1518
  * 样式:圆角矩形框,左侧 icon,label 分两行显示(prefix 小字体,content 默认字体)
1519
1519
  */
1520
- const ToolCard = ({ prefix, content, icon, style, styles }) => {
1521
- return /* @__PURE__ */ jsxs("div", {
1520
+ const ToolCard = ({ children, style, ...rest }) => {
1521
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(ThoughtChain.Item, {
1522
+ variant: "text",
1523
+ ...rest,
1522
1524
  style: {
1523
- display: "inline-flex",
1524
- alignItems: "center",
1525
- gap: 8,
1526
- borderRadius: 8,
1527
- fontSize: 13,
1525
+ paddingLeft: 0,
1528
1526
  ...style
1529
- },
1530
- children: [/* @__PURE__ */ jsx("span", {
1531
- style: {
1532
- display: "flex",
1533
- alignItems: "center",
1534
- ...styles?.icon
1535
- },
1536
- children: icon
1537
- }), /* @__PURE__ */ jsxs("span", {
1538
- style: {
1539
- display: "flex",
1540
- alignItems: "center",
1541
- gap: 4
1542
- },
1543
- children: [/* @__PURE__ */ jsx("span", {
1544
- style: {
1545
- fontSize: 12,
1546
- ...styles?.prefix
1547
- },
1548
- children: prefix
1549
- }), /* @__PURE__ */ jsx("span", {
1550
- style: { ...styles?.content },
1551
- children: content
1552
- })]
1553
- })]
1554
- });
1527
+ }
1528
+ }), children] });
1555
1529
  };
1556
1530
  //#endregion
1557
1531
  export { AgentChat, MessageContentRenderer, ToolCard };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegintech/langchain-react-agent",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "LangChain Agent UI component library for React",
5
5
  "license": "MIT",
6
6
  "files": [