From 8c09f7e9e1a95a1ae681c7ad104b7f56f4379d11 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Thu, 3 Dec 2026 18:32:03 +0800 Subject: [PATCH] feat: Optimize the loading style of the conversation --- ui/src/components/COMPONENT_README.md | 3 +++ .../items/group-tool/components/ToolItem.vue | 5 +++- .../content/items/group-tool/index.vue | 7 ++++-- .../components/content/items/group/index.vue | 4 +++- .../components/content/items/reasoning.vue | 8 +++---- .../components/content/items/tool/index.vue | 5 +++- .../components/content/items/tool/tool.vue | 5 +++- .../components/message-list/index.ts | 24 ++++++++++++++++++- .../components/message-list/index.vue | 7 +++--- .../message-list/share/ShareMessageRow.vue | 5 +++- .../workflow/tool/debug/ResultDrawer.vue | 4 +++- .../ai-generate/panel/AiGeneratePanel.vue | 3 +++ 12 files changed, 64 insertions(+), 16 deletions(-) diff --git a/ui/src/components/COMPONENT_README.md b/ui/src/components/COMPONENT_README.md index 79ce6c882fd..1cab5cf1501 100644 --- a/ui/src/components/COMPONENT_README.md +++ b/ui/src/components/COMPONENT_README.md @@ -1102,6 +1102,9 @@ Store 经 `setShared` 开关。所有分享入口调用 `enterShare(recordIds?)` 由消息列表 Store 的 `messageRecordIds` 维护(提问取紧随其后那条回答的记录 ID),与是否提供分享 Store 无关; `ShareMessageRow` 通过 `message-list/index.ts` 的 `MESSAGE_RECORD_ID_KEY` 逐行提供给消息内容,内容项以 `useMessageRecordId()` 读取,用于分享预先勾选和编辑提问。 +同一行还经 `MESSAGE_STREAMING_KEY` 提供该消息是否为 Store 的 `streamingMessage`(正在流式输出的回答), +工具、分组和思考内容以 `useMessageStreaming()` 读取,仅在所属回答输出期间显示运行中;未提供时为 `false`,日志、分析、分享等只读视图不显示。 +工具调试结果抽屉与工作流 AI 生成面板按自身执行状态提供该值。 Chat、Portal 视图创建并 provide `SHARE_LINK_KEY`,组件通过 `useShareLinkStoreOptional()` 获取,未提供时不进入选择态。 `ShareMessageRow` 通过插槽承载消息,`ShareFooter` 展示全选、数量、取消与创建链接并在卸载时退出分享态; 两者只绑定 Store 状态与方法,不维护逻辑。`message-list/index.vue` 只组合组件并传入 Store 提供的记录 ID。 diff --git a/ui/src/conversation-panel/components/content/items/group-tool/components/ToolItem.vue b/ui/src/conversation-panel/components/content/items/group-tool/components/ToolItem.vue index 01954cb8134..395c4828738 100644 --- a/ui/src/conversation-panel/components/content/items/group-tool/components/ToolItem.vue +++ b/ui/src/conversation-panel/components/content/items/group-tool/components/ToolItem.vue @@ -3,6 +3,7 @@ import { computed, ref } from 'vue' import { useI18n } from 'vue-i18n' import type { ChatContent, Dict } from '@/api/types' import ConversationLoading from '@/conversation-panel/components/loading/index.vue' +import { useMessageStreaming } from '../../../../message-list' const { t } = useI18n({ useScope: 'global' }) @@ -12,7 +13,9 @@ const props = defineProps<{ toolItem: ChatContent }>() // 分组内默认工具独立展开,初始收起。 const isExpanded = ref(false) -const loading = computed(() => props.toolItem.status === 'RUNNING') +const streaming = useMessageStreaming() +// 所属回答结束后不再显示运行中,避免状态未回写时一直转圈 +const loading = computed(() => streaming.value && props.toolItem.status === 'RUNNING') const toolTitle = computed(() => props.toolItem.name || t('tool.title')) const statusText = computed(() => { diff --git a/ui/src/conversation-panel/components/content/items/group-tool/index.vue b/ui/src/conversation-panel/components/content/items/group-tool/index.vue index 1867c5d3065..a1041a9d9ac 100644 --- a/ui/src/conversation-panel/components/content/items/group-tool/index.vue +++ b/ui/src/conversation-panel/components/content/items/group-tool/index.vue @@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n' import type { ChatContent, Dict } from '@/api/types' import type { Component } from 'vue' import ConversationLoading from '@/conversation-panel/components/loading/index.vue' +import { useMessageStreaming } from '../../../message-list' import CreateFile from '../tool/CreateFile.vue' import DownloadSkills from '../tool/DownloadSkills.vue' import Glob from '../tool/Glob.vue' @@ -60,9 +61,11 @@ function toggleTool(toolItem: ChatContent, index: number) { } // 汇总执行状态;分组默认收起,手动切换后以手动为准。 +const streaming = useMessageStreaming() const groupStatus = computed(() => { const childStatuses = toolItems.value.map((toolItem) => toolItem.status) - if (childStatuses.includes('RUNNING')) return 'running' + // 所属回答结束后不再显示运行中,避免状态未回写时一直转圈 + if (streaming.value && childStatuses.includes('RUNNING')) return 'running' if (childStatuses.some((childStatus) => childStatus === 'FAIL' || childStatus === 'FAILURE')) return 'error' return childStatuses.length ? 'success' : '' }) @@ -103,7 +106,7 @@ const isExpanded = ref(false) () +const streaming = useMessageStreaming() const { t } = useI18n({ useScope: 'global' }) const childContents = computed(() => props.content.children ?? []) @@ -81,7 +83,7 @@ useBottomFollow(useTemplateRef('groupScrollRef')) />