Skip to content

Commit 43f34db

Browse files
authored
[fix][infra]modify special benefit struct (#253)
[fix][infra]modify special benefit struct
1 parent 1f833b1 commit 43f34db

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ release/deployment/helm-chart/umbrella/Chart.lock
5353
.coda/
5454
backend/script/errorx/.env
5555
.cursor/
56+
AGENTS.md

backend/infra/external/benefit/benifit.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type IBenefitService interface {
2828
BatchCheckEnableTypeBenefit(ctx context.Context, param *BatchCheckEnableTypeBenefitParams) (result *BatchCheckEnableTypeBenefitResult, err error)
2929
// CheckAndDeductOptimizationBenefit 校验扣减优化权益
3030
CheckAndDeductOptimizationBenefit(ctx context.Context, param *CheckAndDeductOptimizationBenefitParams) (result *CheckAndDeductOptimizationBenefitResult, err error)
31-
// DeductOptimizationBenefit 上报优化资源点
31+
// Deprecated: DeductOptimizationBenefit is deprecated. Use CheckAndDeductOptimizationBenefit(...) instead.
3232
DeductOptimizationBenefit(ctx context.Context, param *DeductOptimizationBenefitParams) (err error)
3333
}
3434

@@ -111,6 +111,14 @@ func (h *DenyReason) ToErr() error {
111111
}
112112
}
113113

114+
type When int64
115+
116+
const (
117+
WhenStart When = 1
118+
WhenRunning When = 2
119+
WhenFinish When = 3
120+
)
121+
114122
type CheckAndDeductEvalBenefitParams struct {
115123
ConnectorUID string `json:"connector_uid"` // Coze登录ID
116124
SpaceID int64 `json:"space_id"` // 空间ID
@@ -146,10 +154,12 @@ type BatchCheckEnableTypeBenefitResult struct {
146154
}
147155

148156
type CheckAndDeductOptimizationBenefitParams struct {
149-
ConnectorUID string `json:"connector_uid"` // Coze登录ID
150-
SpaceID int64 `json:"space_id"` // 空间ID
151-
PromptID int64 `json:"prompt_id"` // prompt id,用于唯一标识
152-
TaskID int64 `json:"task_id"` // task id
157+
ConnectorUID string `json:"connector_uid"` // Coze登录ID
158+
SpaceID int64 `json:"space_id"` // 空间ID
159+
PromptID int64 `json:"prompt_id"` // prompt id,用于唯一标识
160+
TaskID int64 `json:"task_id"` // task id
161+
Amount float64 `json:"amount"` // 消耗的资源点数
162+
When When `json:"when"` // 适用场景:1-启动时校验,2-运行时校验,3-结束时校验
153163
}
154164

155165
type CheckAndDeductOptimizationBenefitResult struct {

backend/infra/platestwrite/latest_write_tracker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const (
129129
ResourceTypePromptCommit ResourceType = "prompt_commit"
130130
ResourceTypePromptLabel ResourceType = "prompt_label"
131131
ResourceTypePromptCommitLabelMapping ResourceType = "prompt_commit_label_mapping"
132+
ResourceTypeCozeloopOptimizeTask ResourceType = "cozeloop_optimize_task" // 外场智能优化
132133

133134
ResourceTypeExperiment ResourceType = "experiment"
134135
ResourceTypeEvalSet ResourceType = "eval_set"

0 commit comments

Comments
 (0)