2323from common .constants .authentication_type import AuthenticationType
2424from common .constants .permission_constants import Permission , Group , Operate , \
2525 RoleConstants , ViewPermission , CompareConstants
26+ from common .log .log import log
2627from common .response import result
2728from common .util .common import query_params_to_single_dict
2829from dataset .serializers .file_serializers import FileSerializer
@@ -177,6 +178,7 @@ class Operate(APIView):
177178 dynamic_tag = keywords .get ('application_id' ))],
178179 compare = CompareConstants .AND ),
179180 compare = CompareConstants .AND )
181+ @log (menu = 'Application/Conversation Log' , operate = "Delete a conversation" )
180182 def delete (self , request : Request , application_id : str , chat_id : str ):
181183 return result .success (
182184 ChatSerializers .Operate (
@@ -199,6 +201,7 @@ class ClientChatHistoryPage(APIView):
199201 [lambda r , keywords : Permission (group = Group .APPLICATION , operate = Operate .USE ,
200202 dynamic_tag = keywords .get ('application_id' ))])
201203 )
204+ @log (menu = 'Application/Conversation Log' , operate = "Get client conversation list by paging" )
202205 def get (self , request : Request , application_id : str , current_page : int , page_size : int ):
203206 return result .success (ChatSerializers .ClientChatHistory (
204207 data = {'client_id' : request .auth .client_id , 'application_id' : application_id }).page (
@@ -218,6 +221,7 @@ class Operate(APIView):
218221 dynamic_tag = keywords .get ('application_id' ))],
219222 compare = CompareConstants .AND ),
220223 compare = CompareConstants .AND )
224+ @log (menu = 'Application/Conversation Log' , operate = "Client deletes conversation" )
221225 def delete (self , request : Request , application_id : str , chat_id : str ):
222226 return result .success (
223227 ChatSerializers .Operate (
@@ -235,6 +239,7 @@ def delete(self, request: Request, application_id: str, chat_id: str):
235239 dynamic_tag = keywords .get ('application_id' ))],
236240 compare = CompareConstants .AND ),
237241 compare = CompareConstants .AND )
242+ @log (menu = 'Application/Conversation Log' , operate = "Client modifies dialogue summary" )
238243 def put (self , request : Request , application_id : str , chat_id : str ):
239244 return result .success (
240245 ChatSerializers .Operate (
@@ -256,6 +261,7 @@ class Page(APIView):
256261 [lambda r , keywords : Permission (group = Group .APPLICATION , operate = Operate .USE ,
257262 dynamic_tag = keywords .get ('application_id' ))])
258263 )
264+ @log (menu = 'Application/Conversation Log' , operate = "Get the conversation list by page" )
259265 def get (self , request : Request , application_id : str , current_page : int , page_size : int ):
260266 return result .success (ChatSerializers .Query (
261267 data = {** query_params_to_single_dict (request .query_params ), 'application_id' : application_id ,
@@ -281,6 +287,7 @@ class Operate(APIView):
281287 [lambda r , keywords : Permission (group = Group .APPLICATION , operate = Operate .USE ,
282288 dynamic_tag = keywords .get ('application_id' ))])
283289 )
290+ @log (menu = 'Application/Conversation Log' , operate = "Get conversation record details" )
284291 def get (self , request : Request , application_id : str , chat_id : str , chat_record_id : str ):
285292 return result .success (ChatRecordSerializer .Operate (
286293 data = {'application_id' : application_id ,
@@ -299,6 +306,7 @@ def get(self, request: Request, application_id: str, chat_id: str, chat_record_i
299306 [lambda r , keywords : Permission (group = Group .APPLICATION , operate = Operate .USE ,
300307 dynamic_tag = keywords .get ('application_id' ))])
301308 )
309+ @log (menu = 'Application/Conversation Log' , operate = "Get a list of conversation records" )
302310 def get (self , request : Request , application_id : str , chat_id : str ):
303311 return result .success (ChatRecordSerializer .Query (
304312 data = {'application_id' : application_id ,
@@ -320,6 +328,7 @@ class Page(APIView):
320328 [lambda r , keywords : Permission (group = Group .APPLICATION , operate = Operate .USE ,
321329 dynamic_tag = keywords .get ('application_id' ))])
322330 )
331+ @log (menu = 'Application/Conversation Log' , operate = "Get the conversation history list by page" )
323332 def get (self , request : Request , application_id : str , chat_id : str , current_page : int , page_size : int ):
324333 return result .success (ChatRecordSerializer .Query (
325334 data = {'application_id' : application_id ,
@@ -343,6 +352,7 @@ class Vote(APIView):
343352 [lambda r , keywords : Permission (group = Group .APPLICATION , operate = Operate .USE ,
344353 dynamic_tag = keywords .get ('application_id' ))])
345354 )
355+ @log (menu = 'Application/Conversation Log' , operate = "Like, Dislike" )
346356 def put (self , request : Request , application_id : str , chat_id : str , chat_record_id : str ):
347357 return result .success (ChatRecordSerializer .Vote (
348358 data = {'vote_status' : request .data .get ('vote_status' ), 'chat_id' : chat_id ,
@@ -363,6 +373,7 @@ class ChatRecordImprove(APIView):
363373 [lambda r , keywords : Permission (group = Group .APPLICATION , operate = Operate .USE ,
364374 dynamic_tag = keywords .get ('application_id' ))]
365375 ))
376+ @log (menu = 'Application/Conversation Log' , operate = "Get the list of marked paragraphs" )
366377 def get (self , request : Request , application_id : str , chat_id : str , chat_record_id : str ):
367378 return result .success (ChatRecordSerializer .ChatRecordImprove (
368379 data = {'chat_id' : chat_id , 'chat_record_id' : chat_record_id }).get ())
@@ -390,6 +401,7 @@ class Improve(APIView):
390401 'dataset_id' ))],
391402 compare = CompareConstants .AND
392403 ), compare = CompareConstants .AND )
404+ @log (menu = 'Application/Conversation Log' , operate = "Annotation" )
393405 def put (self , request : Request , application_id : str , chat_id : str , chat_record_id : str , dataset_id : str ,
394406 document_id : str ):
395407 return result .success (ChatRecordSerializer .Improve (
@@ -415,6 +427,7 @@ def put(self, request: Request, application_id: str, chat_id: str, chat_record_i
415427 'dataset_id' ))],
416428 compare = CompareConstants .AND
417429 ), compare = CompareConstants .AND )
430+ @log (menu = 'Application/Conversation Log' , operate = "Add to Knowledge Base" )
418431 def post (self , request : Request , application_id : str , dataset_id : str ):
419432 return result .success (ChatRecordSerializer .PostImprove ().post_improve (request .data ))
420433
@@ -440,6 +453,7 @@ class Operate(APIView):
440453 'dataset_id' ))],
441454 compare = CompareConstants .AND
442455 ), compare = CompareConstants .AND )
456+ @log (menu = 'Application/Conversation Log' , operate = "Delete a Annotation" )
443457 def delete (self , request : Request , application_id : str , chat_id : str , chat_record_id : str ,
444458 dataset_id : str ,
445459 document_id : str , paragraph_id : str ):
0 commit comments