Conversations管理对话
Conversations
管理对话
用于切换多个智能体,更新对话轮次,对话历史切换
使用import { Conversations } from "@ant-design/x"; |
文档 编辑此页... |
通用属性参考:通用属性
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| items | 会话列表数据源 | ItemType[] | - | - |
| activeKey | 当前选中的值 | string | - | - |
| defaultActiveKey | 初始化选中的值 | string | - | - |
| onActiveChange | 选中变更回调 | (value: string) => void | - | - |
| menu | 会话操作菜单 | ItemMenuProps| ((value: ConversationItemType) => ItemMenuProps) | - | - |
| groupable | 是否支持分组, 开启后默认按 Conversation.group 字段分组 | boolean | GroupableProps | - | - |
| shortcutKeys | 快捷键操作 | { creation?: ShortcutKeys<number>; items?:ShortcutKeys<'number'> | ShortcutKeys<number>[];} | - | - |
| creation | 新会话操作配置 | CreationProps | - | - |
| styles | 语义化结构 style | styles?: {creation?: React.CSSProperties;item?: React.CSSProperties;} | - | - |
| classNames | 语义化结构 className | classNames?: { creation?: string; item?:string;} | - | - |
| rootClassName | 根节点类名 | string | - | - |
type ItemType = ConversationItemType | DividerItemType;
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| key | 唯一标识 | string | - | - |
| label | 会话名称 | React.ReactNode | - | - |
| group | 会话分组类型,与 ConversationsProps.groupable 联动 | string | - | - |
| icon | 会话图标 | React.ReactNode | - | - |
| disabled | 是否禁用 | boolean | false | - |
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| type | 会话列表分割线 | 'divider' | 'divider' | - |
| dashed | 是否虚线 | boolean | false | - |
继承 antd MenuProps 属性。
MenuProps & {trigger?:| React.ReactNode| ((conversation: ConversationItemType,info: { originNode: React.ReactNode },) => React.ReactNode);getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;};
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| label | 分组标题 | React.ReactNode| ((group: string, info: { groupInfo: GroupInfoType}) => React.ReactNode) | - | - |
| collapsible | 可折叠配置 | boolean | ((group: string) => boolean) | - | - |
| defaultExpandedKeys | 默认展开或收起 | string[] | - | - |
| onExpand | 展开或收起 | (expandedKeys: string[]) => void | - | - |
| expandedKeys | 展开分组的 keys | string[] | - | - |
| Token 名称 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| creationBgColor | 新会话按钮背景颜色 | string | rgba(22,119,255,0.15) |
| creationBorderColor | 新会话按钮边框颜色 | string | rgba(22,119,255,0.22) |
| creationHoverColor | 新会话按钮悬浮态背景颜色 | string | rgba(22,119,255,0.25) |
| shortcutKeyTextColor | 快捷键标识字体颜色 | string | rgba(22,119,255,0.65) |