|
|
|
|
@ -145,7 +145,20 @@ class ConversationService:
|
|
|
|
|
return conversation
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def get_conversation(cls, app_model: App, conversation_id: str, user: Optional[Union[Account, EndUser]]):
|
|
|
|
|
def get_conversation(cls, app_model: App, conversation_id: str, user: Optional[Union[Account, EndUser]], invoke_from: InvokeFrom = None):
|
|
|
|
|
if invoke_from and invoke_from == InvokeFrom.SERVICE_API:
|
|
|
|
|
conversation = (
|
|
|
|
|
db.session.query(Conversation)
|
|
|
|
|
.filter(
|
|
|
|
|
Conversation.id == conversation_id,
|
|
|
|
|
Conversation.app_id == app_model.id,
|
|
|
|
|
Conversation.from_source == "api",
|
|
|
|
|
Conversation.from_end_user_id == user.id ,
|
|
|
|
|
Conversation.is_deleted == False,
|
|
|
|
|
)
|
|
|
|
|
.first()
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
conversation = (
|
|
|
|
|
db.session.query(Conversation)
|
|
|
|
|
.filter(
|
|
|
|
|
|