mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 20:50:34 +00:00
feat(insight): add satisfaction and friction data aggregation and display in insights
This commit is contained in:
parent
afe911d06b
commit
20de2a001a
5 changed files with 362 additions and 4 deletions
|
|
@ -272,12 +272,40 @@ export class DataProcessor {
|
|||
|
||||
const qualitative = await this.generateQualitativeInsights(metrics, facets);
|
||||
|
||||
// Aggregate satisfaction and friction data from facets
|
||||
const { satisfactionAgg, frictionAgg } = this.aggregateFacetsData(facets);
|
||||
|
||||
return {
|
||||
...metrics,
|
||||
qualitative,
|
||||
satisfaction: satisfactionAgg,
|
||||
friction: frictionAgg,
|
||||
};
|
||||
}
|
||||
|
||||
// Aggregate satisfaction and friction data from facets
|
||||
private aggregateFacetsData(facets: SessionFacets[]): {
|
||||
satisfactionAgg: Record<string, number>;
|
||||
frictionAgg: Record<string, number>;
|
||||
} {
|
||||
const satisfactionAgg: Record<string, number> = {};
|
||||
const frictionAgg: Record<string, number> = {};
|
||||
|
||||
facets.forEach((facet) => {
|
||||
// Aggregate satisfaction
|
||||
Object.entries(facet.user_satisfaction_counts).forEach(([sat, count]) => {
|
||||
satisfactionAgg[sat] = (satisfactionAgg[sat] || 0) + count;
|
||||
});
|
||||
|
||||
// Aggregate friction
|
||||
Object.entries(facet.friction_counts).forEach(([fric, count]) => {
|
||||
frictionAgg[fric] = (frictionAgg[fric] || 0) + count;
|
||||
});
|
||||
});
|
||||
|
||||
return { satisfactionAgg, frictionAgg };
|
||||
}
|
||||
|
||||
private async generateQualitativeInsights(
|
||||
metrics: Omit<InsightData, 'facets' | 'qualitative'>,
|
||||
facets: SessionFacets[],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue