From 877a503bad29673a2ceb51dc49eaaa79ee6bdcc8 Mon Sep 17 00:00:00 2001 From: "Bingxi Zhao (Frank)" <13051345080@163.com> Date: Sun, 16 Aug 2026 23:34:13 +0800 Subject: [PATCH] feat(home): show three starter chips under the composer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each chip renders its label and sends its prompt — the whole sentence the learner would have typed — so one click starts a real conversation instead of prefilling something they still have to finish. No handoff is involved: the home screen is already a draft session while it has no messages, so the chips go through the same send path as the composer, which both creates the session and starts it on the topic. The time-of-day greeting above the composer is untouched. Chips sit between the composer and the flex spacer, so they ride up with it on the empty screen and disappear the moment there is a first message. Generated text does NOT go through the i18n table — a generated label that happened to match a key would be silently replaced by an unrelated translation. Only the fixed starters are keys, and the component tracks which of the two it is holding. Nothing renders until the first response lands: chips appearing a beat late is calmer than fixed copy visibly swapping for generated copy. A failed read falls back to the fixed starters rather than an empty row, and a reroll that comes back empty keeps what is already on screen. --- .../home/[[...sessionId]]/page.tsx | 13 ++ .../chat/home/StarterSuggestions.tsx | 186 ++++++++++++++++++ web/locales/en/app.json | 7 + web/locales/zh/app.json | 7 + 4 files changed, 213 insertions(+) create mode 100644 web/components/chat/home/StarterSuggestions.tsx diff --git a/web/app/(workspace)/home/[[...sessionId]]/page.tsx b/web/app/(workspace)/home/[[...sessionId]]/page.tsx index c90df730c..7b51fb560 100644 --- a/web/app/(workspace)/home/[[...sessionId]]/page.tsx +++ b/web/app/(workspace)/home/[[...sessionId]]/page.tsx @@ -38,6 +38,7 @@ import type { ContextBudget } from "@/components/chat/home/ContextBudgetChip"; import { ChatMessageList } from "@/components/chat/home/ChatMessages"; import { TurnNavigator } from "@/components/chat/home/TurnNavigator"; import SessionLoadingView from "@/components/chat/home/SessionLoadingView"; +import StarterSuggestions from "@/components/chat/home/StarterSuggestions"; // Imported eagerly so the drawer shell is always mounted off-screen — // clicking a chip becomes a single CSS class flip, no chunk fetch + double // render. The heavy renderers inside still load lazily. @@ -2152,6 +2153,18 @@ export default function ChatPage() { onCancelStreaming={cancelStreamingTurn} prefillInputRef={prefillInputRef} /> + {/* Starter chips sit between the composer and the spacer, so they + ride up with the composer on the empty screen and disappear the + moment the conversation has a first message. Clicking one sends + it through the normal send path: this page is already a draft + session when it has no messages, so that both creates the + session and starts it on the topic. */} + {!hasMessages ? ( + void handleSend(prompt)} + disabled={state.isStreaming} + /> + ) : null}