File size: 14,467 Bytes
5221213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
{% extends "base.html" %}
{% block content %}
<div class="chat-container">
    <!-- Header -->
    <div class="chat-header">
        <div class="header-content">
            <div class="logo">
                <svg width="32" height="32" viewBox="0 0 40 40">
                    <circle cx="20" cy="20" r="18" fill="#ff7f50"/>
                    <text x="15" y="28" fill="white" font-size="20">J</text>
                </svg>
            </div>
            <h1>Jupiter AI Assistant</h1>
        </div>
    </div>

    <!-- Main Content -->
    <div class="main-content">
       <!-- Updated Categories Sidebar with Questions from Provided Data Only -->
<div class="categories-sidebar">
    <h2>πŸ“š Quick Topics</h2>
    <div class="categories-accordion">
        <!-- Account & KYC -->
        <div class="category-item">
            <div class="category-header" onclick="toggleCategory(this)">
                <span>🏦 Account & KYC</span>
                <svg class="arrow-icon" viewBox="0 0 24 24">
                    <path d="M7 10l5 5 5-5z"/>
                </svg>
            </div>
            <div class="category-content">
                <button onclick="askQuestion('What is the Jupiter All-in-1 Savings Account?')">All-in-1 Savings Account</button>
                <button onclick="askQuestion('How do I open a Jupiter Savings Account?')">Open Jupiter Account</button>
                <button onclick="askQuestion('What additional benefits do I get with the Savings Account?')">Savings Account Benefits</button>
                <button onclick="askQuestion('How do I open a Salary account?')">Open Salary Account</button>
                <button onclick="askQuestion('Which documents are required for opening a Salary account?')">Documents for Salary Account</button>
                <button onclick="askQuestion('What is the initial deposit when you open a Salary Account?')">Initial Deposit Required</button>
            </div>
        </div>

        <!-- Payments & UPI -->
        <div class="category-item">
            <div class="category-header" onclick="toggleCategory(this)">
                <span>πŸ’Έ Payments & UPI</span>
                <svg class="arrow-icon" viewBox="0 0 24 24">
                    <path d="M7 10l5 5 5-5z"/>
                </svg>
            </div>
            <div class="category-content">
                <button onclick="askQuestion('What payment methods does Jupiter support?')">Payment Methods</button>
                <button onclick="askQuestion('Is there a transaction limit for UPI payments?')">UPI Transaction Limits</button>
                <button onclick="askQuestion('Are there any charges for UPI transactions?')">UPI Transaction Charges</button>
                <button onclick="askQuestion('What is UPI Lite and how does it work?')">UPI Lite Feature</button>
                <button onclick="askQuestion('Can I send money to contacts using other UPI apps?')">Send to Other UPI Apps</button>
                <button onclick="askQuestion('What types of bills can I pay on Jupiter?')">Bill Payment Types</button>
            </div>
        </div>

        <!-- Cards -->
        <div class="category-item">
            <div class="category-header" onclick="toggleCategory(this)">
                <span>πŸ’³ Cards</span>
                <svg class="arrow-icon" viewBox="0 0 24 24">
                    <path d="M7 10l5 5 5-5z"/>
                </svg>
            </div>
            <div class="category-content">
                <button onclick="askQuestion('How can I apply for the Edge+ CSB Bank RuPay Credit Card?')">Apply for Edge+ Card</button>
                <button onclick="askQuestion('What is the maximum cashback I can earn for each category?')">Maximum Cashback Limits</button>
                <button onclick="askQuestion('Are there any fees for the Edge+ card?')">Edge+ Card Fees</button>
                <button onclick="askQuestion('Can I use my Jupiter Debit Card outside India?')">International Debit Card Usage</button>
                <button onclick="askQuestion('How to activate Edge Federal Bank Visa Credit Card?')">Activate Visa Card</button>
                <button onclick="askQuestion('Is Edge Federal Bank Visa Credit Card lifetime free?')">Lifetime Free Card</button>
            </div>
        </div>

        <!-- Rewards & Jewels -->
        <div class="category-item">
            <div class="category-header" onclick="toggleCategory(this)">
                <span>πŸ’Ž Rewards & Jewels</span>
                <svg class="arrow-icon" viewBox="0 0 24 24">
                    <path d="M7 10l5 5 5-5z"/>
                </svg>
            </div>
            <div class="category-content">
                <button onclick="askQuestion('Do I earn Jewels for making payments?')">Earn Jewels on Payments</button>
                <button onclick="askQuestion('How do I earn Jewels on Jupiter?')">How to Earn Jewels</button>
                <button onclick="askQuestion('What can I redeem Jewels for?')">Redeem Jewels Options</button>
                <button onclick="askQuestion('How fast can I redeem Jewels on Jupiter?')">Instant Jewels Redemption</button>
                <button onclick="askQuestion('Do the earned Jewels expire?')">Jewels Expiry Policy</button>
                <button onclick="askQuestion('Do I earn Jewels on International payments?')">International Payment Rewards</button>
            </div>
        </div>

        <!-- Investments -->
        <div class="category-item">
            <div class="category-header" onclick="toggleCategory(this)">
                <span>πŸ“ˆ Investments</span>
                <svg class="arrow-icon" viewBox="0 0 24 24">
                    <path d="M7 10l5 5 5-5z"/>
                </svg>
            </div>
            <div class="category-content">
                <button onclick="askQuestion('What investment options are available on Jupiter?')">Investment Options</button>
                <button onclick="askQuestion('What is Magic Spends and how does it work?')">Magic Spends Feature</button>
                <button onclick="askQuestion('Can I invest using my Jupiter account?')">Invest with Jupiter</button>
                <button onclick="askQuestion('What is Digital Gold on Jupiter?')">Digital Gold Investment</button>
                <button onclick="askQuestion('Can I start investing in Gold with just β‚Ή10?')">β‚Ή10 Gold Investment</button>
                <button onclick="askQuestion('How do No-Penalty SIPs work on Jupiter?')">No-Penalty SIPs</button>
            </div>
        </div>

        <!-- Loans -->
        <div class="category-item">
            <div class="category-header" onclick="toggleCategory(this)">
                <span>πŸ’° Loans</span>
                <svg class="arrow-icon" viewBox="0 0 24 24">
                    <path d="M7 10l5 5 5-5z"/>
                </svg>
            </div>
            <div class="category-content">
                <button onclick="askQuestion('What types of loans can I get on Jupiter?')">Available Loan Types</button>
                <button onclick="askQuestion('What are the interest rates applicable on loans with Jupiter?')">Loan Interest Rates</button>
                <button onclick="askQuestion('What is a loan against mutual funds?')">Loan Against Mutual Funds</button>
                <button onclick="askQuestion('Who can apply for a Personal Loan on Jupiter?')">Personal Loan Eligibility</button>
                <button onclick="askQuestion('What is Mini-Loan?')">About Mini-Loan</button>
                <button onclick="askQuestion('Will I get reminders for my EMI payments?')">EMI Payment Reminders</button>
            </div>
        </div>

        <!-- Money Management -->
        <div class="category-item">
            <div class="category-header" onclick="toggleCategory(this)">
                <span>πŸ“Š Money Management</span>
                <svg class="arrow-icon" viewBox="0 0 24 24">
                    <path d="M7 10l5 5 5-5z"/>
                </svg>
            </div>
            <div class="category-content">
                <button onclick="askQuestion('What can I do in the Money tab on Jupiter?')">Money Tab Features</button>
                <button onclick="askQuestion('How does Jupiter categorize my spending?')">Spending Categories</button>
                <button onclick="askQuestion('Can I set Budgets in the Money tab?')">Set Monthly Budgets</button>
                <button onclick="askQuestion('What is Account Aggregator and how does it work?')">Account Aggregator</button>
                <button onclick="askQuestion('What is Net Worth in Jupiter and how is it calculated?')">Net Worth Tracker</button>
                <button onclick="askQuestion('Can I track my credit card expenses in the Money tab?')">Track Credit Card Expenses</button>
            </div>
        </div>
    </div>
