MCPcopy Index your code
hub / github.com/1Panel-dev/MaxKB / ChatCountSerializer

Class ChatCountSerializer

apps/application/serializers/application_chat.py:262–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261
262class ChatCountSerializer(serializers.Serializer):
263 chat_id = serializers.UUIDField(required=True, label=_("Conversation ID"))
264
265 def get_query_set(self):
266 return QuerySet(ChatRecord).filter(chat_id=self.data.get('chat_id'))
267
268 def update_chat(self):
269 self.is_valid(raise_exception=True)
270 count_chat_record = native_search(self.get_query_set(), get_file_content(
271 os.path.join(PROJECT_DIR, "apps", "application", 'sql', 'count_chat_record.sql')), with_search_one=True)
272 QuerySet(Chat).filter(id=self.data.get('chat_id')).update(star_num=count_chat_record.get('star_num', 0) or 0,
273 trample_num=count_chat_record.get('trample_num',
274 0) or 0,
275 chat_record_count=count_chat_record.get(
276 'chat_record_count', 0) or 0,
277 mark_sum=count_chat_record.get('mark_sum', 0) or 0)
278 return True
279
280
281def get_source_display(source):

Callers 4

voteMethod · 0.90
append_chat_recordMethod · 0.90
post_improveMethod · 0.90
improveMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected