Replies: 5 comments 5 replies
-
|
另外有个初步想法: interface SenderContentNode {
type: 'text' | 'slot';
content: ReactNode ;
}
const initialValue: SenderContentNode[] = [
{ type: 'text', text: '我想去' },
{
type: 'slot',
content: <Select
placeholder="请选择目的地"
options={['北京', '上海', '广州']}
onChange=
/>,
},
]; |
Beta Was this translation helpful? Give feedback.
3 replies
-
不要通过 ref 来设置值
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
-
|
这个功能目前有成型的版本吗? |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
话说,如何把一个带有词槽的模板文本存到DB去呢🤔 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
为 Sender 组件引入结构化词槽能力(Slotting),以支持更灵活的输入场景(如参数化、变量填充、结构化输入等),提升 AI 对话、表单等场景的可用性和扩展性。词槽能力允许用户在输入内容中插入可编辑/可选择的 slot,实现内容的结构化与参数化。
#552
Motivation
Detailed Design
1. 词槽类型与数据结构
1.1 支持的 Slot 类型
1.2 SlotConfigType 结构定义
1.3 词槽插入与解析流程
slotConfig属性传递词槽配置数组2. 组件 API 设计
2.1 Sender Props
2.2 Sender Ref 方法
2.3 事件与回调
3. 交互与行为说明
3.1 词槽渲染与编辑
slotConfig配置词槽结构5. 示例与用法
5.1 基础用法
5.2 复杂示例
6. 未来展望与扩展点
实现细节
7.1 渲染机制
contenteditable="false"防止直接编辑data-slot-key属性标识不同的 slot7.2 状态管理
useGetStateHook 管理 slot 值的状态7.3 事件处理
7.4 DOM 操作
7.5 数据转换
12 votes ·
Beta Was this translation helpful? Give feedback.
All reactions