</div>

        <!-- Chat Section -->
        <div class="chat-section">
            <div class="chat-messages" id="chat-messages">
                <div class="message system">
                    <div class="message-content">
                        <div class="welcome-message">
                            <h3>πŸ‘‹ Welcome to Jupiter!</h3>
                            <p>I'm here to help you with any questions about Jupiter's services. Choose a category from the sidebar or ask me anything!</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="chat-input-container">
                <form class="chat-input-form" onsubmit="sendMessage(event)">
                    <input type="text" id="user-input" placeholder="Ask me anything about Jupiter..." required>
                    <button type="submit">
                        <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor">
                            <path d="M22 2L11 13"></path>
                            <path d="M22 2L15 22L11 13L2 9L22 2Z"></path>
                        </svg>
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>

<script>

function toggleCategory(header) {

    const categoryItem = header.parentElement;

    const wasActive = categoryItem.classList.contains('active');

    

    // Close all categories

    document.querySelectorAll('.category-item').forEach(item => {

        item.classList.remove('active');

    });

    

    // Open clicked category if it wasn't active

    if (!wasActive) {

        categoryItem.classList.add('active');

    }

}



function formatMessage(text) {

    if (text.includes("β€’")) {

        const parts = text.split("β€’");

        let formattedText = parts[0];

        if (parts.length > 1) {

            formattedText += '<ul class="response-list">';

            for (let i = 1; i < parts.length; i++) {

                if (parts[i].trim()) {

                    formattedText += `<li>${parts[i].trim()}</li>`;

                }

            }

            formattedText += '</ul>';

        }

        return formattedText;

    }

    return text;

}



