Futuresony commited on
Commit
c31429d
·
verified ·
1 Parent(s): 4dc0d27

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +261 -79
templates/index.html CHANGED
@@ -1,109 +1,291 @@
 
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>Custom AI App</title>
7
- <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.4.0/axios.min.js"></script>
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/ace.js"></script>
9
  <style>
10
- body {
11
- font-family: Arial, sans-serif;
12
  margin: 0;
13
  padding: 0;
14
- background: #f4f4f4;
15
  }
16
 
17
- #app-container {
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  max-width: 800px;
19
- margin: 50px auto;
20
- background: #fff;
21
- padding: 20px;
22
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  border-radius: 10px;
 
 
 
 
24
  }
25
 
26
- textarea, input, button {
27
- width: 100%;
28
- margin: 10px 0;
29
- padding: 10px;
30
- font-size: 1rem;
31
  }
32
 
33
- #response {
34
- white-space: pre-wrap;
35
- margin-top: 20px;
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
38
- #editor-container {
39
- margin: 20px 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
- </style>
42
- </head>
43
- <body>
44
- <div id="app-container">
45
- <h1>Custom AI App</h1>
46
- <label for="system_message">System Message</label>
47
- <textarea id="system_message">You are a friendly Chatbot.</textarea>
48
 
49
- <label for="message">Your Message</label>
50
- <textarea id="message"></textarea>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
- <label for="max_tokens">Max Tokens</label>
53
- <input type="number" id="max_tokens" value="512" min="1" max="2048">
 
 
 
 
 
 
 
54
 
55
- <label for="temperature">Temperature</label>
56
- <input type="number" id="temperature" step="0.1" value="0.7" min="0.1" max="4.0">
 
57
 
58
- <label for="top_p">Top-p</label>
59
- <input type="number" id="top_p" step="0.05" value="0.95" min="0.1" max="1.0">
 
60
 
61
- <button id="submit-btn">Submit</button>
62
- <div id="response"></div>
63
 
64
- <h3>Code Editor</h3>
65
- <div id="editor-container">
66
- <div id="editor" style="height: 300px; width: 100%; border: 1px solid #ccc;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  </div>
68
  </div>
69
 
70
- <script>
71
- const submitBtn = document.getElementById("submit-btn");
72
- const responseDiv = document.getElementById("response");
73
- const editor = ace.edit("editor");
74
- editor.setTheme("ace/theme/monokai");
75
- editor.session.setMode("ace/mode/javascript");
76
-
77
- submitBtn.addEventListener("click", async () => {
78
- const systemMessage = document.getElementById("system_message").value;
79
- const message = document.getElementById("message").value;
80
- const maxTokens = document.getElementById("max_tokens").value;
81
- const temperature = document.getElementById("temperature").value;
82
- const topP = document.getElementById("top_p").value;
83
-
84
- const history = []; // Include logic for maintaining chat history if needed.
85
-
86
- try {
87
- const response = await axios.post("/respond", {
88
- system_message: systemMessage,
89
- message: message,
90
- max_tokens: parseInt(maxTokens),
91
- temperature: parseFloat(temperature),
92
- top_p: parseFloat(topP),
93
- history: history,
94
- });
95
-
96
- const result = response.data.response;
97
- responseDiv.innerHTML = `<strong>Response:</strong><br>${result.replace(
98
- /\*\*\*(.*?)\*\*\*/g,
99
- "<b><i>$1</i></b>"
100
- )}`;
101
- editor.setValue(result);
102
- } catch (error) {
103
- console.error(error);
104
- responseDiv.textContent = "Error occurred while fetching the response.";
105
- }
106
- });
107
- </script>
108
  </body>
109
  </html>
 
1
+
2
  <!DOCTYPE html>
3
  <html lang="en">
4
  <head>
5
+ <base href="javascript:" />
6
  <meta charset="UTF-8">
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <title>Enhanced Flask Chat Interface with Call Feature</title>
9
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
10
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined&display=swap">
11
  <style>
