Skip to content

Commit eb2cd86

Browse files
authored
[fix][backend] evaluation feature bug (#170)
fix(backend): evaluation feature bug
1 parent 8d9dd24 commit eb2cd86

18 files changed

Lines changed: 650 additions & 488 deletions

File tree

backend/api/handler/coze/loop/apis/experiment_service.go

Lines changed: 26 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/cmd/main.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,18 @@ func newComponent(ctx context.Context) (*component, error) {
185185
}
186186

187187
db, err := db.NewDBFromConfig(&db.Config{
188-
DBHostname: getMysqlDomain(),
189-
DBPort: getMysqlPort(),
190-
User: getMysqlUser(),
191-
Password: getMysqlPassword(),
192-
DBName: getMysqlDatabase(),
193-
Loc: "Local",
194-
DBCharset: "utf8mb4",
195-
Timeout: time.Minute,
196-
ReadTimeout: time.Minute,
197-
WriteTimeout: time.Minute,
198-
DSNParams: url.Values{"clientFoundRows": []string{"true"}},
188+
DBHostname: getMysqlDomain(),
189+
DBPort: getMysqlPort(),
190+
User: getMysqlUser(),
191+
Password: getMysqlPassword(),
192+
DBName: getMysqlDatabase(),
193+
Loc: "Local",
194+
DBCharset: "utf8mb4",
195+
Timeout: time.Minute,
196+
ReadTimeout: time.Minute,
197+
WriteTimeout: time.Minute,
198+
DSNParams: url.Values{"clientFoundRows": []string{"true"}},
199+
WithReturning: true,
199200
})
200201
if err != nil {
201202
return nil, err

backend/modules/evaluation/domain/entity/event.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ type ExportCSVEvent struct {
119119
ExportID int64
120120
ExperimentID int64
121121
SpaceID int64
122+
123+
Session *Session
122124
}

backend/modules/evaluation/domain/entity/expt_export_record.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@ func DefaultExptExportWhiteList() *ExptExportWhiteList {
3838
}
3939

4040
type ExptExportWhiteList struct {
41-
UserIDs []int64 `json:"user_ids" mapstructure:"user_ids"`
41+
UserIDs []int64 `json:"user_ids" mapstructure:"user_ids"`
42+
AllowAll bool `json:"allow_all" mapstructure:"allow_all"`
4243
}
4344

4445
func (e *ExptExportWhiteList) IsUserIDInWhiteList(userID string) bool {
46+
if e == nil {
47+
return false
48+
}
49+
if e.AllowAll {
50+
return true
51+
}
4552
uid, err := strconv.ParseInt(userID, 10, 64)
4653
if err != nil {
4754
return false

backend/modules/evaluation/domain/repo/expt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ type IExptAnnotateRepo interface {
119119
GetExptTurnResultTagRefs(ctx context.Context, exptID, spaceID int64) ([]*entity.ExptTurnResultTagRef, error)
120120
BatchGetExptTurnResultTagRefs(ctx context.Context, exptIDs []int64, spaceID int64) ([]*entity.ExptTurnResultTagRef, error)
121121
GetTagRefByTagKeyID(ctx context.Context, exptID, spaceID, tagKeyID int64) (*entity.ExptTurnResultTagRef, error)
122-
UpdateCompleteCount(ctx context.Context, exptID, spaceID, tagKeyID int64, opts ...db.Option) (int32, int32, error)
122+
UpdateCompleteCount(ctx context.Context, exptID, spaceID, tagKeyID int64, opts ...db.Option) error
123123
DeleteExptTurnResultTagRef(ctx context.Context, exptID, spaceID, tagKeyID int64, opts ...db.Option) error
124124

125125
SaveAnnotateRecord(ctx context.Context, exptTurnResultID int64, record *entity.AnnotateRecord, opts ...db.Option) error

0 commit comments

Comments
 (0)