Redsputnik commited on
Commit
29b86cb
·
verified ·
1 Parent(s): e0d7c58

Die icons für die promts sollen kleiner. Es ist nicht korrekt für Handy display optimiert. Der Themen mode Knopf funktioniert nicht mehr. Es soll noch eine folder Übersicht rein. Er soll als Assistent agieren.

Browse files
Files changed (3) hide show
  1. index.html +51 -14
  2. script.js +49 -15
  3. style.css +22 -4
index.html CHANGED
@@ -44,35 +44,72 @@
44
  </button>
45
  </div>
46
  </div>
47
-
48
  <!-- Prompt Buttons -->
49
  <div class="prompt-grid w-full max-w-4xl mb-6">
50
  <button class="prompt-button" data-prompt="social-media">
51
- <i data-feather="users"></i>
52
- <span>Social Media Expert</span>
53
  </button>
54
  <button class="prompt-button" data-prompt="marketing">
55
- <i data-feather="trending-up"></i>
56
- <span>Marketing Expert</span>
57
  </button>
58
  <button class="prompt-button" data-prompt="coding">
59
- <i data-feather="code"></i>
60
- <span>Coding Expert</span>
61
  </button>
62
  <button class="prompt-button" data-prompt="upload">
63
- <i data-feather="upload"></i>
64
- <span>Upload PDF</span>
65
  </button>
66
  </div>
67
-
68
- <div class="flex gap-4 w-full max-w-4xl">
69
- <div class="w-64 bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  <div class="p-4 border-b border-gray-200 dark:border-gray-700">
71
  <h2 class="font-semibold flex items-center gap-2">
72
  <i data-feather="lock" class="w-4 h-4"></i> Chat History
73
  </h2>
74
  </div>
75
- <div id="chat-history" class="h-96 overflow-y-auto p-2 space-y-1">
76
  <!-- Chat history items will appear here -->
77
  </div>
78
  <div class="p-4 border-t border-gray-200 dark:border-gray-700">
@@ -82,7 +119,7 @@
82
  </div>
83
  </div>
84
  <div class="flex-1 bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden">
85
- <div id="chat-container" class="h-96 overflow-y-auto p-4 space-y-4">
86
  <!-- Chat messages will appear here -->
87
  <div class="text-center py-8 text-gray-500 dark:text-gray-400">
88
  <i data-feather="message-circle" class="w-12 h-12 mx-auto mb-2"></i>
 
44
  </button>
45
  </div>
46
  </div>
 
47
  <!-- Prompt Buttons -->
48
  <div class="prompt-grid w-full max-w-4xl mb-6">
49
  <button class="prompt-button" data-prompt="social-media">
50
+ <i data-feather="users" class="w-4 h-4 mb-1"></i>
51
+ <span class="text-xs">Social Media</span>
52
  </button>
53
  <button class="prompt-button" data-prompt="marketing">
54
+ <i data-feather="trending-up" class="w-4 h-4 mb-1"></i>
55
+ <span class="text-xs">Marketing</span>
56
  </button>
57
  <button class="prompt-button" data-prompt="coding">
58
+ <i data-feather="code" class="w-4 h-4 mb-1"></i>
59
+ <span class="text-xs">Coding</span>
60
  </button>
61
  <button class="prompt-button" data-prompt="upload">
62
+ <i data-feather="upload" class="w-4 h-4 mb-1"></i>
63
+ <span class="text-xs">Upload</span>
64
  </button>
65
  </div>
