feat(chat): enhance request info button integration and toolbar logic

- Added a conditional rendering for the `ChatRequestInfoButton` to prevent duplication in the toolbar when a completed answer with content is displayed.
- Introduced a new computed property, `hasDoneAnswerContent`, to track whether a completed answer is rendered, improving the user interface and experience in the chat component.
- Updated the toolbar logic to ensure it only displays the request info button when appropriate, enhancing clarity and usability for users.
This commit is contained in:
wizardchen
2026-06-03 16:40:41 +08:00
committed by lyingbug
parent aa4513d4f8
commit d2212221eb
@@ -253,6 +253,11 @@
<t-icon name="info-circle" />
</t-button>
</t-tooltip>
<ChatRequestInfoButton
v-if="showRequestInfo && isConversationDone"
:session="session"
:session-id="sessionId"
/>
</div>
</div>
@@ -330,7 +335,7 @@
</div>
</div>
</template>
<div v-if="showRequestInfo && isConversationDone" class="answer-toolbar">
<div v-if="showRequestInfo && isConversationDone && !hasDoneAnswerContent" class="answer-toolbar">
<ChatRequestInfoButton :session="session" :session-id="sessionId" />
</div>
<!-- Loading Indicator (inside container so it scrolls into view) -->
@@ -931,6 +936,16 @@ const isConversationDone = computed(() => {
return !!doneAnswer;
});
// Whether a completed answer with content is rendered (its toolbar hosts the
// request-info button inline, so the standalone toolbar should not duplicate it)
const hasDoneAnswerContent = computed(() => {
const stream = eventStream.value;
if (!stream || stream.length === 0) return false;
return stream.some(
(e: any) => e.type === 'answer' && e.done && e.content && e.content.trim()
);
});
// Find the final content to display (last thinking or answer)
const finalContent = computed(() => {
const stream = eventStream.value;