Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(assistant-ui): handle missing follow-up suggestions gracefully

Steven Enamakelf76a6d5ad0a8
diff --git a/app/src/components/assistant-ui/follow-up-suggestions.tsx b/app/src/components/assistant-ui/follow-up-suggestions.tsx
index 3746a11059..e89191f7df 100644
--- a/app/src/components/assistant-ui/follow-up-suggestions.tsx
+++ b/app/src/components/assistant-ui/follow-up-suggestions.tsx
@@ -1,5 +1,23 @@
'use client';
+/**
+ * assistant-ui's follow-up-suggestions element: a single scrollable row of
+ * chips under a settled turn, with edge fades once the row overflows. Each
+ * chip sends its prompt on click.
+ *
+ * Reads `s.thread.suggestions`, the same field as the welcome chips in
+ * `thread.tsx`. `useOpenHumanExternalStore` fills that field with the core's
+ * `chat_suggestions` set only after a settled turn, so the two never render
+ * together (see `useWelcomeSuggestions` there).
+ *
+ * Vendored from the assistant-ui `follow-up-suggestions` registry item
+ * (https://r.assistant-ui.com/styles/base-nova/follow-up-suggestions.json).
+ * Changes from upstream:
+ * - `window.getComputedStyle`, because the app's ESLint browser globals are
+ * hand-listed and a bare `getComputedStyle` fails `no-undef`.
+ *
+ * No user-facing strings: chip text is the suggestion's own `title`/`prompt`.
+ */
import { AuiIf, ThreadPrimitive, useAuiState } from '@assistant-ui/react';
import { type FC, useCallback, useEffect, useRef, useState } from 'react';
@@ -45,16 +63,15 @@ const FollowupSuggestionsRow: FC = () => {
ref={scrollRef}
onScroll={updateFades}
// overflow-x clips both axes; py-1/-my-1 gives focus rings vertical room without changing outer height.
- className="aui-thread-followup-suggestions -my-1 w-full overflow-x-auto py-1 [-ms-overflow-style:none] scrollbar-none [&::-webkit-scrollbar]:hidden"
+ className="aui-thread-followup-suggestions -my-1 w-full [scrollbar-width:none] overflow-x-auto py-1 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"
style={{ maskImage, WebkitMaskImage: maskImage }}>
<div className="mx-auto flex min-h-8 w-max items-center gap-2 px-0.5">
{suggestions.map((suggestion, idx) => (
<ThreadPrimitive.Suggestion
key={idx}
- className="aui-thread-followup-suggestion bg-background hover:bg-muted/80 rounded-full border px-3 py-1 text-sm whitespace-nowrap transition-colors ease-in"
+ className="aui-thread-followup-suggestion border-foreground/10 hover:bg-foreground/[0.03] hover:border-foreground/25 rounded-md border px-2.5 py-1 text-sm whitespace-nowrap transition-colors ease-in motion-reduce:transition-none"
prompt={suggestion.prompt}
- method="replace"
- autoSend>
+ send>
{suggestion.title ?? suggestion.prompt}
{suggestion.label && (
<span className="aui-thread-followup-suggestion-label text-muted-foreground ms-1">