mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-02 05:31:02 +00:00
fix(insight): count only user interactions in metrics
- Update totalMessages to count only user messages and slash commands - Update heatmap to reflect only user interactions - Update activeHours to reflect only user interactions - Update tests to verify slash commands are counted correctly This ensures the insight report accurately reflects actual user engagement rather than including internal tool calls and system events. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
c948e0c6e9
commit
f47bef1ded
2 changed files with 23 additions and 6 deletions
|
|
@ -842,7 +842,6 @@ None captured`;
|
|||
for (const fileInfo of batch) {
|
||||
try {
|
||||
const records = await readJsonlFile<ChatRecord>(fileInfo.path);
|
||||
totalMessages += records.length;
|
||||
|
||||
// Process each record
|
||||
for (const record of records) {
|
||||
|
|
@ -850,11 +849,19 @@ None captured`;
|
|||
const dateKey = this.formatDate(timestamp);
|
||||
const hour = timestamp.getHours();
|
||||
|
||||
// Update heatmap (count of interactions per day)
|
||||
heatmap[dateKey] = (heatmap[dateKey] || 0) + 1;
|
||||
// Count user messages and slash commands (actual user interactions)
|
||||
const isUserMessage = record.type === 'user';
|
||||
const isSlashCommand =
|
||||
record.type === 'system' && record.subtype === 'slash_command';
|
||||
if (isUserMessage || isSlashCommand) {
|
||||
totalMessages++;
|
||||
|
||||
// Update active hours
|
||||
activeHours[hour] = (activeHours[hour] || 0) + 1;
|
||||
// Update heatmap (count of user interactions per day)
|
||||
heatmap[dateKey] = (heatmap[dateKey] || 0) + 1;
|
||||
|
||||
// Update active hours
|
||||
activeHours[hour] = (activeHours[hour] || 0) + 1;
|
||||
}
|
||||
|
||||
// Track session times
|
||||
if (!sessionStartTimes[record.sessionId]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue