feat: improve user experience

This commit is contained in:
tinkle-community
2025-12-28 23:29:59 +08:00
parent 98ba88b548
commit 7b30b687eb
6 changed files with 117 additions and 0 deletions
+11
View File
@@ -2,6 +2,7 @@ package config
import (
"nofx/experience"
"nofx/mcp"
"os"
"strconv"
"strings"
@@ -79,6 +80,16 @@ func Init() {
// Initialize experience improvement (installation ID will be set after database init)
experience.Init(cfg.ExperienceImprovement, "")
// Set up AI token usage tracking callback
mcp.TokenUsageCallback = func(usage mcp.TokenUsage) {
experience.TrackAIUsage(experience.AIUsageEvent{
ModelProvider: usage.Provider,
ModelName: usage.Model,
InputTokens: usage.PromptTokens,
OutputTokens: usage.CompletionTokens,
})
}
}
// Get returns the global configuration