We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9b94fd commit dd59be5Copy full SHA for dd59be5
playground/src/Chat.tsx
@@ -62,6 +62,11 @@ export function Chat() {
62
},
63
);
64
65
+ // 新增:处理输入变化的回调函数
66
+ const handleInputChange = (value: string) => {
67
+ setPrompt(value);
68
+ };
69
+
70
const footer = useMemo(() => {
71
const onClear = () => {
72
setPrompt("");
@@ -104,6 +109,8 @@ export function Chat() {
104
109
<Sender
105
110
className="w-full"
106
111
input={input}
112
+ initialMessage={prompt} // 同步初始值
113
+ onMessageChange={handleInputChange} // 同步变化
107
114
toolbar={
108
115
<div className="flex flex-row justify-between w-full">
116
<InputCount count={prompt.length} limit={500} />
0 commit comments