12
+ * {
13
+ box-sizing: border-box;
14
  margin: 0;
15
  padding: 0;
 
16
  }
17
 
18
+ body {
19
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
20
+
21
+ display: flex;
22
+ justify-content: center;
23
+ align-items: center;
24
+ height: 90vh;
25
+ margin: 0;
26
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
27
+ }
28
+
29
+
30
+ #chat-container {
31
+ width: 1500%;
32
  max-width: 800px;
33
+ background-color: rgba(255, 255, 255, 0.95);
34
+ padding: 25px;
35
+ border-radius: 20px;
36
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
37
+ display: flex;
38
+ flex-direction: column;
39
+ height: 90vh;
40
+ position: relative;
41
+ backdrop-filter: blur(10px);
42
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
43
+ }
44
+
45
+
46
+ #chatbox {
47
+ flex: 1;
48
+ overflow-y: auto;
49
+ padding: 15px;
50
+ background-color: #f8f9fa;
51
+ border-radius: 15px;
52
+ font-size: 16px;
53
+ margin-bottom: 20px;
54
+ scroll-behavior: smooth;
55
+ height: 90vh;
56
+ }
57
+
58
+
59
+ #chatbox .message {
60
+ padding: 12px 16px;
61
+ border-radius: 15px;
62
+ margin-bottom: 15px;
63
+ word-wrap: break-word;
64
+ font-size: 16px;
65
+ max-width: 80%;
66
+ clear: both;
67
+ position: relative;
68
+ animation: fadeIn 0.3s ease-in-out;
69
+ }
70
+
71
+ #chatbox .user {
72
+ background-color: #007bff;
73
+ color: white;
74
+ float: right;
75
+ border-bottom-right-radius: 5px;
76
+ }
77
+
78
+ #chatbox .ai {
79
+ background-color: #e9ecef;
80
+ color: #333;
81
+ float: left;
82
+ border-bottom-left-radius: 5px;
83
+ }
84
+
85
+ #user-input-container {
86
+ position: relative;
87
+ display: flex;
88
+ align-items: center;
89
+ padding: 15px;
90
+ flex-wrap: wrap;
91
+ }
92
+
93
+
94
+ #user-input {
95
+ flex: 1;
96
+ padding: 12px 15px;
97
+ border: none;
98
  border-radius: 10px;
99
+ font-size: 16px;
100
+ background-color: white;
101
+ transition: all 0.3s ease;
102
+ padding-right: 45px;
103
  }
104
 
105
+
106
+ #user-input:focus {
107
+ outline: none;
108
+ box-shadow: 0 0 0 2px #007bff33;
 
109
  }
110
 
111
+
112
+ button {
113
+ padding: 12px;
114
+ background-color: #007bff;
115
+ color: white;
116
+ border: none;
117
+ border-radius: 10px;
118
+ cursor: pointer;
119
+ font-size: 16px;
120
+ transition: all 0.3s ease;
121
+ display: flex;
122
+ align-items: center;
123
+ gap: 5px;
124
  }
125
 
126
+ button:hover {
127
+ background-color: #0056b3;
128
+ transform: translateY(-2px);
129
+ }
130
+
131
+ .mic-icon, .call-icon {
132
+ font-size: 24px;
133
+ cursor: pointer;
134
+ color: #555;
135
+ transition: all 0.3s ease;
136
+ padding: 8px;
137
+ border-radius: 50%;
138
+ }
139
+
140
+ .mic-icon:hover, .call-icon:hover {
141
+
142
  }
 
 
 
 
 
 
 
143
 
