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(assistant-ui): redesign chat composer and thread layout
Steven Enamakelcb00860677fb
diff --git a/app/src/features/conversations/components/AssistantUiChat.tsx b/app/src/features/conversations/components/AssistantUiChat.tsxindex edc5aab990..d127a2eae7 100644--- a/app/src/features/conversations/components/AssistantUiChat.tsx+++ b/app/src/features/conversations/components/AssistantUiChat.tsx@@ -1,4 +1,5 @@import {+ AuiIf,AssistantRuntimeProvider,ComposerPrimitive,MessagePrimitive,@@ -16,6 +17,14 @@ import {*/const localChatModel = { run: async () => ({ content: [] }) };+function ArrowUpIcon() {+ return (+ <svg aria-hidden="true" className="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 19V5m0 0-6 6m6-6 6 6" />+ </svg>+ );+}+function UserMessage() {return (<MessagePrimitive.Root className="flex justify-end px-4 py-2 sm:px-6">@@ -38,6 +47,48 @@ function AssistantMessage() {);}+/** The Base example's composer structure, expressed with the app's tokens. */+function BaseComposer() {+ return (+ <ComposerPrimitive.Root className="relative flex w-full flex-col">+ <ComposerPrimitive.AttachmentDropzone asChild>+ <div className="flex w-full cursor-text flex-col gap-2 rounded-3xl border border-line bg-surface p-2 transition-colors focus-within:border-line-strong data-[dragging=true]:border-dashed data-[dragging=true]:bg-surface-hover">+ <ComposerPrimitive.Input+ rows={1}+ placeholder="Send a message..."+ className="max-h-48 min-h-10 w-full resize-none bg-transparent px-2.5 py-1 text-sm leading-6 text-content outline-none placeholder:text-content-faint"+ />+ <div className="relative flex items-center justify-between">+ <div />+ <div className="flex items-center gap-1.5">+ <AuiIf condition={state => !state.thread.isRunning}>+ <ComposerPrimitive.Send asChild>+ <button+ type="button"+ className="inline-flex size-7 items-center justify-center rounded-full bg-primary-500 text-content-inverted transition-colors hover:bg-primary-600 disabled:pointer-events-none disabled:opacity-40"+ aria-label="Send message">+ <ArrowUpIcon />+ </button>+ </ComposerPrimitive.Send>+ </AuiIf>+ <AuiIf condition={state => state.thread.isRunning}>+ <ComposerPrimitive.Cancel asChild>+ <button+ type="button"+ className="inline-flex size-7 items-center justify-center rounded-full bg-primary-500 text-content-inverted transition-colors hover:bg-primary-600"+ aria-label="Stop generating">+ <span className="size-3 rounded-sm bg-current" />+ </button>+ </ComposerPrimitive.Cancel>+ </AuiIf>+ </div>+ </div>+ </div>+ </ComposerPrimitive.AttachmentDropzone>+ </ComposerPrimitive.Root>+ );+}+/*** A standalone assistant-ui chat surface.*@@ -52,31 +103,29 @@ export function AssistantUiChat() {<AssistantRuntimeProvider runtime={runtime}><ThreadPrimitive.Rootdata-testid="assistant-ui-chat"- className="flex min-h-0 flex-1 flex-col bg-surface">- <ThreadPrimitive.Viewport className="min-h-0 flex-1 overflow-y-auto">+ className="flex h-full min-h-0 flex-1 flex-col bg-surface"+ style={{+ '--thread-max-width': '44rem',+ '--composer-radius': '1.5rem',+ '--composer-padding': '8px',+ }}>+ <ThreadPrimitive.Viewport+ turnAnchor="top"+ className="relative flex min-h-0 flex-1 flex-col overflow-x-auto overflow-y-scroll px-4 pt-4"><ThreadPrimitive.Empty>- <div className="flex h-full min-h-[16rem] flex-col items-center justify-center px-6 text-center">- <h1 className="text-lg font-semibold text-content">How can I help?</h1>- <p className="mt-1 text-sm text-content-muted">Start a new conversation below.</p>+ <div className="mx-auto mb-6 flex w-full max-w-[var(--thread-max-width)] flex-col items-center px-4 text-center">+ <h1 className="text-2xl font-medium tracking-tight text-content">How can I help you today?</h1></div></ThreadPrimitive.Empty>- <ThreadPrimitive.Messages components={{ UserMessage, AssistantMessage }} />- </ThreadPrimitive.Viewport>-- <div className="shrink-0 px-4 pb-4 pt-3 sm:px-6">- <ComposerPrimitive.Root className="flex w-full flex-col rounded-3xl border border-transparent bg-surface-muted/55 transition-colors focus-within:border-line focus-within:bg-surface-muted/75">- <ComposerPrimitive.Input- rows={1}- placeholder="Send a message..."- className="max-h-40 min-h-11 w-full resize-none bg-transparent px-3.5 pb-2 pt-3 text-sm leading-5 text-content outline-none placeholder:text-content-faint"- />- <div className="flex items-center justify-end px-2 pb-2">- <ComposerPrimitive.Send className="inline-flex h-8 items-center justify-center rounded-full bg-primary-500 px-3 text-xs font-medium text-content-inverted transition-colors hover:bg-primary-600 disabled:pointer-events-none disabled:opacity-40">- Send- </ComposerPrimitive.Send>+ <div className="mb-14 flex flex-col gap-y-6 empty:hidden">+ <ThreadPrimitive.Messages components={{ UserMessage, AssistantMessage }} />+ </div>+ <ThreadPrimitive.ViewportFooter className="sticky bottom-0 mt-auto flex w-full flex-col overflow-visible bg-surface pb-4 pt-3 md:pb-6">+ <div className="mx-auto w-full max-w-[var(--thread-max-width)]">+ <BaseComposer /></div>- </ComposerPrimitive.Root>- </div>+ </ThreadPrimitive.ViewportFooter>+ </ThreadPrimitive.Viewport></ThreadPrimitive.Root></AssistantRuntimeProvider>);