diff --git a/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx b/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx index 387b7de6c3..d1538d313d 100644 --- a/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx +++ b/client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx @@ -1,7 +1,7 @@ import { useId, useMemo, useState } from 'react'; import { ChevronDown } from 'lucide-react'; import { Tools } from 'librechat-data-provider'; -import { disclosureChevronVariants } from '@librechat/client'; +import { Button, disclosureChevronVariants } from '@librechat/client'; import type { MemoryArtifact, TAttachment } from 'librechat-data-provider'; import { toolPanelSpacingClassName } from './disclosure'; import { useExpandCollapse, useLocalize } from '~/hooks'; @@ -61,12 +61,12 @@ export default function MemoryArtifacts({ attachments }: { attachments?: TAttach return ( <>
- +
- + {hasDetails && ( {/* Composed through `asChild` so the shared Button owns the diff --git a/client/src/hooks/Input/useAskAnswerMode.ts b/client/src/hooks/Input/useAskAnswerMode.ts index a090aa8402..fe7cb6c01c 100644 --- a/client/src/hooks/Input/useAskAnswerMode.ts +++ b/client/src/hooks/Input/useAskAnswerMode.ts @@ -212,6 +212,14 @@ export default function useAskAnswerMode(conversationId?: string | null) { * drafts are disabled, perform that handoff directly. */ if (!batchMode && !saveDrafts) { formContext?.setValue('text', answerText); + } else if (!batchMode && answerText) { + /** Drafts were re-enabled after this answer was captured with saving + * off, so no ask draft exists for autosave to restore: the composer + * would open empty and the next collapse would read that empty + * value back over the in-memory answer. Seed it so the handoff has + * something to read. The in-memory value is authoritative because + * `setAnswerText` writes both while saving is on. */ + setDraft({ id: getAskAnswerDraftId(liveAsk.actionId), value: answerText }); } setCollapsedIds((prev) => prev.filter((id) => id !== liveAsk.actionId)); });