Skip to content

Commit

Permalink
fix: clear input
Browse files Browse the repository at this point in the history
  • Loading branch information
yutakobayashidev committed Oct 12, 2023
1 parent d190ac9 commit 10a6c7a
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions frontend/src/app/cmd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,21 @@ export default function CommandMenu({
const [isAIMode, setIsAIMode] = useState(false);
const [isComposing, setIsComposing] = useState(false);

const { append, data, input, isLoading, messages, setInput } = useChat({
api: "/api/chat",
onResponse: (response) => {
if (response.status === 429) {
toast.error("利用制限を超えました。時間を開けてお試しください。");
return;
}
},
});

useEffect(() => {
if (!open) {
setIsMemberSearchMode(false);
setIsAIMode(false);
setInput("");
}
}, [open]);

Expand Down Expand Up @@ -99,16 +110,6 @@ export default function CommandMenu({
};
}, []);

const { append, data, input, isLoading, messages, setInput } = useChat({
api: "/api/chat",
onResponse: (response) => {
if (response.status === 429) {
toast.error("利用制限を超えました。時間を開けてお試しください。");
return;
}
},
});

const disabled = isLoading || input.length === 0;

const id = nanoid();
Expand Down

1 comment on commit 10a6c7a

@vercel
Copy link

@vercel vercel bot commented on 10a6c7a Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.