The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(conversations): persist thread drafts across navigation
Steven Enamakel154da0dd274a
diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsxindex f7a4661c13..29c60d5762 100644--- a/app/src/components/assistant-ui/thread.tsx+++ b/app/src/components/assistant-ui/thread.tsx@@ -12,7 +12,6 @@ import { EditMessage } from '@/components/assistant-ui/elements/edit-message';import { ErrorState } from '@/components/assistant-ui/elements/error-state';import { Image } from '@/components/assistant-ui/elements/image';import { MessageTiming } from '@/components/assistant-ui/elements/message-timing.aui';-import { fullTimestamp, relativeTime } from '@/utils/relativeTime';import { StoppedRun } from '@/components/assistant-ui/elements/stopped-run';import { ToolFallback } from '@/components/assistant-ui/elements/tool-fallback';import { File } from '@/components/assistant-ui/file';@@ -34,6 +33,7 @@ import {import { useT } from '@/lib/i18n/I18nContext';import { useAuiThreadId } from '@/providers/AssistantUiRuntimeProvider';import { CHAT_ERROR_METADATA_KEY } from '@/store/threadSlice';+import { fullTimestamp, relativeTime } from '@/utils/relativeTime';import { useActionBarReload, useMessageError } from '@assistant-ui/core/react';import {ActionBarMorePrimitive,diff --git a/app/src/features/conversations/components/AssistantUiChat.tsx b/app/src/features/conversations/components/AssistantUiChat.tsxindex 76718a0b59..c7d3850ad6 100644--- a/app/src/features/conversations/components/AssistantUiChat.tsx+++ b/app/src/features/conversations/components/AssistantUiChat.tsx@@ -11,11 +11,11 @@ import type { Attachment } from '../../../lib/attachments';import { useT } from '../../../lib/i18n/I18nContext';import { AssistantUiRuntimeProvider } from '../../../providers/AssistantUiRuntimeProvider';import { useAppSelector } from '../../../store/hooks';-import { InterruptedTurnNotice } from '../aui/InterruptedTurnNotice';import { AgentRunningStatus } from '../aui/AgentRunningStatus';import { ChatConversationMap } from '../aui/ChatConversationMap';import { ComposerTriggers } from '../aui/ComposerTriggers';import { ContextUsage } from '../aui/ContextUsage';+import { InterruptedTurnNotice } from '../aui/InterruptedTurnNotice';import { ChatSources } from './aui/ChatSources';import { ChatToolFallback } from './ChatToolParts';diff --git a/app/src/features/conversations/hooks/useThreadDraft.ts b/app/src/features/conversations/hooks/useThreadDraft.tsindex dc872ca01e..909e198e2f 100644--- a/app/src/features/conversations/hooks/useThreadDraft.ts+++ b/app/src/features/conversations/hooks/useThreadDraft.ts@@ -82,19 +82,16 @@ export function useThreadDraft(useEffect(() => flush, [flush]);- const setDraft = useCallback(- (action: SetStateAction<string>) => {- const current = threadIdRef.current;- setState(prev => {- const base = prev.threadId === current ? prev.text : '';- const text = typeof action === 'function' ? action(base) : action;- return text === base && prev.threadId === current- ? prev- : { threadId: current, text, edited: true };- });- },- []- );+ const setDraft = useCallback((action: SetStateAction<string>) => {+ const current = threadIdRef.current;+ setState(prev => {+ const base = prev.threadId === current ? prev.text : '';+ const text = typeof action === 'function' ? action(base) : action;+ return text === base && prev.threadId === current+ ? prev+ : { threadId: current, text, edited: true };+ });+ }, []);// Schedule the write for whatever the draft became.useEffect(() => {