fix: passingScore scaling and dimensions propagation

- Frontend: divide by 10 on load, multiply by 10 on send (UI:0-10, DB:0-100)
- Backend: include template dimensions in session templateData snapshot
This commit is contained in:
Developer
2026-05-21 11:07:07 +08:00
parent eba30517a6
commit 54762ca299
2 changed files with 15 additions and 9 deletions
+10 -1
View File
@@ -189,7 +189,15 @@ private async getModel(tenantId: string): Promise<ChatOpenAI> {
this.logger.debug('[calculateScores] Scoring debug:', { promptAvg, otherDimsWithScores, otherAvg, workCapability: dimensionAverages.workCapability });
const finalScore = promptAvg * (weightConfig.prompt / 100) + otherAvg * (weightConfig.other / 100);
const allScores: number[] = [];
questions.forEach((q: any) => {
const score = scores[q.id || questions.indexOf(q).toString()] || 0;
allScores.push(score);
});
const finalScore = allScores.length > 0
? allScores.reduce((a, b) => a + b, 0) / allScores.length
: 0;
const radarData: Record<string, number> = {};
Object.keys(dimensionAverages).forEach(dim => {
@@ -465,6 +473,7 @@ private async getModel(tenantId: string): Promise<ChatOpenAI> {
weightConfig: template.weightConfig,
passingScore: template.passingScore,
style: template.style,
dimensions: template.dimensions,
linkedGroupIds: template.linkedGroupIds,
}
: undefined;