function addSuggestions(suggestions) {

    if (!suggestions || suggestions.length === 0) return;

    

    const suggestionsDiv = document.createElement('div');

    suggestionsDiv.className = 'suggestions';

    suggestionsDiv.innerHTML = '<p>You might also want to know:</p>';

    

    const buttonsContainer = document.createElement('div');

    buttonsContainer.className = 'suggestion-buttons';

    

    suggestions.forEach(suggestion => {

        const btn = document.createElement('button');

        btn.className = 'suggestion-btn';

        btn.innerHTML = `<span>${suggestion}</span>`;

        btn.onclick = () => askQuestion(suggestion);

        buttonsContainer.appendChild(btn);

    });

    

    suggestionsDiv.appendChild(buttonsContainer);

    document.getElementById('chat-messages').appendChild(suggestionsDiv);

}



function askQuestion(question) {

    document.getElementById('user-input').value = question;

    document.querySelector('.chat-input-form').dispatchEvent(new Event('submit'));

}



function sendMessage(event) {

    event.preventDefault();

    

    const input = document.getElementById('user-input');

    const messages = document.getElementById('chat-messages');

    

    // Add user message

    const userMessage = document.createElement('div');

    userMessage.className = 'message user';

    userMessage.innerHTML = `<div class="message-content">${input.value}</div>`;

    messages.appendChild(userMessage);

    

    // Add loading message

    const loadingMessage = document.createElement('div');

    loadingMessage.className = 'message system loading';

    loadingMessage.innerHTML = `

        <div class="message-content">

            <div class="typing-indicator">

                <span></span><span></span><span></span>

            </div>

        </div>

    `;

    messages.appendChild(loadingMessage);

    

    // Scroll to bottom

    messages.scrollTop = messages.scrollHeight;

    

    // Send request to server

    fetch('/chat', {

        method: 'POST',

        headers: {

            'Content-Type': 'application/json',

        },

        body: JSON.stringify({

            question: input.value

        })

    })

    .then(response => response.json())

    .then(data => {

        // Remove loading message

        messages.removeChild(loadingMessage);

        

        // Add bot response

        const botMessage = document.createElement('div');

        botMessage.className = 'message system';

        botMessage.innerHTML = `<div class="message-content">${formatMessage(data.response)}</div>`;

        messages.appendChild(botMessage);

        

        // Add suggestions if any

        if (data.suggestions) {

            addSuggestions(data.suggestions);

        }

        

        // Clear input and scroll

        input.value = '';

        messages.scrollTop = messages.scrollHeight;

    })

    .catch(error => {

        console.error('Error:', error);

        loadingMessage.innerHTML = '<div class="message-content error">Sorry, something went wrong. Please try again.</div>';

    });

}

</script>
{% endblock %}