From 85e74246048a6c5ef6b88208f53003d678ca7536 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Mon, 18 Dec 2023 03:13:12 +0800 Subject: [PATCH] fix: new subject value --- rpc/timeline_service.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpc/timeline_service.py b/rpc/timeline_service.py index d270bc1..8912d1d 100644 --- a/rpc/timeline_service.py +++ b/rpc/timeline_service.py @@ -33,8 +33,8 @@ BatchMeme: pydantic.TypeAdapter[dict[int, Any]] = pydantic.TypeAdapter(dict[int, Any]) -BatchSubjectImage: pydantic.TypeAdapter[dict[int, Any]] = pydantic.TypeAdapter( - dict[int, Any] +BatchSubjectImage: pydantic.TypeAdapter[dict[int, SubjectImage]] = pydantic.TypeAdapter( + dict[int, SubjectImage] ) @@ -113,15 +113,15 @@ def merge_previous_timeline( img = BatchSubjectImage.validate_python(phpseralize.loads(tl.img.encode())) else: i = SubjectImage.model_validate(phpseralize.loads(tl.img.encode())) - img = {int(i.subject_id): i.model_dump} + img = {int(i.subject_id): i} img[req.subject.id] = SubjectImage( subject_id=str(req.subject.id), images=req.subject.image - ).model_dump() + ) tl.batch = 1 tl.memo = php.serialize(memo) - tl.img = php.serialize(img) + tl.img = php.serialize({key: value.model_dump() for key, value in img.items()}) session.add(tl)