Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -7196,7 +7196,7 @@ func sendAITokenLimitAlert(ctx context.Context, execution WorkflowExecution, ful
appRunsLimit := int64(0)
orgStats, statsErr := GetOrgStatistics(ctx, billingOrgId)
if statsErr == nil && orgStats != nil {
stats := handleGetCorrectedStats(orgStats)
stats := GetCorrectedStats(orgStats)
totalAppExecutions = stats.MonthlyAppExecutions + stats.MonthlyChildAppExecutions
}
if fullOrg != nil {
Expand Down
2 changes: 1 addition & 1 deletion db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func SetOrgStatistics(ctx context.Context, stats ExecutionInfo, id string) error
}

stat.Date = stat.Date.UTC()
statdate := stat.Date.Format("2006-12-30")
statdate := stat.Date.Format("2006-01-02")
if !ArrayContains(allDates, statdate) {
newDaily = append(newDaily, stat)
allDates = append(allDates, statdate)
Expand Down
4 changes: 2 additions & 2 deletions stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ func HandleGetStatistics(resp http.ResponseWriter, request *http.Request) {
}
}

stats := handleGetCorrectedStats(info)
stats := GetCorrectedStats(info)

newjson, err := json.Marshal(stats)
if err != nil {
Expand All @@ -865,7 +865,7 @@ func HandleGetStatistics(resp http.ResponseWriter, request *http.Request) {
}

// Make sure that we are not calling SetOrgStatistics function after calling this function. This will increase the app runs count in db on every call to this function.
func handleGetCorrectedStats(info *ExecutionInfo) *ExecutionInfo {
func GetCorrectedStats(info *ExecutionInfo) *ExecutionInfo {

// 1 Million Input Tokens = 250 app runs
// 1 Million Output Tokens = 1500 app runs
Expand Down
Loading