fix(chat): place agent activity before response
Build / build (push) Canceled after 0s
Playwright / e2e (push) Canceled after 0s

This commit is contained in:
2026-11-05 12:27:22 +08:00
parent 7ee844cd88
commit 43eda89d47
7 changed files with 84 additions and 42 deletions
+2 -2
View File
@@ -8,8 +8,8 @@ describe('groupRunMessages', () => {
it('groups text across tool calls and marks completion only when the run ends', () => {
const input = [message('u', 'user', 'question'), message('a', 'assistant', 'first'), message('t', 'tool'), message('b', 'assistant', 'second')]
const active = groupRunMessages(input, true)
expect(active.map(m => m.role)).toEqual(['user', 'assistant', 'system'])
expect(active[2]).toMatchObject({ systemType: 'tool-group', toolMessages: [input[2]] })
expect(active.map(m => m.role)).toEqual(['user', 'assistant'])
expect(active[1].toolMessages).toEqual([input[2]])
expect(active[1]).toMatchObject({ id: 'b', content: 'first\n\nsecond' })
const finished = groupRunMessages(input, false)
expect(finished.at(-1)?.systemType).toBe('run-end')