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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user