瀏覽代碼

fix: internal error when user is none in service api call (#129)

John Wang 1 年之前
父節點
當前提交
b42cd38cc9
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      api/core/conversation_message_task.py

+ 3 - 0
api/core/conversation_message_task.py

@@ -281,6 +281,9 @@ class PubHandler:
 
     @classmethod
     def generate_channel_name(cls, user: Union[Account | EndUser], task_id: str):
+        if not user:
+            raise ValueError("user is required")
+
         user_str = 'account-' + user.id if isinstance(user, Account) else 'end-user-' + user.id
         return "generate_result:{}-{}".format(user_str, task_id)