Skip to content

Commit dd59be5

Browse files
authored
fix(playground): update prompt count (#69)
1 parent b9b94fd commit dd59be5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

playground/src/Chat.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ export function Chat() {
6262
},
6363
);
6464

65+
// 新增:处理输入变化的回调函数
66+
const handleInputChange = (value: string) => {
67+
setPrompt(value);
68+
};
69+
6570
const footer = useMemo(() => {
6671
const onClear = () => {
6772
setPrompt("");
@@ -104,6 +109,8 @@ export function Chat() {
104109
<Sender
105110
className="w-full"
106111
input={input}
112+
initialMessage={prompt} // 同步初始值
113+
onMessageChange={handleInputChange} // 同步变化
107114
toolbar={
108115
<div className="flex flex-row justify-between w-full">
109116
<InputCount count={prompt.length} limit={500} />

0 commit comments

Comments
 (0)