fix(ai): 自动追加AI任务类型
This commit is contained in:
@@ -76,7 +76,7 @@ function draftFingerprint(
|
||||
draft: AgentDevTaskDraft | AgentTestCaseDraft,
|
||||
input: DecomposeDedupeInput,
|
||||
): string {
|
||||
return buildFingerprint(draft.title, draft.categoryCode, draft.references, input);
|
||||
return buildFingerprint(draft.title, draftCategoryIdentity(draft, input), draft.references, input);
|
||||
}
|
||||
|
||||
function existingItemFingerprint(
|
||||
@@ -85,13 +85,25 @@ function existingItemFingerprint(
|
||||
references: Reference[],
|
||||
input: DecomposeDedupeInput,
|
||||
): string {
|
||||
const categoryCode = input.categories.find((category) => category.id === categoryId)?.code ?? categoryId;
|
||||
return buildFingerprint(title, categoryCode, references, input);
|
||||
const categoryName = input.categories.find((category) => category.id === categoryId)?.name ?? categoryId;
|
||||
return buildFingerprint(title, categoryName, references, input);
|
||||
}
|
||||
|
||||
function draftCategoryIdentity(
|
||||
draft: AgentDevTaskDraft | AgentTestCaseDraft,
|
||||
input: DecomposeDedupeInput,
|
||||
): string {
|
||||
const explicitName = draft.taskTypeName?.trim();
|
||||
if (explicitName) return explicitName;
|
||||
if (draft.categoryCode) {
|
||||
return input.categories.find((category) => category.code === draft.categoryCode)?.name ?? draft.categoryCode;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function buildFingerprint(
|
||||
title: string,
|
||||
categoryCode: string,
|
||||
categoryName: string,
|
||||
references: Array<AgentReference | Reference>,
|
||||
input: DecomposeDedupeInput,
|
||||
): string {
|
||||
@@ -100,7 +112,7 @@ function buildFingerprint(
|
||||
.filter(Boolean)
|
||||
.sort()
|
||||
.join('|');
|
||||
return `${categoryCode}::${normalizeTitle(title)}::${refKey}`;
|
||||
return `${normalizeTitle(categoryName)}::${normalizeTitle(title)}::${refKey}`;
|
||||
}
|
||||
|
||||
function normalizeTitle(title: string): string {
|
||||
@@ -122,4 +134,3 @@ function normalizeReferenceKey(
|
||||
}
|
||||
return `${ref.type}:${rawId.toLowerCase()}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user