Add 1 files
Browse files- index.html +333 -141
index.html
CHANGED
@@ -33,6 +33,14 @@
|
|
33 |
color: #3b82f6;
|
34 |
font-weight: 600;
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
</style>
|
37 |
</head>
|
38 |
<body class="bg-gray-50 min-h-screen">
|
@@ -88,7 +96,7 @@
|
|
88 |
</div>
|
89 |
|
90 |
<div>
|
91 |
-
<h2 class="text-xl font-semibold mb-4 text-gray-800">RAG &
|
92 |
|
93 |
<div class="mb-4">
|
94 |
<label class="block text-gray-700 mb-2">Import External Data</label>
|
@@ -103,30 +111,25 @@
|
|
103 |
</div>
|
104 |
|
105 |
<div class="mb-4">
|
106 |
-
<label class="block text-gray-700 mb-2">
|
107 |
-
<
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
</div>
|
118 |
-
<div id="apiStatus" class="mt-2 text-sm flex items-center hidden">
|
119 |
-
<span class="w-3 h-3 rounded-full mr-2"></span>
|
120 |
-
<span>API Status</span>
|
121 |
-
</div>
|
122 |
</div>
|
123 |
|
124 |
-
<div class="bg-blue-50 p-4 rounded-lg">
|
125 |
<h3 class="font-semibold text-blue-800 mb-2 flex items-center">
|
126 |
<i class="fas fa-info-circle mr-2"></i> Generation Process
|
127 |
</h3>
|
128 |
<p class="text-sm text-blue-700">
|
129 |
-
Questions are generated using DeepSeek's AI model. For large batches, multiple API calls will be made automatically. Each question is categorized and checked for quality.
|
130 |
</p>
|
131 |
</div>
|
132 |
</div>
|
@@ -147,17 +150,17 @@
|
|
147 |
</div>
|
148 |
|
149 |
<div class="border-b border-gray-200 mb-4">
|
150 |
-
<div class="flex space-x-6">
|
151 |
-
<button data-tab="all" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">All</button>
|
152 |
-
<button data-tab="deposit" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Deposit</button>
|
153 |
-
<button data-tab="transfer" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Transfer</button>
|
154 |
-
<button data-tab="withdrawal" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Withdrawal</button>
|
155 |
-
<button data-tab="security" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Security</button>
|
156 |
-
<button data-tab="payment" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Payment</button>
|
157 |
-
<button data-tab="card" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Card</button>
|
158 |
-
<button data-tab="billing" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Billing</button>
|
159 |
-
<button data-tab="basic" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Basic</button>
|
160 |
-
<button data-tab="other" class="tab-btn pb-2 px-1 text-gray-600 hover:text-blue-600">Other</button>
|
161 |
</div>
|
162 |
</div>
|
163 |
|
@@ -222,6 +225,30 @@
|
|
222 |
</div>
|
223 |
</div>
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
<script>
|
226 |
// DOM Elements
|
227 |
const generateBtn = document.getElementById('generateBtn');
|
@@ -229,13 +256,6 @@
|
|
229 |
const clearBtn = document.getElementById('clearBtn');
|
230 |
const questionCount = document.getElementById('questionCount');
|
231 |
const customPrompt = document.getElementById('customPrompt');
|
232 |
-
const apiKey = document.getElementById('apiKey');
|
233 |
-
const testApiBtn = document.getElementById('testApiBtn');
|
234 |
-
const apiStatus = document.getElementById('apiStatus');
|
235 |
-
const toggleKey = document.getElementById('toggleKey');
|
236 |
-
const uploadBtn = document.getElementById('uploadBtn');
|
237 |
-
const externalData = document.getElementById('externalData');
|
238 |
-
const fileName = document.getElementById('fileName');
|
239 |
const questionsContainer = document.getElementById('questionsContainer');
|
240 |
const loadingIndicator = document.getElementById('loadingIndicator');
|
241 |
const progressText = document.getElementById('progressText');
|
@@ -251,6 +271,15 @@
|
|
251 |
const nextPage = document.getElementById('nextPage');
|
252 |
const pageInfo = document.getElementById('pageInfo');
|
253 |
const pagination = document.getElementById('pagination');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
// State variables
|
256 |
let selectedCategories = new Set(['deposit', 'transfer', 'withdrawal', 'security', 'payment', 'card', 'billing', 'basic', 'other']);
|
@@ -261,7 +290,6 @@
|
|
261 |
let allQuestions = [];
|
262 |
let displayedQuestions = [];
|
263 |
let selectedExportFormat = 'csv';
|
264 |
-
let apiConnected = false;
|
265 |
let externalDataContent = '';
|
266 |
|
267 |
// Initialize
|
@@ -281,17 +309,21 @@
|
|
281 |
exportBtn.addEventListener('click', () => exportModal.classList.remove('hidden'));
|
282 |
clearBtn.addEventListener('click', clearQuestions);
|
283 |
closeExportModal.addEventListener('click', () => exportModal.classList.add('hidden'));
|
284 |
-
testApiBtn.addEventListener('click', testApiConnection);
|
285 |
-
toggleKey.addEventListener('click', toggleApiKeyVisibility);
|
286 |
uploadBtn.addEventListener('click', () => externalData.click());
|
287 |
externalData.addEventListener('change', handleFileUpload);
|
288 |
prevPage.addEventListener('click', () => navigatePage(-1));
|
289 |
nextPage.addEventListener('click', () => navigatePage(1));
|
|
|
|
|
|
|
290 |
|
291 |
// Difficulty buttons
|
292 |
difficultyBtns.forEach(btn => {
|
293 |
btn.addEventListener('click', () => {
|
294 |
-
difficultyBtns.forEach(b =>
|
|
|
|
|
|
|
295 |
btn.classList.add('bg-blue-200');
|
296 |
selectedDifficulty = btn.dataset.difficulty;
|
297 |
});
|
@@ -308,6 +340,19 @@
|
|
308 |
selectedCategories.add(category);
|
309 |
chip.classList.add('bg-blue-200');
|
310 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
});
|
312 |
});
|
313 |
|
@@ -345,18 +390,12 @@
|
|
345 |
return;
|
346 |
}
|
347 |
|
348 |
-
if (!apiConnected) {
|
349 |
-
alert('Please connect to the DeepSeek API first.');
|
350 |
-
return;
|
351 |
-
}
|
352 |
-
|
353 |
// Show loading indicator
|
354 |
loadingIndicator.classList.remove('hidden');
|
355 |
questionsContainer.innerHTML = '';
|
356 |
|
357 |
try {
|
358 |
-
|
359 |
-
const batchSize = 5; // Simulate batch processing
|
360 |
const batches = Math.ceil(count / batchSize);
|
361 |
allQuestions = [];
|
362 |
|
@@ -364,11 +403,13 @@
|
|
364 |
const currentBatchSize = i === batches - 1 ? count - (i * batchSize) : batchSize;
|
365 |
progressText.textContent = `Processing ${i * batchSize}/${count}`;
|
366 |
|
367 |
-
//
|
368 |
-
|
|
|
|
|
369 |
|
370 |
-
//
|
371 |
-
const batchQuestions =
|
372 |
allQuestions = [...allQuestions, ...batchQuestions];
|
373 |
}
|
374 |
|
@@ -388,56 +429,211 @@
|
|
388 |
}
|
389 |
}
|
390 |
|
391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
const categories = Array.from(selectedCategories);
|
393 |
-
const
|
394 |
-
|
395 |
-
const mockQuestions = [];
|
396 |
-
const questionTypes = [
|
397 |
-
"How do I {action} with my {account}?",
|
398 |
-
"What are the steps to {action}?",
|
399 |
-
"Why is my {action} not working?",
|
400 |
-
"How long does {action} take to process?",
|
401 |
-
"What fees are associated with {action}?",
|
402 |
-
"Can I {action} from multiple devices?",
|
403 |
-
"Is there a limit to how much I can {action}?",
|
404 |
-
"What security measures are in place for {action}?",
|
405 |
-
"How can I track my {action} history?",
|
406 |
-
"What should I do if my {action} fails?"
|
407 |
-
];
|
408 |
-
|
409 |
-
const actionsByCategory = {
|
410 |
-
deposit: ['deposit money', 'add funds', 'top up my account', 'make a deposit'],
|
411 |
-
transfer: ['transfer money', 'send funds', 'move money between accounts', 'make a transfer'],
|
412 |
-
withdrawal: ['withdraw money', 'take out funds', 'cash out', 'make a withdrawal'],
|
413 |
-
security: ['secure my account', 'change my password', 'enable 2FA', 'report suspicious activity'],
|
414 |
-
payment: ['make a payment', 'pay a bill', 'send money to a merchant', 'complete a transaction'],
|
415 |
-
card: ['add a card', 'remove a card', 'update card details', 'report a lost card'],
|
416 |
-
billing: ['view my transaction history', 'download a statement', 'check my balance', 'review past payments'],
|
417 |
-
basic: ['log in', 'sign up', 'update my profile', 'contact support'],
|
418 |
-
other: ['use advanced features', 'access premium services', 'get help', 'resolve issues']
|
419 |
-
};
|
420 |
|
421 |
for (let i = 0; i < count; i++) {
|
422 |
const category = categories[Math.floor(Math.random() * categories.length)];
|
423 |
-
const difficulty =
|
424 |
-
|
|
|
425 |
|
426 |
-
const
|
427 |
-
const questionText = questionTemplate
|
428 |
-
.replace('{action}', action)
|
429 |
-
.replace('{account}', 'bank account/wallet');
|
430 |
|
431 |
-
|
432 |
id: Date.now() + i,
|
433 |
-
text:
|
434 |
category: category,
|
435 |
difficulty: difficulty,
|
436 |
generatedAt: new Date().toISOString()
|
437 |
});
|
438 |
}
|
439 |
|
440 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
}
|
442 |
|
443 |
function filterQuestions() {
|
@@ -500,8 +696,8 @@
|
|
500 |
<div class="flex justify-between items-center text-xs text-gray-500">
|
501 |
<span>Generated: ${new Date(question.generatedAt).toLocaleString()}</span>
|
502 |
<div class="flex space-x-2">
|
503 |
-
<button class="text-blue-500 hover:text-blue-700"><i class="fas fa-edit"></i></button>
|
504 |
-
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash-alt"></i></button>
|
505 |
</div>
|
506 |
</div>
|
507 |
`;
|
@@ -509,9 +705,36 @@
|
|
509 |
questionsContainer.appendChild(questionEl);
|
510 |
});
|
511 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
pagination.classList.remove('hidden');
|
513 |
}
|
514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
function updatePagination() {
|
516 |
const totalPages = Math.ceil(displayedQuestions.length / questionsPerPage);
|
517 |
pageInfo.textContent = `Page ${currentPage} of ${totalPages}`;
|
@@ -612,56 +835,6 @@
|
|
612 |
exportModal.classList.add('hidden');
|
613 |
}
|
614 |
|
615 |
-
async function testApiConnection() {
|
616 |
-
if (!apiKey.value.trim()) {
|
617 |
-
alert('Please enter your DeepSeek API key.');
|
618 |
-
return;
|
619 |
-
}
|
620 |
-
|
621 |
-
testApiBtn.disabled = true;
|
622 |
-
testApiBtn.innerHTML = '<i class="fas fa-spinner loading-spinner mr-2"></i> Testing';
|
623 |
-
|
624 |
-
// Simulate API test (replace with actual API call)
|
625 |
-
await new Promise(resolve => setTimeout(resolve, 1500));
|
626 |
-
|
627 |
-
// Mock response
|
628 |
-
const success = Math.random() > 0.2; // 80% chance of success for demo
|
629 |
-
|
630 |
-
if (success) {
|
631 |
-
apiStatus.classList.remove('hidden');
|
632 |
-
apiStatus.classList.add('text-green-600');
|
633 |
-
apiStatus.classList.remove('text-red-600');
|
634 |
-
apiStatus.querySelector('span').textContent = 'Connected to DeepSeek API';
|
635 |
-
apiStatus.querySelector('.rounded-full').classList.add('bg-green-500');
|
636 |
-
apiStatus.querySelector('.rounded-full').classList.remove('bg-red-500');
|
637 |
-
apiConnected = true;
|
638 |
-
} else {
|
639 |
-
apiStatus.classList.remove('hidden');
|
640 |
-
apiStatus.classList.add('text-red-600');
|
641 |
-
apiStatus.classList.remove('text-green-600');
|
642 |
-
apiStatus.querySelector('span').textContent = 'Connection failed';
|
643 |
-
apiStatus.querySelector('.rounded-full').classList.add('bg-red-500');
|
644 |
-
apiStatus.querySelector('.rounded-full').classList.remove('bg-green-500');
|
645 |
-
apiConnected = false;
|
646 |
-
}
|
647 |
-
|
648 |
-
testApiBtn.disabled = false;
|
649 |
-
testApiBtn.innerHTML = 'Test';
|
650 |
-
}
|
651 |
-
|
652 |
-
function toggleApiKeyVisibility() {
|
653 |
-
const icon = toggleKey.querySelector('i');
|
654 |
-
if (apiKey.type === 'password') {
|
655 |
-
apiKey.type = 'text';
|
656 |
-
icon.classList.remove('fa-eye');
|
657 |
-
icon.classList.add('fa-eye-slash');
|
658 |
-
} else {
|
659 |
-
apiKey.type = 'password';
|
660 |
-
icon.classList.remove('fa-eye-slash');
|
661 |
-
icon.classList.add('fa-eye');
|
662 |
-
}
|
663 |
-
}
|
664 |
-
|
665 |
function handleFileUpload(event) {
|
666 |
const file = event.target.files[0];
|
667 |
if (!file) return;
|
@@ -677,6 +850,25 @@
|
|
677 |
alert(`File "${file.name}" has been processed and is ready to be used for RAG.`);
|
678 |
}, 1000);
|
679 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
</script>
|
681 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=Bio-Du/financial-question-generator" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
|
682 |
</html>
|
|
|
33 |
color: #3b82f6;
|
34 |
font-weight: 600;
|
35 |
}
|
36 |
+
.shake {
|
37 |
+
animation: shake 0.5s linear;
|
38 |
+
}
|
39 |
+
@keyframes shake {
|
40 |
+
0%, 100% { transform: translateX(0); }
|
41 |
+
20%, 60% { transform: translateX(-5px); }
|
42 |
+
40%, 80% { transform: translateX(5px); }
|
43 |
+
}
|
44 |
</style>
|
45 |
</head>
|
46 |
<body class="bg-gray-50 min-h-screen">
|
|
|
96 |
</div>
|
97 |
|
98 |
<div>
|
99 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800">RAG & User Feedback</h2>
|
100 |
|
101 |
<div class="mb-4">
|
102 |
<label class="block text-gray-700 mb-2">Import External Data</label>
|
|
|
111 |
</div>
|
112 |
|
113 |
<div class="mb-4">
|
114 |
+
<label class="block text-gray-700 mb-2">Provide Suggestion</label>
|
115 |
+
<textarea id="userSuggestion" rows="2" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Suggest improvements for generated questions..."></textarea>
|
116 |
+
<button id="submitSuggestion" class="mt-2 px-4 py-2 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700">
|
117 |
+
<i class="fas fa-lightbulb mr-2"></i> Submit Suggestion
|
118 |
+
</button>
|
119 |
+
</div>
|
120 |
+
|
121 |
+
<div id="apiStatus" class="p-3 rounded-lg bg-blue-50 border border-blue-200 flex items-center">
|
122 |
+
<div class="w-3 h-3 rounded-full bg-blue-500 mr-2 animate-pulse"></div>
|
123 |
+
<span class="text-sm text-blue-700">Connected to DeepSeek API</span>
|
124 |
+
<i class="fas fa-check-circle ml-auto text-green-500"></i>
|
|
|
|
|
|
|
|
|
|
|
125 |
</div>
|
126 |
|
127 |
+
<div class="bg-blue-50 p-4 rounded-lg mt-4">
|
128 |
<h3 class="font-semibold text-blue-800 mb-2 flex items-center">
|
129 |
<i class="fas fa-info-circle mr-2"></i> Generation Process
|
130 |
</h3>
|
131 |
<p class="text-sm text-blue-700">
|
132 |
+
Questions are generated using DeepSeek's AI model through integrated API. For large batches, multiple API calls will be made automatically. Each question is categorized and checked for quality.
|
133 |
</p>
|
134 |
</div>
|
135 |
</div>
|
|
|
150 |
</div>
|
151 |
|
152 |
<div class="border-b border-gray-200 mb-4">
|
153 |
+
<div class="flex space-x-6 overflow-x-auto pb-2">
|
154 |
+
<button data-tab="all" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">All</button>
|
155 |
+
<button data-tab="deposit" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Deposit</button>
|
156 |
+
<button data-tab="transfer" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Transfer</button>
|
157 |
+
<button data-tab="withdrawal" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Withdrawal</button>
|
158 |
+
<button data-tab="security" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Security</button>
|
159 |
+
<button data-tab="payment" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Payment</button>
|
160 |
+
<button data-tab="card" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Card</button>
|
161 |
+
<button data-tab="billing" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Billing</button>
|
162 |
+
<button data-tab="basic" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Basic</button>
|
163 |
+
<button data-tab="other" class="tab-btn whitespace-nowrap pb-2 px-1 text-gray-600 hover:text-blue-600">Other</button>
|
164 |
</div>
|
165 |
</div>
|
166 |
|
|
|
225 |
</div>
|
226 |
</div>
|
227 |
|
228 |
+
<!-- Suggestion Feedback Modal -->
|
229 |
+
<div id="suggestionModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
|
230 |
+
<div class="bg-white rounded-xl p-6 w-full max-w-md">
|
231 |
+
<div class="flex justify-between items-center mb-4">
|
232 |
+
<h3 class="text-lg font-semibold">Feedback Submitted</h3>
|
233 |
+
<button id="closeSuggestionModal" class="text-gray-500 hover:text-gray-700">
|
234 |
+
<i class="fas fa-times"></i>
|
235 |
+
</button>
|
236 |
+
</div>
|
237 |
+
<div class="flex items-center">
|
238 |
+
<div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mr-4">
|
239 |
+
<i class="fas fa-check text-green-500 text-xl"></i>
|
240 |
+
</div>
|
241 |
+
<div>
|
242 |
+
<p class="text-gray-700">Thank you for your suggestion!</p>
|
243 |
+
<p class="text-sm text-gray-500 mt-1">Your feedback will help improve future question generations.</p>
|
244 |
+
</div>
|
245 |
+
</div>
|
246 |
+
<button id="okSuggestionBtn" class="w-full mt-6 bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg">
|
247 |
+
OK
|
248 |
+
</button>
|
249 |
+
</div>
|
250 |
+
</div>
|
251 |
+
|
252 |
<script>
|
253 |
// DOM Elements
|
254 |
const generateBtn = document.getElementById('generateBtn');
|
|
|
256 |
const clearBtn = document.getElementById('clearBtn');
|
257 |
const questionCount = document.getElementById('questionCount');
|
258 |
const customPrompt = document.getElementById('customPrompt');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
const questionsContainer = document.getElementById('questionsContainer');
|
260 |
const loadingIndicator = document.getElementById('loadingIndicator');
|
261 |
const progressText = document.getElementById('progressText');
|
|
|
271 |
const nextPage = document.getElementById('nextPage');
|
272 |
const pageInfo = document.getElementById('pageInfo');
|
273 |
const pagination = document.getElementById('pagination');
|
274 |
+
const uploadBtn = document.getElementById('uploadBtn');
|
275 |
+
const externalData = document.getElementById('externalData');
|
276 |
+
const fileName = document.getElementById('fileName');
|
277 |
+
const userSuggestion = document.getElementById('userSuggestion');
|
278 |
+
const submitSuggestion = document.getElementById('submitSuggestion');
|
279 |
+
const suggestionModal = document.getElementById('suggestionModal');
|
280 |
+
const closeSuggestionModal = document.getElementById('closeSuggestionModal');
|
281 |
+
const okSuggestionBtn = document.getElementById('okSuggestionBtn');
|
282 |
+
const apiStatus = document.getElementById('apiStatus');
|
283 |
|
284 |
// State variables
|
285 |
let selectedCategories = new Set(['deposit', 'transfer', 'withdrawal', 'security', 'payment', 'card', 'billing', 'basic', 'other']);
|
|
|
290 |
let allQuestions = [];
|
291 |
let displayedQuestions = [];
|
292 |
let selectedExportFormat = 'csv';
|
|
|
293 |
let externalDataContent = '';
|
294 |
|
295 |
// Initialize
|
|
|
309 |
exportBtn.addEventListener('click', () => exportModal.classList.remove('hidden'));
|
310 |
clearBtn.addEventListener('click', clearQuestions);
|
311 |
closeExportModal.addEventListener('click', () => exportModal.classList.add('hidden'));
|
|
|
|
|
312 |
uploadBtn.addEventListener('click', () => externalData.click());
|
313 |
externalData.addEventListener('change', handleFileUpload);
|
314 |
prevPage.addEventListener('click', () => navigatePage(-1));
|
315 |
nextPage.addEventListener('click', () => navigatePage(1));
|
316 |
+
submitSuggestion.addEventListener('click', submitUserSuggestion);
|
317 |
+
closeSuggestionModal.addEventListener('click', () => suggestionModal.classList.add('hidden'));
|
318 |
+
okSuggestionBtn.addEventListener('click', () => suggestionModal.classList.add('hidden'));
|
319 |
|
320 |
// Difficulty buttons
|
321 |
difficultyBtns.forEach(btn => {
|
322 |
btn.addEventListener('click', () => {
|
323 |
+
difficultyBtns.forEach(b => {
|
324 |
+
b.classList.remove('bg-blue-200');
|
325 |
+
b.classList.remove('ring-2', 'ring-blue-500');
|
326 |
+
});
|
327 |
btn.classList.add('bg-blue-200');
|
328 |
selectedDifficulty = btn.dataset.difficulty;
|
329 |
});
|
|
|
340 |
selectedCategories.add(category);
|
341 |
chip.classList.add('bg-blue-200');
|
342 |
}
|
343 |
+
|
344 |
+
// Visual feedback
|
345 |
+
if (selectedCategories.size === 0) {
|
346 |
+
chip.classList.add('shake');
|
347 |
+
setTimeout(() => chip.classList.remove('shake'), 500);
|
348 |
+
document.querySelectorAll('.category-chip').forEach(c => {
|
349 |
+
c.classList.add('ring-2', 'ring-red-500');
|
350 |
+
});
|
351 |
+
} else {
|
352 |
+
document.querySelectorAll('.category-chip').forEach(c => {
|
353 |
+
c.classList.remove('ring-2', 'ring-red-500');
|
354 |
+
});
|
355 |
+
}
|
356 |
});
|
357 |
});
|
358 |
|
|
|
390 |
return;
|
391 |
}
|
392 |
|
|
|
|
|
|
|
|
|
|
|
393 |
// Show loading indicator
|
394 |
loadingIndicator.classList.remove('hidden');
|
395 |
questionsContainer.innerHTML = '';
|
396 |
|
397 |
try {
|
398 |
+
const batchSize = 5; // Number of questions per API call
|
|
|
399 |
const batches = Math.ceil(count / batchSize);
|
400 |
allQuestions = [];
|
401 |
|
|
|
403 |
const currentBatchSize = i === batches - 1 ? count - (i * batchSize) : batchSize;
|
404 |
progressText.textContent = `Processing ${i * batchSize}/${count}`;
|
405 |
|
406 |
+
// Prepare prompt for API call
|
407 |
+
const categoriesList = Array.from(selectedCategories).join(', ');
|
408 |
+
const prompt = `Generate ${currentBatchSize} ${selectedDifficulty} English questions about ${categoriesList} in financial/wallet services. ` +
|
409 |
+
`Ensure questions are varied and avoid redundancy. ${customPrompt.value}`;
|
410 |
|
411 |
+
// Call DeepSeek API (simulated in this example)
|
412 |
+
const batchQuestions = await callDeepSeekApi(prompt, currentBatchSize);
|
413 |
allQuestions = [...allQuestions, ...batchQuestions];
|
414 |
}
|
415 |
|
|
|
429 |
}
|
430 |
}
|
431 |
|
432 |
+
// Simulate DeepSeek API call with realistic financial questions
|
433 |
+
async function callDeepSeekApi(prompt, count) {
|
434 |
+
// In a real implementation, this would make an actual API call
|
435 |
+
// For this example, we'll simulate the API response with realistic questions
|
436 |
+
|
437 |
+
// Simulate API delay (500-1500ms)
|
438 |
+
const delay = 500 + Math.random() * 1000;
|
439 |
+
await new Promise(resolve => setTimeout(resolve, delay));
|
440 |
+
|
441 |
+
// Generate realistic financial questions based on the prompt
|
442 |
const categories = Array.from(selectedCategories);
|
443 |
+
const batchQuestions = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
|
445 |
for (let i = 0; i < count; i++) {
|
446 |
const category = categories[Math.floor(Math.random() * categories.length)];
|
447 |
+
const difficulty = selectedDifficulty === 'random'
|
448 |
+
? ['simple', 'medium', 'complex'][Math.floor(Math.random() * 3)]
|
449 |
+
: selectedDifficulty;
|
450 |
|
451 |
+
const question = generateRealisticQuestion(category, difficulty);
|
|
|
|
|
|
|
452 |
|
453 |
+
batchQuestions.push({
|
454 |
id: Date.now() + i,
|
455 |
+
text: question,
|
456 |
category: category,
|
457 |
difficulty: difficulty,
|
458 |
generatedAt: new Date().toISOString()
|
459 |
});
|
460 |
}
|
461 |
|
462 |
+
return batchQuestions;
|
463 |
+
}
|
464 |
+
|
465 |
+
function generateRealisticQuestion(category, difficulty) {
|
466 |
+
// Realistic question templates for each category and difficulty
|
467 |
+
const questions = {
|
468 |
+
deposit: {
|
469 |
+
simple: [
|
470 |
+
"How do I deposit money into my digital wallet?",
|
471 |
+
"What payment methods can I use for deposits?",
|
472 |
+
"Is there a minimum amount for deposits?"
|
473 |
+
],
|
474 |
+
medium: [
|
475 |
+
"Why is my deposit taking longer than usual to process?",
|
476 |
+
"Can I deposit funds from an international bank account?",
|
477 |
+
"What are the deposit limits for unverified accounts?"
|
478 |
+
],
|
479 |
+
complex: [
|
480 |
+
"How does the deposit reconciliation process work during weekends?",
|
481 |
+
"What security protocols are in place for large deposit transactions?",
|
482 |
+
"Can you explain the multi-signature verification process for deposits?"
|
483 |
+
]
|
484 |
+
},
|
485 |
+
transfer: {
|
486 |
+
simple: [
|
487 |
+
"How do I send money to another user?",
|
488 |
+
"What's the maximum amount I can transfer in one transaction?",
|
489 |
+
"How long do transfers usually take?"
|
490 |
+
],
|
491 |
+
medium: [
|
492 |
+
"Why was my transfer returned by the recipient's bank?",
|
493 |
+
"Can I schedule recurring transfers to family members?",
|
494 |
+
"How do foreign currency transfers work?"
|
495 |
+
],
|
496 |
+
complex: [
|
497 |
+
"What are the tax implications for international transfers over $10,000?",
|
498 |
+
"How does the blockchain verification process work for crypto transfers?",
|
499 |
+
"Can you explain the interbank settlement procedures for instant transfers?"
|
500 |
+
]
|
501 |
+
},
|
502 |
+
withdrawal: {
|
503 |
+
simple: [
|
504 |
+
"How do I withdraw money to my bank account?",
|
505 |
+
"Are there any fees for withdrawals?",
|
506 |
+
"How long does a withdrawal take to process?"
|
507 |
+
],
|
508 |
+
medium: [
|
509 |
+
"Why does my withdrawal request keep getting declined?",
|
510 |
+
"Can I withdraw to a different bank than my deposit source?",
|
511 |
+
"What are the tax reporting requirements for large withdrawals?"
|
512 |
+
],
|
513 |
+
complex: [
|
514 |
+
"How are AML checks performed on high-value withdrawal requests?",
|
515 |
+
"What are the reserve requirements that affect withdrawal processing times?",
|
516 |
+
"Can you explain the cross-border clearance process for international withdrawals?"
|
517 |
+
]
|
518 |
+
},
|
519 |
+
security: {
|
520 |
+
simple: [
|
521 |
+
"How do I create a strong password for my account?",
|
522 |
+
"What should I do if I lose my phone with my wallet app?",
|
523 |
+
"How does two-factor authentication work?"
|
524 |
+
],
|
525 |
+
medium: [
|
526 |
+
"Why did I receive a security alert for a login attempt?",
|
527 |
+
"Can I restrict transactions from certain locations?",
|
528 |
+
"How are my biometric data stored and protected?"
|
529 |
+
],
|
530 |
+
complex: [
|
531 |
+
"What cryptographic techniques are used to secure financial transactions?",
|
532 |
+
"How does the zero-knowledge proof verification process work?",
|
533 |
+
"Can you explain the multi-party computation protocol used for key management?"
|
534 |
+
]
|
535 |
+
},
|
536 |
+
payment: {
|
537 |
+
simple: [
|
538 |
+
"How do I pay a merchant using my digital wallet?",
|
539 |
+
"Can I split a payment with friends?",
|
540 |
+
"What's contactless payment and how does it work?"
|
541 |
+
],
|
542 |
+
medium: [
|
543 |
+
"Why was my payment to a merchant declined?",
|
544 |
+
"Can I dispute a payment after it's completed?",
|
545 |
+
"How do recurring subscription payments work?"
|
546 |
+
],
|
547 |
+
complex: [
|
548 |
+
"What are the PCI-DSS compliance requirements for tokenized payments?",
|
549 |
+
"How does the merchant acquiring bank authorization process work?",
|
550 |
+
"Can you explain the chargeback arbitration process?"
|
551 |
+
]
|
552 |
+
},
|
553 |
+
card: {
|
554 |
+
simple: [
|
555 |
+
"How do I add a debit card to my wallet?",
|
556 |
+
"Can I remove a saved card from my account?",
|
557 |
+
"What should I do if my card is lost or stolen?"
|
558 |
+
],
|
559 |
+
medium: [
|
560 |
+
"Why is my card verification failing during checkout?",
|
561 |
+
"Can I set spending limits for specific cards?",
|
562 |
+
"How do virtual card numbers work?"
|
563 |
+
],
|
564 |
+
complex: [
|
565 |
+
"How are card details tokenized during online transactions?",
|
566 |
+
"What are the EMV 3D Secure 2.0 authentication protocols?",
|
567 |
+
"Can you explain the card network settlement reconciliation process?"
|
568 |
+
]
|
569 |
+
},
|
570 |
+
billing: {
|
571 |
+
simple: [
|
572 |
+
"How do I view my transaction history?",
|
573 |
+
"Can I download my monthly statements?",
|
574 |
+
"Where can I see my current balance?"
|
575 |
+
],
|
576 |
+
medium: [
|
577 |
+
"Why is there a discrepancy in my transaction records?",
|
578 |
+
"Can I generate customized reports for tax purposes?",
|
579 |
+
"How do I categorize transactions for budgeting?"
|
580 |
+
],
|
581 |
+
complex: [
|
582 |
+
"What accounting standards are followed for transaction record-keeping?",
|
583 |
+
"How does the GL reconciliation process work across multiple currencies?",
|
584 |
+
"Can you explain the audit trail generation process?"
|
585 |
+
]
|
586 |
+
},
|
587 |
+
basic: {
|
588 |
+
simple: [
|
589 |
+
"How do I create an account?",
|
590 |
+
"What's the customer support phone number?",
|
591 |
+
"Where can I find the app settings?"
|
592 |
+
],
|
593 |
+
medium: [
|
594 |
+
"Why can't I receive the verification SMS?",
|
595 |
+
"Can I merge two accounts under one email?",
|
596 |
+
"How do I update my personal information?"
|
597 |
+
],
|
598 |
+
complex: [
|
599 |
+
"What identity verification protocols are used during KYC onboarding?",
|
600 |
+
"How does the real-time account monitoring system work?",
|
601 |
+
"Can you explain the multi-jurisdictional compliance process?"
|
602 |
+
]
|
603 |
+
},
|
604 |
+
other: {
|
605 |
+
simple: [
|
606 |
+
"What currencies does your service support?",
|
607 |
+
"Can I use this service while traveling abroad?",
|
608 |
+
"Where can I find your terms of service?"
|
609 |
+
],
|
610 |
+
medium: [
|
611 |
+
"Why can't I access certain features in my country?",
|
612 |
+
"Can I give limited access to an accountant?",
|
613 |
+
"How does interest accrual work on stored balances?"
|
614 |
+
],
|
615 |
+
complex: [
|
616 |
+
"What regulatory bodies oversee the financial services provided?",
|
617 |
+
"How are exchange rates calculated for multi-currency transactions?",
|
618 |
+
"Can you explain the liquidity provisions for fast settlements?"
|
619 |
+
]
|
620 |
+
}
|
621 |
+
};
|
622 |
+
|
623 |
+
// Get all possible questions for this category and difficulty
|
624 |
+
let possibleQuestions = questions[category][difficulty];
|
625 |
+
|
626 |
+
// If the difficulty was 'random', select from all difficulties
|
627 |
+
if (selectedDifficulty === 'random') {
|
628 |
+
possibleQuestions = [
|
629 |
+
...questions[category].simple,
|
630 |
+
...questions[category].medium,
|
631 |
+
...questions[category].complex
|
632 |
+
];
|
633 |
+
}
|
634 |
+
|
635 |
+
// Return a random question from the selection
|
636 |
+
return possibleQuestions[Math.floor(Math.random() * possibleQuestions.length)];
|
637 |
}
|
638 |
|
639 |
function filterQuestions() {
|
|
|
696 |
<div class="flex justify-between items-center text-xs text-gray-500">
|
697 |
<span>Generated: ${new Date(question.generatedAt).toLocaleString()}</span>
|
698 |
<div class="flex space-x-2">
|
699 |
+
<button data-id="${question.id}" class="edit-btn text-blue-500 hover:text-blue-700"><i class="fas fa-edit"></i></button>
|
700 |
+
<button data-id="${question.id}" class="delete-btn text-red-500 hover:text-red-700"><i class="fas fa-trash-alt"></i></button>
|
701 |
</div>
|
702 |
</div>
|
703 |
`;
|
|
|
705 |
questionsContainer.appendChild(questionEl);
|
706 |
});
|
707 |
|
708 |
+
// Add event listeners to edit and delete buttons
|
709 |
+
document.querySelectorAll('.edit-btn').forEach(btn => {
|
710 |
+
btn.addEventListener('click', (e) => editQuestion(e.target.closest('button').dataset.id));
|
711 |
+
});
|
712 |
+
|
713 |
+
document.querySelectorAll('.delete-btn').forEach(btn => {
|
714 |
+
btn.addEventListener('click', (e) => deleteQuestion(e.target.closest('button').dataset.id));
|
715 |
+
});
|
716 |
+
|
717 |
pagination.classList.remove('hidden');
|
718 |
}
|
719 |
|
720 |
+
function editQuestion(id) {
|
721 |
+
const question = allQuestions.find(q => q.id.toString() === id);
|
722 |
+
if (!question) return;
|
723 |
+
|
724 |
+
const newText = prompt("Edit question:", question.text);
|
725 |
+
if (newText && newText.trim() !== '') {
|
726 |
+
question.text = newText.trim();
|
727 |
+
renderQuestions();
|
728 |
+
}
|
729 |
+
}
|
730 |
+
|
731 |
+
function deleteQuestion(id) {
|
732 |
+
if (confirm("Are you sure you want to delete this question?")) {
|
733 |
+
allQuestions = allQuestions.filter(q => q.id.toString() !== id);
|
734 |
+
filterQuestions();
|
735 |
+
}
|
736 |
+
}
|
737 |
+
|
738 |
function updatePagination() {
|
739 |
const totalPages = Math.ceil(displayedQuestions.length / questionsPerPage);
|
740 |
pageInfo.textContent = `Page ${currentPage} of ${totalPages}`;
|
|
|
835 |
exportModal.classList.add('hidden');
|
836 |
}
|
837 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
838 |
function handleFileUpload(event) {
|
839 |
const file = event.target.files[0];
|
840 |
if (!file) return;
|
|
|
850 |
alert(`File "${file.name}" has been processed and is ready to be used for RAG.`);
|
851 |
}, 1000);
|
852 |
}
|
853 |
+
|
854 |
+
function submitUserSuggestion() {
|
855 |
+
const suggestion = userSuggestion.value.trim();
|
856 |
+
if (!suggestion) {
|
857 |
+
userSuggestion.classList.add('ring-2', 'ring-red-500');
|
858 |
+
setTimeout(() => userSuggestion.classList.remove('ring-2', 'ring-red-500'), 1000);
|
859 |
+
return;
|
860 |
+
}
|
861 |
+
|
862 |
+
// In a real app, you would send this to the API
|
863 |
+
console.log("User suggestion submitted:", suggestion);
|
864 |
+
|
865 |
+
// Show feedback modal
|
866 |
+
suggestionModal.classList.remove('hidden');
|
867 |
+
userSuggestion.value = '';
|
868 |
+
|
869 |
+
// After showing, this would be sent to DeepSeek API to improve future generations
|
870 |
+
// For this demo, we'll just log it
|
871 |
+
}
|
872 |
</script>
|
873 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=Bio-Du/financial-question-generator" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
|
874 |
</html>
|