From 28ebcf2525c9d62095d2a1d281717009f5c3b7cc Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 14 Jul 2026 17:44:48 +0800 Subject: [PATCH] feat(chat): polish follow-up suggestion loading and answer toolbar timing Move follow-up loading into the answer toolbar so the card only appears when suggestions are ready, and delay toolbar actions until the typewriter finishes revealing the answer. --- .../chat/FollowUpSuggestions.test.ts | 25 +++++ .../components/chat/FollowUpSuggestions.vue | 96 +++++++++++-------- .../components/css/chat-message-shared.less | 69 +++++++++++++ frontend/src/i18n/embed.ts | 6 ++ frontend/src/i18n/locales/en-US.ts | 1 + frontend/src/i18n/locales/ko-KR.ts | 1 + frontend/src/i18n/locales/ru-RU.ts | 1 + frontend/src/i18n/locales/zh-CN.ts | 1 + .../chat/components/AgentStreamDisplay.vue | 11 ++- .../answerToolbarCompletion.test.mjs | 37 +++++++ frontend/src/views/chat/components/botmsg.vue | 24 ++++- frontend/src/views/chat/index.vue | 5 +- frontend/src/views/embed/EmbedChatCore.vue | 1 - 13 files changed, 232 insertions(+), 46 deletions(-) create mode 100644 frontend/src/components/chat/FollowUpSuggestions.test.ts create mode 100644 frontend/src/views/chat/components/answerToolbarCompletion.test.mjs diff --git a/frontend/src/components/chat/FollowUpSuggestions.test.ts b/frontend/src/components/chat/FollowUpSuggestions.test.ts new file mode 100644 index 00000000..6d694a7c --- /dev/null +++ b/frontend/src/components/chat/FollowUpSuggestions.test.ts @@ -0,0 +1,25 @@ +import assert from 'node:assert/strict' +import test from 'node:test' +import { readFileSync } from 'node:fs' + +const component = readFileSync(new URL('./FollowUpSuggestions.vue', import.meta.url), 'utf8') + +test('does not insert a separate status row while the first suggestions are loading', () => { + assert.match(component, //) + assert.match(component, /v-if="suggestionSet\?\.status === 'ready'"/) + assert.doesNotMatch(component, /follow-ups-loading/) + assert.doesNotMatch(component, /follow-ups__skeletons/) +}) + +test('keeps the existing follow-up card visible while regenerating', () => { + assert.match(component, /:disabled="loading"/) + assert.match(component, /loading \? 'loading' : 'refresh'/) + assert.match(component, /class="follow-ups__list"/) +}) + +test('carries the lightbulb into the expanding question card', () => { + assert.match(component, /class="follow-ups__title"/) + assert.match(component, /name="lightbulb"/) + assert.match(component, /\.follow-up-card-enter-from/) + assert.match(component, /clip-path: inset\(0 0 55%/) +}) diff --git a/frontend/src/components/chat/FollowUpSuggestions.vue b/frontend/src/components/chat/FollowUpSuggestions.vue index b1ea36fa..707f1a6e 100644 --- a/frontend/src/components/chat/FollowUpSuggestions.vue +++ b/frontend/src/components/chat/FollowUpSuggestions.vue @@ -1,28 +1,30 @@