66
+ <div class="flex flex-col lg:flex-row gap-4 w-full max-w-4xl">
67
+ <div class="w-full lg:w-64 bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden">
68
+ <div class="p-4 border-b border-gray-200 dark:border-gray-700">
69
+ <h2 class="font-semibold flex items-center gap-2">
70
+ <i data-feather="folder" class="w-4 h-4"></i> Folder Overview
71
+ </h2>
72
+ </div>
73
+ <div id="folder-overview" class="h-48 lg:h-96 overflow-y-auto p-2 space-y-1">
74
+ <div class="flex items-center gap-2 text-sm p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded">
75
+ <i data-feather="folder" class="w-3 h-3 text-yellow-500"></i>
76
+ <span>Documents/</span>
77
+ <span class="text-xs text-gray-500 ml-auto">12 files</span>
78
+ </div>
79
+ <div class="flex items-center gap-2 text-sm p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded">
80
+ <i data-feather="folder" class="w-3 h-3 text-blue-500"></i>
81
+ <span>Images/</span>
82
+ <span class="text-xs text-gray-500 ml-auto">47 files</span>
83
+ </div>
84
+ <div class="flex items-center gap-2 text-sm p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded">
85
+ <i data-feather="folder" class="w-3 h-3 text-green-500"></i>
86
+ <span>Media/</span>
87
+ <span class="text-xs text-gray-500 ml-auto">23 files</span>
88
+ </div>
89
+ <div class="flex items-center gap-2 text-sm p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded">
90
+ <i data-feather="folder" class="w-3 h-3 text-purple-500"></i>
91
+ <span>Downloads/</span>
92
+ <span class="text-xs text-gray-500 ml-auto">8 files</span>
93
+ </div>
94
+ <div class="flex items-center gap-2 text-sm p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded">
95
+ <i data-feather="folder" class="w-3 h-3 text-red-500"></i>
96
+ <span>Backups/</span>
97
+ <span class="text-xs text-gray-500 ml-auto">5 files</span>
98
+ </div>
99
+ <div class="flex items-center gap-2 text-sm p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded">
100
+ <i data-feather="folder" class="w-3 h-3 text-indigo-500"></i>
101
+ <span>Projects/</span>
102
+ <span class="text-xs text-gray-500 ml-auto">15 files</span>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <div class="w-full lg:w-64 bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden">
107
  <div class="p-4 border-b border-gray-200 dark:border-gray-700">
108
  <h2 class="font-semibold flex items-center gap-2">
109
  <i data-feather="lock" class="w-4 h-4"></i> Chat History
110
  </h2>
111
  </div>
112
+ <div id="chat-history" class="h-48 lg:h-96 overflow-y-auto p-2 space-y-1">
113
  <!-- Chat history items will appear here -->
114
  </div>
115
  <div class="p-4 border-t border-gray-200 dark:border-gray-700">
 
119
  </div>
120
  </div>
121
  <div class="flex-1 bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden">
122
+ <div id="chat-container" class="h-96 overflow-y-auto p-4 space-y-4">
123
  <!-- Chat messages will appear here -->
124
  <div class="text-center py-8 text-gray-500 dark:text-gray-400">
125
  <i data-feather="message-circle" class="w-12 h-12 mx-auto mb-2"></i>
