refactor Chatbox component layout and restore stop generating button

This commit is contained in:
2025-02-08 11:01:13 +08:00
parent c37a99f06d
commit ed5f561148

View File

@@ -602,21 +602,6 @@ export default function ChatBOX() {
<Tr>New Chat</Tr> <Tr>New Chat</Tr>
</Button> </Button>
)} )}
{showGenerating && (
<Button
size="sm"
className="ml-auto gap-1.5"
variant="destructive"
onClick={() => {
abortControllerRef.current.abort();
setShowGenerating(false);
setGeneratingMessage("");
}}
>
<Tr>Stop Generating</Tr>
<ScissorsIcon className="size-3.5" />
</Button>
)}
{chatStore.develop_mode && chatStore.history.length > 0 && ( {chatStore.develop_mode && chatStore.history.length > 0 && (
<Button <Button
variant="outline" variant="outline"
@@ -677,15 +662,32 @@ export default function ChatBOX() {
</div> </div>
<div className="sticky bottom-0 w-full z-20 bg-background"> <div className="sticky bottom-0 w-full z-20 bg-background">
{generatingMessage && ( {generatingMessage && (
<div className="flex items-center justify-end gap-2 p-2 m-2 rounded bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"> <div className="flex items-center justify-between gap-2 p-2 m-2 rounded bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
<label className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"> <div className="flex items-center gap-2">
Follow <label className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
</label> <Tr>Follow</Tr>
<Switch </label>
checked={follow} <Switch
onCheckedChange={setFollow} checked={follow}
aria-label="Toggle auto-scroll" onCheckedChange={setFollow}
/> aria-label="Toggle auto-scroll"
/>
</div>
<div className="flex items-center gap-2">
<Button
size="sm"
className="ml-auto gap-1.5"
variant="destructive"
onClick={() => {
abortControllerRef.current.abort();
setShowGenerating(false);
setGeneratingMessage("");
}}
>
<Tr>Stop Generating</Tr>
<ScissorsIcon className="size-3.5" />
</Button>
</div>
</div> </div>
)} )}
<form className="relative rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring p-1"> <form className="relative rounded-lg border bg-background focus-within:ring-1 focus-within:ring-ring p-1">