Browse Source

Update agent_service: limit logging

StrayWarrior 2 tuần trước cách đây
mục cha
commit
6da9b28d5a
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      agent_service.py

+ 4 - 2
agent_service.py

@@ -263,7 +263,7 @@ class AgentService:
         staff_white_lists = set(apollo_config.get_json_value("agent_response_whitelist_staffs"))
         if not (staff_id in staff_white_lists or hit_white_list_tags or skip_check):
             logger.warning(f"staff[{staff_id}] user[{user_id}]: skip reply")
-            return None
+            return
         self.send_queue.produce(
             Message.build(message_type, MessageChannel.CORP_WECHAT,
                           staff_id, user_id, response, current_ts)
@@ -345,7 +345,9 @@ class AgentService:
                            user_message: Optional[str]):
         """处理LLM响应"""
         chat_config = agent.build_chat_configuration(user_message, self.chat_service_type)
-        logger.debug(chat_config)
+        config_for_logging = chat_config.copy()
+        config_for_logging['messages'] = config_for_logging['messages'][-20:]
+        logger.debug(config_for_logging)
         chat_response = self._call_chat_api(chat_config, self.chat_service_type)
         chat_response = self.sanitize_response(chat_response)