fix: feedback 500错误和多余气泡
This commit is contained in:
1 parent
7bc6a8072b
commit
8336bc9480
4 files changed
+54
-25
No files matched your search
@@ -338,6 +338,24 @@ const shouldRenderMessage = (msg: any): boolean => {
|
||||
return Array.isArray(msg?.attribution_parts) && msg.attribution_parts.length > 0;
|
||||
};
|
||||
|
||||
// “正在生成回答...” 仅在当前轮次还没有任何可显示的 assistant 内容时显示。
|
||||
// 一旦最后一条用户消息之后出现了可渲染的 assistant 内容(思考或答案文本等),
|
||||
// 该 loading 气泡就会隐藏,避免与正文同时出现。
|
||||
const shouldShowThinkingBubble = computed(() => {
|
||||
if (!isThinking.value) return false;
|
||||
let lastUserIndex = -1;
|
||||
for (let i = messages.value.length - 1; i >= 0; i--) {
|
||||
if (messages.value[i]?.role === 'user') {
|
||||
lastUserIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lastUserIndex < 0) return true;
|
||||
return !messages.value
|
||||
.slice(lastUserIndex + 1)
|
||||
.some((msg) => msg?.role === 'assistant' && shouldRenderMessage(msg));
|
||||
});
|
||||
|
||||
const filePreviewVisible = ref(false);
|
||||
const previewFile = ref<SourceFileLink | null>(null);
|
||||
|
||||
@@ -808,7 +826,7 @@ const submitFeedback = async () => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="isThinking" class="mx-auto flex max-w-5xl gap-4">
|
||||
<div v-if="shouldShowThinkingBubble" class="mx-auto flex max-w-5xl gap-4">
|
||||
<div class="mt-1 flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 shadow-md shadow-cyan-500/30">
|
||||
<Bot class="h-5 w-5 text-white" />
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user