144
+ #call-ui {
145
+ display: none;
146
+ position: absolute;
147
+ top: 50%;
148
+ left: 50%;
149
+ transform: translate(-50%, -50%);
150
+ background-color: white;
151
+ padding: 30px;
152
+ border-radius: 20px;
153
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
154
+ text-align: center;
155
+ z-index: 1000;
156
+ }
157
+
158
+ #call-ui p {
159
+ font-size: 18px;
160
+ margin: 15px 0;
161
+ color: #333;
162
+ }
163
+
164
+ #timer {
165
+ font-size: 24px;
166
+ font-weight: bold;
167
+ color: #007bff;
168
+ margin-top: 15px;
169
+ }
170
+
171
+ .bottom-icons {
172
+ display: flex;
173
+ justify-content: center;
174
+ gap: 15px;
175
+ position: absolute;
176
+ bottom: 1px;
177
+ left: 50%;
178
+ transform: translateX(-50%);
179
+ }
180
+
181
+ .call-icon {
182
+ color: green;
183
+ }
184
+ }
185
+ .icons, .navigation {
186
+ display: inline-flex;
187
+ align-items: center;
188
+ gap: 10px;
189
+ margin-top: 5px;
190
+ }
191
+ .navigation {
192
+ display: inline-flex;
193
+ align-items: center;
194
+ gap: 10px;
195
+ margin-left: 10px;
196
+ font-size: 14px;
197
+ color: #666;
198
+ }
199
+ .navigation span {
200
+ padding: 0 5px;
201
+ }
202
+
203
+ .status-dot {
204
+ display: inline-block;
205
+ width: 10px;
206
+ height: 10px;
207
+ background-color: green; /* Online indicator color */
208
+ border-radius: 50%;
209
+ margin-right: 5px;
210
+ }
211
+
212
+
213
+
214
+ @keyframes typingAnimation {
215
+ 0%, 100% {
216
+ transform: translateY(0);
217
+ }
218
+ 50% {
219
+ transform: translateY(-10px);
220
+ }
221
+ }
222
 
223
+ .typing-dot {
224
+ width: 8px;
225
+ height: 8px;
226
+ background-color: #007bff;
227
+ border-radius: 50%;
228
+ display: inline-block;
229
+ animation: typingAnimation 1s infinite ease-in-out;
230
+ margin-right: 5px;
231
+ }
232
 
233
+ .typing-dot:nth-child(2) {
234
+ animation-delay: 0.2s;
235
+ }
236
 
237
+ .typing-dot:nth-child(3) {
238
+ animation-delay: 0.4s;
239
+ }
240
 
 
 
241
 
242
+
243
+ #chatbox::-webkit-scrollbar {
244
+ width: 8px;
245
+ }
246
+
247
+ #chatbox::-webkit-scrollbar-track {
248
+ background: #f1f1f1;
249
+ border-radius: 4px;
250
+ }
251
+
252
+ #chatbox::-webkit-scrollbar-thumb {
253
+ background: #888;
254
+ border-radius: 4px;
255
+ }
256
+
257
+
258
+ </style>
259
+ </head>
260
+ <body>
261
+ <div id="chat-container">
262
+ <div class="header">
263
+ <h1>Chat Assistant</h1>
264
+ <div class="status-indicator">
265
+ <span class="status-dot"></span>
266
+ Online
267
+ </div>
268
+ </div>
269
+
270
+ <div id="chatbox">
271
+ <div id="typing-indicator" style="display: none;">
272
+ <div class="typing-dot"></div>
273
+ <div class="typing-dot"></div>
274
+ <div class="typing-dot"></div>
275
  </div>
276
  </div>
277
 
278
+ <div id="user-input-container">
279
+ <input type="text" id="user-input" placeholder="Type your message here..." />
280
+ <span class="material-icons send-icon" onclick="sendMessage()">send</span>
281
+ </div>
282
+
283
+ <div class="bottom-icons">
284
+ <span class="material-icons mic-icon" id="mic-icon">mic</span>
285
+ <span class="material-icons call-icon" id="call-icon">call</span>
286
+ </div>
287
+ </div>
288
+
289
+ <script src="/static/script.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  </body>
291
  </html>