script.js CHANGED
@@ -4,7 +4,7 @@ document.addEventListener('DOMContentLoaded', () => {
4
  const html = document.documentElement;
5
  const themeToggle = document.getElementById('theme-toggle');
6
  const redModeToggle = document.getElementById('red-mode-toggle');
7
-
8
  // Theme toggle functionality
9
  const setTheme = (theme) => {
10
  if (theme === 'dark') {
@@ -13,7 +13,10 @@ document.addEventListener('DOMContentLoaded', () => {
13
  html.classList.remove('dark');
14
  }
15
  localStorage.setItem('theme', theme);
 
 
16
  };
 
17
  // Red mode toggle functionality
18
  const setRedMode = (enabled) => {
19
  if (enabled) {
@@ -25,10 +28,24 @@ document.addEventListener('DOMContentLoaded', () => {
25
  feather.replace();
26
  };
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  themeToggle.addEventListener('click', () => {
29
  const isDark = html.classList.contains('dark');
30
  setTheme(isDark ? 'light' : 'dark');
31
- feather.replace();
32
  });
33
 
34
  redModeToggle.addEventListener('click', () => {
@@ -43,8 +60,7 @@ document.addEventListener('DOMContentLoaded', () => {
43
  const savedRedMode = localStorage.getItem('redMode') === '1';
44
  setTheme(savedTheme);
45
  if (savedRedMode) setRedMode(true);
46
-
47
- // File upload handling
48
  const fileUpload = document.getElementById('file-upload');
49
  let uploadedFileName = '';
50
 
@@ -56,12 +72,11 @@ document.addEventListener('DOMContentLoaded', () => {
56
  alert(`File "${file.name}" ready for secure upload`);
57
  // Auto-send file info to chat
58
  addMessageToChat('user', file.name, true);
59
-
60
- // Simulate assistant response for uploaded file
61
  setTimeout(() => {
62
- addMessageToChat('assistant', `I've received your file "${file.name}". You can now ask questions about its content.`);
63
  }, 1000);
64
- }
65
  });
66
 
67
  // Voice recording functionality
@@ -131,7 +146,7 @@ document.addEventListener('DOMContentLoaded', () => {
131
  }, 1000);
132
  });
133
  });
134
- // Chat functionality
135
  const chatForm = document.getElementById('chat-form');
136
  const messageInput = document.getElementById('message-input');
137
  const chatContainer = document.getElementById('chat-container');
@@ -143,17 +158,38 @@ document.addEventListener('DOMContentLoaded', () => {
143
  if (message) {
144
  // Add user message to chat
145
  addMessageToChat('user', message);
146
-
147
  // Simulate assistant response (in a real app, this would be an API call to your NAS)
148
  setTimeout(() => {
149
- addMessageToChat('assistant', `I received: "${message}". In a real implementation, this would be processed by your NAS assistant.`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }, 1000);
151
 
152
  // Clear input
153
  messageInput.value = '';
154
  }
155
  });
156
- // Add chat history item
157
  function addChatHistoryItem(timestamp, preview) {
158
  const historyItem = document.createElement('div');
159
  historyItem.id = 'chat-history-item';
@@ -165,7 +201,6 @@ document.addEventListener('DOMContentLoaded', () => {
165
  `;
166
  document.getElementById('chat-history').appendChild(historyItem);
167
  }
168
-
169
  // Enhanced message handling
170
  function addMessageToChat(sender, text, isFile = false) {
171
  const messageDiv = document.createElement('div');
@@ -201,8 +236,7 @@ document.addEventListener('DOMContentLoaded', () => {
201
  chatContainer.scrollTop = chatContainer.scrollHeight;
202
  feather.replace();
203
  }
204
-
205
- // Clear history
206
  document.getElementById('clear-history').addEventListener('click', () => {
207
  if (confirm('Clear all chat history?')) {
208
  document.getElementById('chat-history').innerHTML = '';
 
4
  const html = document.documentElement;
5
  const themeToggle = document.getElementById('theme-toggle');
6
  const redModeToggle = document.getElementById('red-mode-toggle');
7
+
8
  // Theme toggle functionality
9
  const setTheme = (theme) => {
10
  if (theme === 'dark') {
 
13
  html.classList.remove('dark');
14
  }
15
  localStorage.setItem('theme', theme);
16
+ updateThemeIcons();
17
+ feather.replace();
18
  };
19
+
20
  // Red mode toggle functionality
21
  const setRedMode = (enabled) => {
22
  if (enabled) {
 
28
  feather.replace();
29
  };
30
 
31
+ // Update theme icons based on current theme
32
+ const updateThemeIcons = () => {
33
+ const isDark = html.classList.contains('dark');
34
+ const moonIcon = themeToggle.querySelector('i[data-feather="moon"]');
35
+ const sunIcon = themeToggle.querySelector('i[data-feather="sun"]');
36
+
37
+ if (isDark) {
38
+ moonIcon.classList.add('hidden');
39
+ sunIcon.classList.remove('hidden');
40
+ } else {
41
+ moonIcon.classList.remove('hidden');
42
+ sunIcon.classList.add('hidden');
43
+ }
44
+ };
45
+
46
  themeToggle.addEventListener('click', () => {
47
  const isDark = html.classList.contains('dark');
48
  setTheme(isDark ? 'light' : 'dark');
 
49
  });
50
 
51
  redModeToggle.addEventListener('click', () => {
 
60
  const savedRedMode = localStorage.getItem('redMode') === '1';
61
  setTheme(savedTheme);
62
  if (savedRedMode) setRedMode(true);
63
+ // File upload handling
 
64
  const fileUpload = document.getElementById('file-upload');
65
  let uploadedFileName = '';
66
 
 
72
  alert(`File "${file.name}" ready for secure upload`);
73
  // Auto-send file info to chat
74
  addMessageToChat('user', file.name, true);
75
+ // Simulate assistant response for uploaded file
 
76
  setTimeout(() => {
77
+ addMessageToChat('assistant', `I've successfully received your file "${file.name}". I'm ready to help you analyze its content. What specific information would you like to know about this file?`);
78
  }, 1000);
79
+ }
80
  });
81
 
82
  // Voice recording functionality
 
146
  }, 1000);
147
  });
148
  });
149
+ // Chat functionality
150
  const chatForm = document.getElementById('chat-form');
151
  const messageInput = document.getElementById('message-input');
152
  const chatContainer = document.getElementById('chat-container');
 
158
  if (message) {
159
  // Add user message to chat
160
  addMessageToChat('user', message);
 
161
  // Simulate assistant response (in a real app, this would be an API call to your NAS)
162
  setTimeout(() => {
163
+ const assistantResponses = {
164
+ default: `I understand your message about "${message}". As your NAS assistant, I'm here to help you with secure, local processing of your requests. How can I assist you further?`,
165
+ social: `As your social media assistant, I can help you create engaging content strategies, analyze trends, and optimize your presence across platforms. What specific aspect would you like to focus on?`,
166
+ marketing: `As your marketing expert, I can provide insights on customer acquisition, branding strategies, and digital campaigns. Tell me more about your marketing goals.`,
167
+ coding: `As your coding assistant, I can help with programming challenges, code reviews, and learning new technologies. What are you working on?`,
168
+ file: `I've analyzed your file and found it contains structured data. Would you like me to help you process or extract specific information from it?`
169
+ };
170
+
171
+ let response = assistantResponses.default;
172
+
173
+ // Check for specific context in user message
174
+ if (message.toLowerCase().includes('social') || message.toLowerCase().includes('media')) {
175
+ response = assistantResponses.social;
176
+ } else if (message.toLowerCase().includes('market')) {
177
+ response = assistantResponses.marketing;
178
+ } else if (message.toLowerCase().includes('code') || message.toLowerCase().includes('program')) {
179
+ response = assistantResponses.coding;
180
+ } else if (uploadedFileName) {
181
+ response = assistantResponses.file;
182
+ uploadedFileName = ''; // Reset after use
183
+ }
184
+
185
+ addMessageToChat('assistant', response);
186
  }, 1000);
187
 
188
  // Clear input
189
  messageInput.value = '';
190
  }
191
  });
192
+ // Add chat history item
193
  function addChatHistoryItem(timestamp, preview) {
194
  const historyItem = document.createElement('div');
195
  historyItem.id = 'chat-history-item';
 
201
  `;
202
  document.getElementById('chat-history').appendChild(historyItem);
203
  }
 
204
  // Enhanced message handling
205
  function addMessageToChat(sender, text, isFile = false) {
206
  const messageDiv = document.createElement('div');
 
236
  chatContainer.scrollTop = chatContainer.scrollHeight;
237
  feather.replace();
238
  }
239
+ // Clear history
 
240
  document.getElementById('clear-history').addEventListener('click', () => {
241
  if (confirm('Clear all chat history?')) {
242
  document.getElementById('chat-history').innerHTML = '';
style.css CHANGED
@@ -119,11 +119,10 @@
119
  .chat-message {
120
  animation: fadeIn 0.3s ease-out forwards;
121
  }
122
-
123
  /* Prompt buttons grid */
124
  .prompt-grid {
125
  display: grid;
126
- grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
127
  gap: 0.5rem;
128
  margin-top: 1rem;
129
  }
@@ -133,7 +132,7 @@
133
  flex-direction: column;
134
  align-items: center;
135
  justify-content: center;
136
- padding: 0.75rem;
137
  background: white;
138
  border: 1px solid #e5e7eb;
139
  border-radius: 0.5rem;
@@ -141,6 +140,7 @@
141
  transition: all 0.2s;
142
  text-align: center;
143
  font-size: 0.75rem;
 
144
  }
145
 
146
  .dark .prompt-button {
@@ -160,8 +160,26 @@
160
 
161
  .prompt-button i {
162
  margin-bottom: 0.25rem;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
-
165
  /* Voice recording */
166
  .voice-recording {
167
  animation: pulse 1.5s infinite;
 
119
  .chat-message {
120
  animation: fadeIn 0.3s ease-out forwards;
121
  }
 
122
  /* Prompt buttons grid */
123
  .prompt-grid {
124
  display: grid;
125
+ grid-template-columns: repeat(4, 1fr);
126
  gap: 0.5rem;
127
  margin-top: 1rem;
128
  }
 
132
  flex-direction: column;
133
  align-items: center;
134
  justify-content: center;
135
+ padding: 0.5rem;
136
  background: white;
137
  border: 1px solid #e5e7eb;
138
  border-radius: 0.5rem;
 
140
  transition: all 0.2s;
141
  text-align: center;
142
  font-size: 0.75rem;
143
+ min-height: 60px;
144
  }
145
 
146
  .dark .prompt-button {
 
160
 
161
  .prompt-button i {
162
  margin-bottom: 0.25rem;
163
+ width: 16px !important;
164
+ height: 16px !important;
165
+ }
166
+
167
+ @media (max-width: 640px) {
168
+ .prompt-grid {
169
+ grid-template-columns: repeat(2, 1fr);
170
+ gap: 0.75rem;
171
+ }
172
+
173
+ .prompt-button {
174
+ min-height: 70px;
175
+ padding: 0.75rem;
176
+ }
177
+
178
+ .prompt-button i {
179
+ width: 18px !important;
180
+ height: 18px !important;
181
+ }
182
  }
 
183
  /* Voice recording */
184
  .voice-recording {
185
  animation: pulse 1.5s infinite;