Ai chatbot in django using WitAI is only answering “There was an error processing you’re request” to every question How do i fix that

I’m developing a chatbot using the Wit.ai API in a Django application. The chatbot interface is implemented in HTML and JavaScript. The bot is designed to take user input, send it to the Wit.ai API, and display the response. However, every time I send a message, the bot replies with “There was an error processing your request.”

I’ve double-checked the Wit.ai API call, and it seems to be correct. I suspect that the issue might be with how the response is handled or an issue with the authorization token. Below is the code for my HTML and JavaScript implementation:
(Please don’t use this code i’ve worked really hard on this)

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Intra AI Chatbot</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: linear-gradient(to bottom right, #4a00e0, #8e2de2, #4a00e0);
            color: #fff;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh; /* Ensure full viewport height */
            overflow: hidden; /* Hide overflow for shapes outside viewport */
            position: relative; /* Set position to relative for absolute positioning of shapes */
        }

        /* Animation keyframes */
        @keyframes moveCircleUpDown {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-20px); }
        }
        @keyframes moveCircleLeftRight {
            0%, 100% { transform: translateX(0); }
            50% { transform: translateX(-20px); }
        }

        /* Circle animation */
        .circle {
            position: absolute;
            border-radius: 50%;
            animation-duration: 5s;
            animation-timing-function: ease-in-out;
            animation-iteration-count: infinite;
        }

        /* Different circle classes with different sizes and colors */
        .circle1 { width: 40px; height: 40px; background-color: rgba(255, 255, 255, 0.3); animation-name: moveCircleUpDown; }
        .circle2 { width: 20px; height: 20px; background-color: rgba(255, 255, 255, 0.5); animation-name: moveCircleLeftRight; }
        .circle3 { width: 30px; height: 30px; background-color: rgba(255, 255, 255, 0.7); animation-name: moveCircleUpDown; }
        .circle4 { width: 25px; height: 25px; background-color: rgba(255, 255, 255, 0.4); animation-name: moveCircleLeftRight; }
        .circle5 { width: 35px; height: 35px; background-color: rgba(255, 255, 255, 0.6); animation-name: moveCircleUpDown; }
        .circle6 { width: 15px; height: 15px; background-color: rgba(255, 255, 255, 0.8); animation-name: moveCircleLeftRight; }
        .circle7 { width: 45px; height: 45px; background-color: rgba(255, 255, 255, 0.5); animation-name: moveCircleUpDown; }
        .circle8 { width: 20px; height: 20px; background-color: rgba(255, 255, 255, 0.3); animation-name: moveCircleLeftRight; }

        /* Chatbot container styles */
        .container {
            width: 80%;
            max-width: 800px;
            padding: 20px;
            text-align: center;
            margin-top: 20px; /* Add margin to the top */
            margin-bottom: 20px; /* Add margin to the bottom */
            position: relative; /* Set position to relative for z-index */
            z-index: 1; /* Ensure chatbot container is above circles */
        }

        h1 {
            font-size: 36px;
            margin-bottom: 20px; /* Add some space below the title */
            margin-top: 0; /* Reset top margin */
        }

        #chat-container {
            background-color: rgba(0, 0, 0, 0.5);
            padding: 20px;
            border-radius: 10px;
            margin-top: 10px; /* Move the chat container slightly down */
            margin-bottom: 20px; /* Add some space below the chat container */
            max-height: 60vh; /* Limit chat container height */
            overflow-y: auto;
            word-wrap: break-word; /* Ensure long words break to the next line */
        }

        .message-container {
            display: flex;
            justify-content: flex-end; /* Align user messages to the right */
            margin-bottom: 10px;
        }

        .user-message, .bot-message {
            border-radius: 10px;
            padding: 10px;
            max-width: 80%; /* Limit message width to 80% of container */
            word-wrap: break-word; /* Ensure long words break to the next line */
        }

        .user-message {
            background-color: #6a00f4;
            color: #fff;
            margin-left: auto; /* Align user messages to the right */
            margin-right: 10px; /* Add space between user and bot messages */
            animation: slideInRight 0.5s ease-out; /* Slide-in animation */
        }

        .bot-message {
            background-color: #5200c7;
            color: #fff;
            margin-right: auto; /* Align bot messages to the left */
            margin-left: 10px; /* Add space between user and bot messages */
            animation: slideInLeft 0.5s ease-out; /* Slide-in animation */
        }

        #user-input {
            width: calc(100% - 40px);
            padding: 10px;
            margin-top: 10px; /* Move the input placeholder down */
            margin-bottom: 10px; /* Add margin to the bottom of the input */
            border: none;
            border-radius: 5px;
            background-color: rgba(255, 255, 255, 0.2);
            color: #fff;
            outline: none;
        }

        #submit-btn {
            padding: 10px 20px;
            background-color: #6a00f4;
            border: none;
            border-radius: 5px;
            color: #fff;
            cursor: pointer;
            transition: background-color 0.3s ease; /* Smooth transition */
        }

        #submit-btn:hover {
            background-color: #5200c7;
        }
    </style>
