mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
🛠️ fix: Improve SSE Handling and Fix Typo in sendEmail Template (#1245)
* fix: typo for passwordReset.handlebars * fix(useSSE): prevent unnecessary JSON.parse abort error, handle immediate abort-submit gracefully by reverting to previous state before immediate abort-submit, add showStopButton state to explicitly render disabled sendButton when message generation is cancelled, filter undefined messages and replace undefined convo for cancelHandler
This commit is contained in:
parent
e13b146d6d
commit
166a4fa44f
6 changed files with 33 additions and 17 deletions
|
|
@ -19,6 +19,8 @@ export default function ChatForm({ index = 0 }) {
|
|||
handleStopGenerating,
|
||||
filesLoading,
|
||||
setFilesLoading,
|
||||
showStopButton,
|
||||
setShowStopButton,
|
||||
} = useChatContext();
|
||||
|
||||
const submitMessage = () => {
|
||||
|
|
@ -46,10 +48,10 @@ export default function ChatForm({ index = 0 }) {
|
|||
endpoint={conversation?.endpoint}
|
||||
/>
|
||||
<AttachFile endpoint={conversation?.endpoint ?? ''} />
|
||||
{isSubmitting ? (
|
||||
<StopButton stop={handleStopGenerating} />
|
||||
{isSubmitting && showStopButton ? (
|
||||
<StopButton stop={handleStopGenerating} setShowStopButton={setShowStopButton} />
|
||||
) : (
|
||||
<SendButton text={text} disabled={filesLoading} />
|
||||
<SendButton text={text} disabled={filesLoading || isSubmitting} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export default function StopButton({ stop }) {
|
||||
export default function StopButton({ stop, setShowStopButton }) {
|
||||
return (
|
||||
<div className="absolute bottom-0 right-2 top-0 p-1 md:right-3 md:p-2">
|
||||
<div className="flex h-full">
|
||||
|
|
@ -7,7 +7,10 @@ export default function StopButton({ stop }) {
|
|||
type="button"
|
||||
className="border-gizmo-gray-950 rounded-full border-2 p-1 dark:border-gray-200"
|
||||
aria-label="Stop generating"
|
||||
onClick={stop}
|
||||
onClick={(e) => {
|
||||
setShowStopButton(false);
|
||||
stop(e);
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue