Skip to content

Commit afe78d1

Browse files
committed
fix: update chat update_time to use timezone.now for consistency
1 parent ef74377 commit afe78d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/application/serializers/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from django.core.cache import cache
1313
from django.db.models import QuerySet
1414
from django.utils.translation import gettext_lazy as _
15+
from django.utils import timezone
1516

1617
from application.chat_pipeline.step.chat_step.i_chat_step import PostResponseHandler
1718
from application.models import Application, ChatRecord, Chat, ApplicationVersion, ChatUserType, ApplicationTypeChoices, \
@@ -213,7 +214,7 @@ def append_chat_record(self, chat_record: ChatRecord):
213214
chat_user_id=self.chat_user_id, chat_user_type=self.chat_user_type,
214215
asker=self.get_chat_user()).save()
215216
else:
216-
QuerySet(Chat).filter(id=self.chat_id).update(update_time=datetime.now())
217+
QuerySet(Chat).filter(id=self.chat_id).update(update_time=timezone.now())
217218
# 插入会话记录
218219
chat_record.save()
219220
ChatCountSerializer(data={'chat_id': self.chat_id}).update_chat()

0 commit comments

Comments
 (0)