</head>
<body>
    <!-- Animated circles -->
    <div class="circle circle1" style="top: 5%; left: 5%;"></div>
    <div class="circle circle2" style="top: 5%; left: 85%;"></div>
    <div class="circle circle3" style="top: 85%; left: 5%;"></div>
    <div class="circle circle4" style="top: 85%; left: 85%;"></div>
    <div class="circle circle5" style="top: 20%; left: 45%;"></div>
    <div class="circle circle6" style="top: 45%; left: 20%;"></div>
    <div class="circle circle7" style="top: 45%; left: 70%;"></div>
    <div class="circle circle8" style="top: 70%; left: 45%;"></div>

    <!-- Chatbot container -->
    <div class="container">
        <h1>IntraAI</h1>
        <div id="chat-container">
            <!-- Chat messages will appear here -->
        </div>
        <input type="text" id="user-input" placeholder="Type your message...">
        <button id="submit-btn">Send</button>
    </div>


    <script>
        document.addEventListener("DOMContentLoaded", function(event) {
            const chatContainer = document.getElementById('chat-container');
            const userInput = document.getElementById('user-input');
            const submitBtn = document.getElementById('submit-btn');

            submitBtn.addEventListener('click', sendMessage);
            userInput.addEventListener('keypress', function(event) {
                if (event.key === 'Enter') {
                    sendMessage();
                }
            });

            function sendMessage() {
                const userMessage = userInput.value.trim();
                if (userMessage) {
                    appendUserMessage(userMessage);
                    sendUserMessageToWit(userMessage);
                    userInput.value = ''; // Clear the input field
                }
            }

            function appendUserMessage(message) {
                const messageContainer = document.createElement('div');
                messageContainer.classList.add('message-container');
                const userMessageElement = document.createElement('div');
                userMessageElement.classList.add('user-message');
                userMessageElement.textContent = message;
                messageContainer.appendChild(userMessageElement);
                chatContainer.appendChild(messageContainer);
                chatContainer.scrollTop = chatContainer.scrollHeight; // Scroll to bottom
            }

            function appendBotMessage(message) {
                const messageContainer = document.createElement('div');
                messageContainer.classList.add('message-container');
                const botMessageElement = document.createElement('div');
                botMessageElement.classList.add('bot-message');
                botMessageElement.textContent = message;
                messageContainer.appendChild(botMessageElement);
                chatContainer.appendChild(messageContainer);
                chatContainer.scrollTop = chatContainer.scrollHeight; // Scroll to bottom
            }


            async function sendUserMessageToWit(userMessage) {
                const accessToken = 'my access token';
                try {
                    const response = await fetch(`https://api.wit.ai/message?v=20200513&q=${encodeURIComponent(userMessage)}`, {
                        headers: {
                            'Authorization': `Bearer ${accessToken}`
                        }
                        
                    });
                    const data = await response.json();
                    const botResponse = data.entities && data.entities['wit$sentiment'] && data.entities['wit$sentiment'][0].value
                        ? `Sentiment: ${data.entities['wit$sentiment'][0].value}`
                        : (data.text || "Sorry, I didn't understand that."); // Extract the bot response
                    appendBotMessage(botResponse); // Append the bot response
                } catch (error) {
                    appendBotMessage("There was an error processing your request.");
                    console.error('Error:', error);
                }
            }
        });
    </script>
</body>
</html>```





PLEASE DON'T USE THIS CODE!!





plz help i have provided all the info i have and plz as soon as possible i need to finish this quick.                The bot is not answering the questions its only saying there was an error processing your request.
I have tried all the youtube tutorials and even the ones on there website but i cant find anything i have even asked chatgpt Gemini and other AIs. hellllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me .help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me. help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me. help me help me help me help me  me help me help me help me help me help me help me help me help me help mehelp me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me help me.details 

New contributor

Ahmed Asif is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật