fix: stabilize ai design history switching
This commit is contained in:
@@ -286,6 +286,39 @@ describe('local AI design workspace', () => {
|
||||
})).resolves.toMatchObject({ turnRevision: 2 });
|
||||
});
|
||||
|
||||
it('pages local Conversation history in ten-message windows', async () => {
|
||||
const service = createService(createTemporaryDirectory());
|
||||
const created = await service.createWorkspace({
|
||||
clientWorkspaceId: 'client-history-page',
|
||||
title: '分页历史',
|
||||
});
|
||||
const conversationId = created.conversations[0].conversationId;
|
||||
|
||||
for (let revision = 0; revision < 6; revision += 1) {
|
||||
await service.submitMessage({
|
||||
workspaceId: created.workspaceId,
|
||||
conversationId,
|
||||
clientTurnId: `history-page-turn-${revision + 1}`,
|
||||
expectedTurnRevision: revision,
|
||||
message: `第 ${revision + 1} 条设计需求`,
|
||||
});
|
||||
}
|
||||
|
||||
const latest = await service.getConversation(created.workspaceId, conversationId);
|
||||
expect(latest.messages).toHaveLength(10);
|
||||
expect(latest.messages.map((message) => message.turnRevision))
|
||||
.toEqual([2, 2, 3, 3, 4, 4, 5, 5, 6, 6]);
|
||||
expect(latest.messagePage).toMatchObject({ hasOlder: true });
|
||||
|
||||
const older = await service.getConversation(
|
||||
created.workspaceId,
|
||||
conversationId,
|
||||
latest.messagePage!.nextBefore!,
|
||||
);
|
||||
expect(older.messages.map((message) => message.turnRevision)).toEqual([1, 1]);
|
||||
expect(older.messagePage).toEqual({ hasOlder: false, nextBefore: null });
|
||||
});
|
||||
|
||||
it('deletes a project while a task is queued and makes its task state inaccessible', async () => {
|
||||
const userDataDir = createTemporaryDirectory();
|
||||
const service = createService(userDataDir);
|
||||
|
||||
Reference in New Issue
Block a user