fix: update task billing log content to include reason - #3093
Conversation
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@service/task_billing.go`:
- Around line 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.
| //other["reason"] = reason | ||
| other["pre_consumed_quota"] = preConsumedQuota | ||
| other["actual_quota"] = actualQuota | ||
| model.RecordTaskBillingLog(model.RecordTaskBillingLogParams{ | ||
| UserId: task.UserId, | ||
| LogType: logType, | ||
| Content: "", | ||
| Content: reason, |
There was a problem hiding this comment.
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.
…1216dd9f2155c19f0556e4655bc fix: update task billing log content to include reason
将异步任务的计费过程显示到前端的其他详情中

Summary by CodeRabbit