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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user