From 42b5312198c3f3be8a951da387c4c20cdced353a Mon Sep 17 00:00:00 2001 From: QiuSW <105186638@qq.com> Date: Tue, 15 Sep 2026 08:42:11 +0800 Subject: [PATCH] feat: support image search identity handoff and safe payload (#278) --- server/app/goauto/task/current_page.go | 4 ++-- server/app/goauto/task/service.go | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server/app/goauto/task/current_page.go b/server/app/goauto/task/current_page.go index fc73c6b..d093d96 100644 --- a/server/app/goauto/task/current_page.go +++ b/server/app/goauto/task/current_page.go @@ -211,7 +211,7 @@ func (service *Service) IdentifyCurrentPage(ctx context.Context, taskID uint64, } return CurrentPageIdentifyResponse{}, internalError(err) } - if existing.Source != models.CollectionTaskSourceAgentCurrentPage || existing.DeviceID == nil || *existing.DeviceID != deviceRecord.ID { + if (existing.Source != models.CollectionTaskSourceAgentCurrentPage && existing.Source != models.CollectionTaskSourceImageSearch) || existing.DeviceID == nil || *existing.DeviceID != deviceRecord.ID { return CurrentPageIdentifyResponse{}, serviceError(CodeTaskNotFound, "任务不存在") } if existing.IdentifyRequestID != nil && *existing.IdentifyRequestID == request.RequestID && existing.PDDProductID != nil { @@ -240,7 +240,7 @@ func (service *Service) IdentifyCurrentPage(ctx context.Context, taskID uint64, } return internalError(err) } - if record.Source != models.CollectionTaskSourceAgentCurrentPage || record.DeviceID == nil || *record.DeviceID != deviceRecord.ID { + if (record.Source != models.CollectionTaskSourceAgentCurrentPage && record.Source != models.CollectionTaskSourceImageSearch) || record.DeviceID == nil || *record.DeviceID != deviceRecord.ID { return serviceError(CodeTaskNotFound, "任务不存在") } if record.IdentifyRequestID != nil && *record.IdentifyRequestID == request.RequestID && record.PDDProductID != nil { diff --git a/server/app/goauto/task/service.go b/server/app/goauto/task/service.go index 361c7fe..84f1ad6 100644 --- a/server/app/goauto/task/service.go +++ b/server/app/goauto/task/service.go @@ -290,7 +290,11 @@ func (service *Service) payload(record models.CollectionTask, replayed bool) (Ta } var imageSearch json.RawMessage if record.ImageSearchSnapshot != nil && *record.ImageSearchSnapshot != "" { - imageSearch = json.RawMessage(*record.ImageSearchSnapshot) + snapshot, snapshotErr := loadImageSearchSnapshot(record) + if snapshotErr != nil { + return TaskPayload{}, snapshotErr + } + imageSearch, _ = json.Marshal(snapshot.ImageSearchImage) if !json.Valid(imageSearch) { return TaskPayload{}, internalError(errors.New("stored image search snapshot is invalid JSON")) }