Skip to content
Merged
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
4 changes: 2 additions & 2 deletions service/task_billing.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ func RecalculateTaskQuota(ctx context.Context, task *model.Task, actualQuota int
}
other := taskBillingOther(task)
other["task_id"] = task.TaskID
other["reason"] = reason
//other["reason"] = reason
other["pre_consumed_quota"] = preConsumedQuota
other["actual_quota"] = actualQuota
model.RecordTaskBillingLog(model.RecordTaskBillingLogParams{
UserId: task.UserId,
LogType: logType,
Content: "",
Content: reason,
Comment on lines +225 to +231

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Preserve reason in Other to satisfy the “其他详情” display goal.

At Line 225, other["reason"] is removed, and at Line 231 it is only written to Content. This can break the frontend “其他详情” payload that reads from Other, which is the stated PR objective.

Proposed fix
 	other := taskBillingOther(task)
 	other["task_id"] = task.TaskID
-	//other["reason"] = reason
+	other["reason"] = reason
 	other["pre_consumed_quota"] = preConsumedQuota
 	other["actual_quota"] = actualQuota
 	model.RecordTaskBillingLog(model.RecordTaskBillingLogParams{
 		UserId:    task.UserId,
 		LogType:   logType,
 		Content:   reason,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@service/task_billing.go` around lines 225 - 231, The review removed
other["reason"] causing the frontend “其他详情” to miss the reason; restore the
reason into the Other map before calling model.RecordTaskBillingLog so the
payload used by the UI includes it. Specifically, in service/task_billing.go
ensure you set other["reason"] = reason (alongside other["pre_consumed_quota"]
and other["actual_quota"]) prior to invoking
model.RecordTaskBillingLog(model.RecordTaskBillingLogParams{... Content: reason,
...}) so the Other field contains the reason for the record.

ChannelId: task.ChannelId,
ModelName: taskModelName(task),
Quota: logQuota,
Expand Down