F1-F10: audit fixes (dimension normalize, passingScore scale, DB defaults, onDelete, item status filter, timeout event type, userId privacy) + generator.node.ts strict prompt rules (anti-hallucination)

This commit is contained in:
Developer
2026-05-20 11:13:37 +08:00
parent 29bac74b58
commit 83483d8117
13 changed files with 205 additions and 202 deletions
@@ -260,7 +260,6 @@ export class KnowledgeGroupService {
throw new NotFoundException(this.i18nService.getMessage('groupNotFound'));
}
// Check permission using TenantService
const hasAccess = await this.tenantService.canAccessTenant(
userId,
group.tenantId,
@@ -272,7 +271,31 @@ export class KnowledgeGroupService {
);
}
return group.knowledgeBases;
const allGroups = await this.groupRepository.find({
where: tenantId === null ? {} : { tenantId },
relations: ['knowledgeBases'],
});
const childIds = new Set<string>();
const collectDescendantIds = (parentId: string) => {
for (const g of allGroups) {
if (g.parentId === parentId) {
childIds.add(g.id);
collectDescendantIds(g.id);
}
}
};
collectDescendantIds(groupId);
const result = [...(group.knowledgeBases || [])];
for (const childId of childIds) {
const childGroup = allGroups.find(g => g.id === childId);
if (childGroup?.knowledgeBases) {
result.push(...childGroup.knowledgeBases);
}
}
return result;
}
async addFilesToGroup(