feat: AI 对话支持 A2UI 表单/审查/图表与 Excel 读取

This commit is contained in:
2026-08-04 14:41:40 +08:00
parent f07ffdc64c
commit 50c44e4410
51 changed files with 11588 additions and 175 deletions

View File

@@ -37,4 +37,38 @@ describe('AI chat API adapter', () => {
const page = await aiChatApi.listMessages(3);
expect(page.items.map((item) => item.id)).toEqual([1, 101]);
});
it('confirmReviewStep posts to the per-section confirm endpoint', async () => {
const updated = {
id: 'review-1',
title: '批量导入',
status: 'pending',
sections: [
{ key: 'students', type: 'students', title: '学生', status: 'submitted' },
],
};
vi.spyOn(api, 'post').mockResolvedValue({ success: true, data: updated });
await expect(aiChatApi.confirmReviewStep('review-1', 'students')).resolves.toEqual(updated);
expect(api.post).toHaveBeenCalledWith(
'/ai/chat/reviews/review-1/steps/students/confirm',
);
});
it('confirmReviewGroup posts to the per-type confirm endpoint', async () => {
const updated = {
id: 'review-1',
title: '批量导入',
status: 'pending',
sections: [
{ key: 'checkins_a', type: 'checkins', title: '入住A', status: 'submitted' },
],
};
vi.spyOn(api, 'post').mockResolvedValue({ success: true, data: updated });
await expect(aiChatApi.confirmReviewGroup('review-1', 'checkins')).resolves.toEqual(updated);
expect(api.post).toHaveBeenCalledWith(
'/ai/chat/reviews/review-1/types/checkins/confirm',
);
});
});