);
};
type SuggestionGroup = {
label: string;
icon: ReactNode;
options: { label: string; prompt: string }[];
};
const SUGGESTION_GROUPS: SuggestionGroup[] = [
{
label: "Weather",
icon: ,
options: [
{
label: "in San Francisco",
prompt: "What's the weather in San Francisco?",
},
{ label: "in Singapore", prompt: "What's the weather in Singapore?" },
{ label: "in Tokyo", prompt: "What's the weather in Tokyo?" },
{ label: "in London", prompt: "What's the weather in London?" },
],
},
{
label: "Code",
icon: ,
options: [
{
label: "explain React hooks",
prompt: "Explain React hooks like useState and useEffect",
},
{
label: "write a debounce function",
prompt: "Write a debounce function in TypeScript",
},
{
label: "review a useEffect cleanup",
prompt: "Show me the right way to clean up a subscription in useEffect",
},
],
},
{
label: "Write",
icon: ,
options: [
{
label: "a birthday card message",
prompt:
"Help me write a birthday card message for a friend in the notepad",
},
{
label: "a product announcement",
prompt: "Draft a short product announcement for a new dark mode",
},
{
label: "release notes",
prompt:
"Write release notes for a bugfix release of a React component library",
},
{
label: "a PR description",
prompt:
"Write a pull request description for a change that adds keyboard shortcuts",
},
],
},
{
label: "Analyze",
icon: ,
options: [
{
label: "React vs Vue vs Svelte",
prompt: "Compare React, Vue, and Svelte in a table",
},
{
label: "GDP of US, China, Japan",
prompt:
"Compare the GDP of the United States, China, and Japan in a table",
},
{
label: "pros and cons of SSR",
prompt: "What are the pros and cons of server-side rendering?",
},
],
},
{
label: "Brainstorm",
icon: ,
options: [
{
label: "side project ideas",
prompt: "Brainstorm five side project ideas for a React developer",
},
{
label: "names for a dev tool",
prompt: "Brainstorm names for a developer tools startup",
},
{
label: "talk topics",
prompt: "Brainstorm talk topics for a React meetup",
},
],
},
];
const suggestionChipClass =
"aui-thread-welcome-suggestion text-foreground hover:bg-muted border-border/60 h-auto gap-1.5 rounded-full border px-3.5 py-1.5 text-sm font-normal whitespace-nowrap transition-colors [&_svg]:size-4";
const ThreadSuggestions: FC = () => {
const aui = useAui();
const [expandedLabel, setExpandedLabel] = useState(null);
const expandedGroup = SUGGESTION_GROUPS.find(
(group) => group.label === expandedLabel,
);
const sendPrompt = (prompt: string) => {
if (aui.thread().getState().isRunning) return;
aui.thread().append({
content: [{ type: "text", text: prompt }],
runConfig: aui.composer().getState().runConfig,
});
};
return (