diff --git a/.gitignore b/.gitignore index 9c827483e..0f5fa2d27 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,4 @@ release/deployment/helm-chart/umbrella/Chart.lock .coda/ backend/script/errorx/.env .cursor/ +AGENTS.md \ No newline at end of file diff --git a/backend/infra/external/benefit/benifit.go b/backend/infra/external/benefit/benifit.go index 0f998474d..3dd078a77 100644 --- a/backend/infra/external/benefit/benifit.go +++ b/backend/infra/external/benefit/benifit.go @@ -28,7 +28,7 @@ type IBenefitService interface { BatchCheckEnableTypeBenefit(ctx context.Context, param *BatchCheckEnableTypeBenefitParams) (result *BatchCheckEnableTypeBenefitResult, err error) // CheckAndDeductOptimizationBenefit 校验扣减优化权益 CheckAndDeductOptimizationBenefit(ctx context.Context, param *CheckAndDeductOptimizationBenefitParams) (result *CheckAndDeductOptimizationBenefitResult, err error) - // DeductOptimizationBenefit 上报优化资源点 + // Deprecated: DeductOptimizationBenefit is deprecated. Use CheckAndDeductOptimizationBenefit(...) instead. DeductOptimizationBenefit(ctx context.Context, param *DeductOptimizationBenefitParams) (err error) } @@ -111,6 +111,14 @@ func (h *DenyReason) ToErr() error { } } +type When int64 + +const ( + WhenStart When = 1 + WhenRunning When = 2 + WhenFinish When = 3 +) + type CheckAndDeductEvalBenefitParams struct { ConnectorUID string `json:"connector_uid"` // Coze登录ID SpaceID int64 `json:"space_id"` // 空间ID @@ -146,10 +154,12 @@ type BatchCheckEnableTypeBenefitResult struct { } type CheckAndDeductOptimizationBenefitParams struct { - ConnectorUID string `json:"connector_uid"` // Coze登录ID - SpaceID int64 `json:"space_id"` // 空间ID - PromptID int64 `json:"prompt_id"` // prompt id,用于唯一标识 - TaskID int64 `json:"task_id"` // task id + ConnectorUID string `json:"connector_uid"` // Coze登录ID + SpaceID int64 `json:"space_id"` // 空间ID + PromptID int64 `json:"prompt_id"` // prompt id,用于唯一标识 + TaskID int64 `json:"task_id"` // task id + Amount float64 `json:"amount"` // 消耗的资源点数 + When When `json:"when"` // 适用场景:1-启动时校验,2-运行时校验,3-结束时校验 } type CheckAndDeductOptimizationBenefitResult struct { diff --git a/backend/infra/platestwrite/latest_write_tracker.go b/backend/infra/platestwrite/latest_write_tracker.go index 6278b4d6c..dd4707b02 100644 --- a/backend/infra/platestwrite/latest_write_tracker.go +++ b/backend/infra/platestwrite/latest_write_tracker.go @@ -129,6 +129,7 @@ const ( ResourceTypePromptCommit ResourceType = "prompt_commit" ResourceTypePromptLabel ResourceType = "prompt_label" ResourceTypePromptCommitLabelMapping ResourceType = "prompt_commit_label_mapping" + ResourceTypeCozeloopOptimizeTask ResourceType = "cozeloop_optimize_task" // 外场智能优化 ResourceTypeExperiment ResourceType = "experiment" ResourceTypeEvalSet ResourceType = "eval_set"