gendev commited on
Commit
bd4fc3d
·
verified ·
1 Parent(s): d13b95a

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +83 -0
templates/index.html ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Chat</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ padding: 0;
12
+ background-color: #f4f4f4;
13
+ }
14
+ .container {
15
+ max-width: 800px;
16
+ margin: auto;
17
+ background: #fff;
18
+ padding: 20px;
19
+ border-radius: 8px;
20
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
21
+ }
22
+ h1 {
23
+ text-align: center;
24
+ }
25
+ textarea {
26
+ width: 100%;
27
+ height: 100px;
28
+ padding: 10px;
29
+ border-radius: 4px;
30
+ border: 1px solid #ddd;
31
+ margin-bottom: 10px;
32
+ }
33
+ button {
34
+ display: block;
35
+ width: 100%;
36
+ padding: 10px;
37
+ border: none;
38
+ border-radius: 4px;
39
+ background-color: #28a745;
40
+ color: #fff;
41
+ font-size: 16px;
42
+ cursor: pointer;
43
+ }
44
+ button:hover {
45
+ background-color: #218838;
46
+ }
47
+ #response {
48
+ margin-top: 20px;
49
+ }
50
+ </style>
51
+ </head>
52
+ <body>
53
+ <div class="container">
54
+ <h1>AI Chat Interface</h1>
55
+ <textarea id="inputText" placeholder="Enter your message here..."></textarea>
56
+ <button onclick="sendMessage()">Send</button>
57
+ <div id="response"></div>
58
+ </div>
59
+
60
+ <script>
61
+ async function sendMessage() {
62
+ const inputText = document.getElementById('inputText').value;
63
+ const responseDiv = document.getElementById('response');
64
+ responseDiv.innerHTML = 'Loading...';
65
+
66
+ try {
67
+ const response = await fetch('/run', {
68
+ method: 'POST',
69
+ headers: {
70
+ 'Content-Type': 'application/json'
71
+ },
72
+ body: JSON.stringify({ text: inputText })
73
+ });
74
+
75
+ const data = await response.json();
76
+ responseDiv.innerHTML = '<strong>Response:</strong><br>' + data.response;
77
+ } catch (error) {
78
+ responseDiv.innerHTML = '<strong>Error:</strong> Unable to get response';
79
+ }
80
+ }
81
+ </script>
82
+ </body>
83
+ </html>