@@ -65,7 +65,7 @@ def event_content(response,
6565 message_list : List [BaseMessage ],
6666 problem_text : str ,
6767 padding_problem_text : str = None ,
68- client_id = None , client_type = None ,
68+ chat_user_id = None , chat_user_type = None ,
6969 is_ai_chat : bool = None ,
7070 model_setting = None ):
7171 if model_setting is None :
@@ -134,14 +134,16 @@ def event_content(response,
134134 request_token , response_token ,
135135 {'node_is_end' : True , 'view_type' : 'many_view' ,
136136 'node_type' : 'ai-chat-node' })
137- add_access_num (client_id , client_type , manage .context .get ('application_id' ))
137+ if not manage .debug :
138+ add_access_num (chat_user_id , chat_user_type , manage .context .get ('application_id' ))
138139 except Exception as e :
139140 maxkb_logger .error (f'{ str (e )} :{ traceback .format_exc ()} ' )
140141 all_text = 'Exception:' + str (e )
141142 write_context (step , manage , 0 , 0 , all_text )
142143 post_response_handler .handler (chat_id , chat_record_id , paragraph_list , problem_text ,
143144 all_text , manage , step , padding_problem_text , reasoning_content = '' )
144- add_access_num (client_id , client_type , manage .context .get ('application_id' ))
145+ if not manage .debug :
146+ add_access_num (chat_user_id , chat_user_type , manage .context .get ('application_id' ))
145147 yield manage .get_base_to_response ().to_stream_chunk_response (chat_id , str (chat_record_id ), 'ai-chat-node' ,
146148 [], all_text ,
147149 False ,
@@ -281,7 +283,7 @@ def execute_block(self, message_list: List[BaseMessage],
281283 paragraph_list = None ,
282284 manage : PipelineManage = None ,
283285 padding_problem_text : str = None ,
284- client_id = None , client_type = None , no_references_setting = None ,
286+ chat_user_id = None , chat_user_type = None , no_references_setting = None ,
285287 model_setting = None ):
286288 reasoning_content_enable = model_setting .get ('reasoning_content_enable' , False )
287289 reasoning_content_start = model_setting .get ('reasoning_content_start' , '<think>' )
@@ -311,7 +313,8 @@ def execute_block(self, message_list: List[BaseMessage],
311313 post_response_handler .handler (chat_id , chat_record_id , paragraph_list , problem_text ,
312314 content , manage , self , padding_problem_text ,
313315 reasoning_content = reasoning_content )
314- add_access_num (client_id , client_type , manage .context .get ('application_id' ))
316+ if not manage .debug :
317+ add_access_num (chat_user_id , chat_user_type , manage .context .get ('application_id' ))
315318 return manage .get_base_to_response ().to_block_response (str (chat_id ), str (chat_record_id ),
316319 content , True ,
317320 request_token , response_token ,
@@ -326,6 +329,7 @@ def execute_block(self, message_list: List[BaseMessage],
326329 write_context (self , manage , 0 , 0 , all_text )
327330 post_response_handler .handler (chat_id , chat_record_id , paragraph_list , problem_text ,
328331 all_text , manage , self , padding_problem_text , reasoning_content = '' )
329- add_access_num (client_id , client_type , manage .context .get ('application_id' ))
332+ if not manage .debug :
333+ add_access_num (chat_user_id , chat_user_type , manage .context .get ('application_id' ))
330334 return manage .get_base_to_response ().to_block_response (str (chat_id ), str (chat_record_id ), all_text , True , 0 ,
331335 0 , _status = status .HTTP_500_INTERNAL_SERVER_ERROR )
0 commit comments