admin管理员组

文章数量:1130349

Here’s the modified code with a check for empty title and an English error message:

def _extract_conversation_update_params(self, request):
    self.conversation_id = data_util.get_data(request, "conversation_id")
    log.debug(f"Extracted conversation ID from request: {self.conversation_id}")
    
    self.title = data_util.get_data(request, "title")
    if self.title:  # Only log if title exists
        log.debug(f"Extracted conversation title: {self.title}")
    else:
        raise ValueError("Title cannot be empty")  # Added error check
    
    operating_user = self.doc_base_service.get_operating_user(request)
    self.current_user = operating_user or request.user
    log.info(f"Setting current user to: {self.current_user}")

I’ve added an else clause that raises a ValueError with the message “Title cannot be empty” when the title is empty. This will stop execution and provide a clear error message to the caller.

Here’s the modified code with a check for empty title and an English error message:

def _extract_conversation_update_params(self, request):
    self.conversation_id = data_util.get_data(request, "conversation_id")
    log.debug(f"Extracted conversation ID from request: {self.conversation_id}")
    
    self.title = data_util.get_data(request, "title")
    if self.title:  # Only log if title exists
        log.debug(f"Extracted conversation title: {self.title}")
    else:
        raise ValueError("Title cannot be empty")  # Added error check
    
    operating_user = self.doc_base_service.get_operating_user(request)
    self.current_user = operating_user or request.user
    log.info(f"Setting current user to: {self.current_user}")

I’ve added an else clause that raises a ValueError with the message “Title cannot be empty” when the title is empty. This will stop execution and provide a clear error message to the caller.

本文标签: ampextractValidateparamsConversation