File size: 1,988 Bytes
b0dcdf3
 
 
 
 
 
 
 
fb9da3e
b0dcdf3
 
fb9da3e
b0dcdf3
fb9da3e
b0dcdf3
 
 
 
 
 
 
 
 
 
 
 
fb9da3e
 
b0dcdf3
fb9da3e
 
 
 
 
b0dcdf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb9da3e
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
// Theme Toggle
const themeSwitch = document.getElementById('theme-switch');
themeSwitch.addEventListener('click', () => {
    document.body.classList.toggle('light');
    themeSwitch.textContent = document.body.classList.contains('light') ? '☀️' : '🌙';
});

// Query Submission
document.getElementById('submit-query').addEventListener('click', () => {
    const query = document.getElementById('query-input').value.trim();
    if (!query) {
        alert('Please enter a query.');
        return;
    }

    // Simulate loading state
    const responseOutput = document.getElementById('response-output');
    const contextOutput = document.getElementById('context-output');
    responseOutput.innerHTML = '<p class="loading">Generating response...</p>';
    contextOutput.innerHTML = '<p class="loading">Retrieving context...</p>';

    // Simulate API response (replace with actual backend integration)
    setTimeout(() => {
        responseOutput.innerHTML = `<p>Response to: ${query}</p>`;
        contextOutput.innerHTML = `<p>Context for: ${query}</p>`;
    }, 1500);
});

// Apply Settings
document.getElementById('apply-settings').addEventListener('click', () => {
    const model = document.getElementById('model-select').value;
    const topK = document.getElementById('top-k').value;
    const temperature = document.getElementById('temperature').value;
    const contextLength = document.getElementById('context-length').value;

    // Simulate settings application
    const settingsOutput = `Settings applied: Model=${model}, Top-K=${topK}, Temperature=${temperature}, Context Length=${contextLength}`;
    console.log(settingsOutput);
    alert(settingsOutput);
});

// Smooth scroll for better UX
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', (e) => {
        e.preventDefault();
        document.querySelector(anchor.getAttribute('href')).scrollIntoView({
            behavior: 'smooth'
        });
    });
});