Text Generation
Transformers
English
Russian
legal
File size: 1,165 Bytes
4bc48f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html>
<head>
    <title>CyberFuture-3</title>
</head>
<body>
    <div id="chat"></div>
    <input type="text" id="input" placeholder="Type your question...">
    <button onclick="sendMessage()">Send</button>
    <button onclick="startVoice()">Voice</button>
    
    <script>
        async function sendMessage() {
            const input = document.getElementById('input').value;
            const response = await fetch('http://localhost:8000/chat/', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                },
                body: `prompt=${encodeURIComponent(input)}&use_web=true`
            });
            const data = await response.json();
            document.getElementById('chat').innerHTML += `<p>You: ${input}</p>`;
            document.getElementById('chat').innerHTML += `<p>Bot: ${data.response}</p>`;
        }
        
        async function startVoice() {
            // You would need to add proper voice recording implementation
            alert("Voice recording would be implemented here");
        }
    </script>
</body>
</html>