コード例 #1
0
ファイル: history.py プロジェクト: sushantpatade/kairon
async def count_engaged_users(month: HistoryMonth = 1, current_user: User = Depends(auth.get_current_user)):

    """
    Fetches the number of engaged users of the bot
    """
    engaged_user_count, message = ChatHistory.engaged_users(
        current_user.get_bot(), month
    )
    return {"data": engaged_user_count, "message": message}
コード例 #2
0
ファイル: history.py プロジェクト: siddbane10/kairon
async def count_engaged_users(request: ConversationFilter = ConversationFilter(), current_user: User = Depends(auth.get_current_user_and_bot)):

    """
    Fetches the number of engaged users of the bot
    """
    engaged_user_count, message = ChatHistory.engaged_users(
        current_user.get_bot(), request.month, request.engaged_users_threshold
    )
    return {"data": engaged_user_count, "message": message}
コード例 #3
0
ファイル: history_test.py プロジェクト: siddbane10/kairon
 def test_engaged_users(self, mock_mongo_client):
     engaged_user, message = ChatHistory.engaged_users("tests")
     assert engaged_user['engaged_users'] == 0
     assert message is None
コード例 #4
0
ファイル: history_test.py プロジェクト: siddbane10/kairon
 def test_engaged_users_error(self, mock_mongo_processor):
     with pytest.raises(Exception):
         engaged_user, message = ChatHistory.engaged_users("tests")
         assert not engaged_user
         assert message is None