fix(ai): 自动追加AI任务类型
This commit is contained in:
@@ -404,29 +404,29 @@ describe('AiService', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('requires categoryCode for dev task and test case drafts', () => {
|
||||
it('requires free-form taskTypeName without requiring categoryCode for drafts', () => {
|
||||
const devRequired = (DECOMPOSE_TOOL_INPUT_SCHEMA.properties.devTaskDrafts as any).items.required;
|
||||
const testCaseRequired = (DECOMPOSE_TOOL_INPUT_SCHEMA.properties.testCaseDrafts as any).items.required;
|
||||
|
||||
expect(devRequired).toContain('categoryCode');
|
||||
expect(testCaseRequired).toContain('categoryCode');
|
||||
expect(devRequired).toContain('taskTypeName');
|
||||
expect(testCaseRequired).toContain('taskTypeName');
|
||||
expect(devRequired).not.toContain('categoryCode');
|
||||
expect(testCaseRequired).not.toContain('categoryCode');
|
||||
});
|
||||
|
||||
it('allows fine-grained test case category codes for detailed AI decomposition', () => {
|
||||
const testCaseCategoryEnum = (DECOMPOSE_TOOL_INPUT_SCHEMA.properties.testCaseDrafts as any).items.properties
|
||||
.categoryCode.enum;
|
||||
it('does not constrain AI decomposition to the manual task category dictionary', () => {
|
||||
const devCategoryCodeSchema = (DECOMPOSE_TOOL_INPUT_SCHEMA.properties.devTaskDrafts as any).items.properties
|
||||
.categoryCode;
|
||||
const testCaseCategoryCodeSchema = (DECOMPOSE_TOOL_INPUT_SCHEMA.properties.testCaseDrafts as any).items.properties
|
||||
.categoryCode;
|
||||
|
||||
expect(testCaseCategoryEnum).toEqual(
|
||||
expect.arrayContaining([
|
||||
'test_ui_interaction',
|
||||
'test_form_validation',
|
||||
'test_data_consistency',
|
||||
'test_permission',
|
||||
'test_boundary',
|
||||
'test_state_flow',
|
||||
'test_regression',
|
||||
]),
|
||||
);
|
||||
expect(devCategoryCodeSchema).toEqual({ type: 'string' });
|
||||
expect(testCaseCategoryCodeSchema).toEqual({ type: 'string' });
|
||||
expect(DECOMPOSE_SYSTEM_PROMPT).toContain('taskTypeName');
|
||||
expect(DECOMPOSE_SYSTEM_PROMPT).toContain('categoryCode 只作为可选映射');
|
||||
expect(DECOMPOSE_SYSTEM_PROMPT).toContain('不得因为任务类型字典没有覆盖就不拆解');
|
||||
expect(DECOMPOSE_SYSTEM_PROMPT).toContain('采纳时自动追加到任务类型字典');
|
||||
expect(DECOMPOSE_SYSTEM_PROMPT).toContain('测试用例建议类型');
|
||||
});
|
||||
|
||||
it('allows optional recommended assignee fields without requiring adoption', () => {
|
||||
|
||||
@@ -56,14 +56,17 @@ export const DECOMPOSE_SYSTEM_PROMPT = `你是 FTB 项目管理系统的产品
|
||||
- 测试用例 description 必须写成结构化短文本,至少包含:前置条件、操作步骤、预期结果;涉及边界/异常/数据时要写明测试数据或状态
|
||||
|
||||
5. 任务类型
|
||||
- 每条开发任务和测试用例都必须输出 categoryCode
|
||||
- 开发任务优先使用 frontend_development / frontend_interaction / backend_development / backend_api / database_schema / api_integration
|
||||
- 测试用例优先使用 test_functional / test_ui_interaction / test_form_validation / test_api / test_data_consistency / test_permission / test_exception / test_boundary / test_state_flow / test_compatibility / test_regression
|
||||
- 每条开发任务和测试用例都必须输出 taskTypeName,使用中文业务类型名,例如"人员名片交互"、"预入职数据源"、"姓名展示兼容测试"
|
||||
- categoryCode 只作为可选映射;只有能明确映射到已有稳定语义码时才输出
|
||||
- 不得因为任务类型字典没有覆盖就不拆解;如果没有合适 categoryCode,省略 categoryCode,但必须保留准确的 taskTypeName
|
||||
- 采纳时自动追加到任务类型字典,AI 不需要也不得输出数据库 categoryId
|
||||
- 开发任务建议类型:前端开发、前端交互、后端开发、后端接口、数据库设计、接口联调、数据处理、实施支持、文档,或按原型识别出更准确的类型名
|
||||
- 测试用例建议类型:功能测试、UI交互测试、表单校验测试、接口测试、数据一致性测试、权限测试、异常场景测试、边界值测试、状态流转测试、兼容性测试、回归测试,或按验收点识别出更准确的类型名
|
||||
- 不输出数据库 categoryId
|
||||
|
||||
6. 推荐负责人(可选字段)
|
||||
- 可以输出 recommendedAssigneeName 和 recommendedAssigneeReason,但 recommendedAssigneeName 只能从输入版本成员清单的 members[].name 中精确选择
|
||||
- 开发任务按 categoryCode 优先匹配 frontend/backend 角色;测试用例优先匹配 testing 角色
|
||||
- 开发任务按 taskTypeName/categoryCode 语义优先匹配 frontend/backend 角色;测试用例优先匹配 testing 角色
|
||||
- 如果没有明确匹配的版本成员,omit recommendedAssigneeName and recommendedAssigneeReason
|
||||
- 不要把推荐当作已分配,最终是否采纳由用户确认
|
||||
|
||||
@@ -164,20 +167,8 @@ export const DECOMPOSE_TOOL_INPUT_SCHEMA = {
|
||||
properties: {
|
||||
title: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
categoryCode: {
|
||||
type: 'string',
|
||||
enum: [
|
||||
'frontend_development',
|
||||
'frontend_interaction',
|
||||
'backend_development',
|
||||
'backend_api',
|
||||
'database_schema',
|
||||
'api_integration',
|
||||
'data_processing',
|
||||
'implementation_support',
|
||||
'documentation',
|
||||
],
|
||||
},
|
||||
taskTypeName: { type: 'string' },
|
||||
categoryCode: { type: 'string' },
|
||||
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
|
||||
aiEstimateHours: { type: 'number' },
|
||||
requirementName: { type: 'string' },
|
||||
@@ -197,7 +188,7 @@ export const DECOMPOSE_TOOL_INPUT_SCHEMA = {
|
||||
minItems: 1,
|
||||
},
|
||||
},
|
||||
required: ['title', 'description', 'categoryCode', 'priority', 'aiEstimateHours', 'references'],
|
||||
required: ['title', 'description', 'taskTypeName', 'priority', 'aiEstimateHours', 'references'],
|
||||
},
|
||||
},
|
||||
testCaseDrafts: {
|
||||
@@ -207,22 +198,8 @@ export const DECOMPOSE_TOOL_INPUT_SCHEMA = {
|
||||
properties: {
|
||||
title: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
categoryCode: {
|
||||
type: 'string',
|
||||
enum: [
|
||||
'test_functional',
|
||||
'test_ui_interaction',
|
||||
'test_form_validation',
|
||||
'test_api',
|
||||
'test_data_consistency',
|
||||
'test_permission',
|
||||
'test_exception',
|
||||
'test_boundary',
|
||||
'test_state_flow',
|
||||
'test_compatibility',
|
||||
'test_regression',
|
||||
],
|
||||
},
|
||||
taskTypeName: { type: 'string' },
|
||||
categoryCode: { type: 'string' },
|
||||
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
|
||||
aiEstimateHours: { type: 'number' },
|
||||
requirementName: { type: 'string' },
|
||||
@@ -242,7 +219,7 @@ export const DECOMPOSE_TOOL_INPUT_SCHEMA = {
|
||||
minItems: 1,
|
||||
},
|
||||
},
|
||||
required: ['title', 'description', 'categoryCode', 'priority', 'aiEstimateHours', 'references'],
|
||||
required: ['title', 'description', 'taskTypeName', 'priority', 'aiEstimateHours', 'references'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user