fix: 移除 Timeline 合成处理状态

- 仅依据真实思考、工具和状态事件展示处理过程

- 更新快速工具调用状态测试
This commit is contained in:
2026-08-20 11:24:41 +08:00
parent 9078ca163e
commit 407b85c8a9
2 changed files with 5 additions and 43 deletions

View File

@@ -5,7 +5,6 @@ import type {
ChatImageLoader, ChatImageLoader,
ChatTimelineItem, ChatTimelineItem,
ChatTimelineMessageItem, ChatTimelineMessageItem,
ChatTimelineStatusItem,
ChatTimelineToolApprovalPayload, ChatTimelineToolApprovalPayload,
} from './types'; } from './types';
@@ -138,38 +137,6 @@ const hasPendingApproval = computed(() =>
(item.status === 'approving' || item.status === 'pending_approval'), (item.status === 'approving' || item.status === 'pending_approval'),
), ),
); );
const hasActiveProcessIndicator = computed(() =>
props.items.some((item) => {
if (item.type === 'tool') {
return ['approving', 'pending_approval', 'running'].includes(item.status);
}
if (item.type === 'status') {
return item.status === 'running';
}
return (
item.type === 'message' &&
item.parts.some(
(part) => part.type === 'thinking' && part.status === 'thinking',
)
);
}),
);
const continuingStatus = computed<ChatTimelineStatusItem | undefined>(() => {
if (!turnActive.value || hasActiveProcessIndicator.value) {
return undefined;
}
return {
id: `chat-turn-continuing-${props.roundId}`,
icon: 'none',
label: '正在继续处理',
presentation: 'inline',
roundId: props.roundId,
status: 'running',
statusKey: `chat-turn-continuing:${props.roundId}`,
turnStartedAt: turnStartedAt.value,
type: 'status',
};
});
const canCollapse = computed( const canCollapse = computed(
() => () =>
turnSucceeded.value && turnSucceeded.value &&
@@ -327,7 +294,7 @@ function handleNestedLayoutToggle() {
@after-leave="emit('layoutChanged')" @after-leave="emit('layoutChanged')"
> >
<div <div
v-if="expanded && (processItems.length > 0 || continuingStatus)" v-if="expanded && processItems.length > 0"
:id="processId" :id="processId"
class="chat-timeline-turn__process" class="chat-timeline-turn__process"
> >
@@ -362,10 +329,6 @@ function handleNestedLayoutToggle() {
@thinking-toggle="handleNestedLayoutToggle" @thinking-toggle="handleNestedLayoutToggle"
/> />
</template> </template>
<ChatTimelineItemView
v-if="continuingStatus"
:item="continuingStatus"
/>
</div> </div>
</Transition> </Transition>

View File

@@ -96,10 +96,10 @@ describe('chat timeline turn', () => {
expect( expect(
wrapper.findAll('.chat-timeline-item__assistant-avatar'), wrapper.findAll('.chat-timeline-item__assistant-avatar'),
).toHaveLength(0); ).toHaveLength(0);
expect(wrapper.text()).toContain('正在继续处理'); expect(wrapper.text()).not.toContain('正在继续处理');
}); });
it('keeps continuous feedback around a fast automatic tool call', async () => { it('shows the running and completed states of an automatic tool call', async () => {
const assistant: ChatTimelineItem = { const assistant: ChatTimelineItem = {
id: 'assistant-fast-tool', id: 'assistant-fast-tool',
parts: [ parts: [
@@ -132,19 +132,18 @@ describe('chat timeline turn', () => {
}, },
}); });
expect(wrapper.text()).toContain('正在继续处理'); expect(wrapper.text()).not.toContain('调用中');
await wrapper.setProps({ items: [assistant, runningTool] }); await wrapper.setProps({ items: [assistant, runningTool] });
expect(wrapper.text()).toContain('调用中'); expect(wrapper.text()).toContain('调用中');
expect(wrapper.text()).not.toContain('正在继续处理');
await wrapper.setProps({ await wrapper.setProps({
items: [assistant, { ...runningTool, status: 'success' }], items: [assistant, { ...runningTool, status: 'success' }],
}); });
expect(wrapper.text()).toContain('已完成'); expect(wrapper.text()).toContain('已完成');
expect(wrapper.text()).toContain('正在继续处理'); expect(wrapper.text()).not.toContain('正在继续处理');
}); });
it('updates the running duration every second and freezes it on success', async () => { it('updates the running duration every second and freezes it on success', async () => {