[Answered ]-Empty Chatterbot Conversation table in Django Admin

2👍

When you start the conversation interface then bot will start recording all your conversations into DB.

If you look into source code of chatterbot, if conversations are exists in DB then the conversation will append into existing conversation, else it will create a new identifier

    conversation.id = request.session.get('conversation_id', 0)
    existing_conversation = False
    try:
        Conversation.objects.get(id=conversation.id)
        existing_conversation = True

    except Conversation.DoesNotExist:
        conversation_id = self.chatterbot.storage.create_conversation()
        request.session['conversation_id'] = conversation_id
        conversation.id = conversation_id

    if existing_conversation:
        responses = Response.objects.filter(
            conversations__id=conversation.id
        )

        for response in responses:
            conversation.statements.append(response.statement.serialize())
            conversation.statements.append(response.response.serialize())

    return conversation

A sample Django chatterbot ADMIN page of conversations

enter image description here

Let me know if you need any further help on this.

Leave a comment