feat: 流式展示设计 Agent 对话

需求:设计 Agent 对话与确认生成的回复需要实时展示。

实现:统一通过 Agent Gateway 提交 Turn,接收并去重 assistant delta,以 canonical Workspace 收口,并修复跨项目旧请求回写竞态。
This commit is contained in:
2026-08-02 21:21:50 +08:00
parent 518d7ab4cd
commit 90a249db31
9 changed files with 819 additions and 93 deletions

View File

@@ -80,7 +80,12 @@ describe('AI design renderer API boundary', () => {
});
it('sends conversation turns with the current turn revision and no provider settings', async () => {
await sendImageWorkspaceMessage('workspace/one', 4, ' 继续调整构图 ');
await sendImageWorkspaceMessage(
'workspace/one',
4,
' 继续调整构图 ',
'turn-client-1',
);
const [path, init] = hostApiFetchMock.mock.calls[0];
expect(path).toBe('/api/works/image-workspace/workspaces/workspace%2Fone/messages');
@@ -89,7 +94,7 @@ describe('AI design renderer API boundary', () => {
expectedTurnRevision: 4,
message: '继续调整构图',
attachmentAssetIds: [],
clientTurnId: expect.stringMatching(/^turn-/),
clientTurnId: 'turn-client-1',
});
expect(String(init?.body)).not.toMatch(/model|resolution|outputCount/);
});