nixaut-codelabs commited on
Commit
7f3fa46
·
verified ·
1 Parent(s): e948fb1

mesajlar fazla kompleks. Daha basit tasarım istiyorum mesajlara. Cardlara falan yani mesajlardaki. Ayrıca kullanıcı mesajında nedense kayma falan oluyor taşma oluyor yazıda. Chats kısmı da yok solda nedense.

Browse files
Files changed (4) hide show
  1. components/sidebar.js +5 -7
  2. index.html +15 -17
  3. script.js +18 -23
  4. style.css +13 -15
components/sidebar.js CHANGED
@@ -6,8 +6,8 @@ class CustomSidebar extends HTMLElement {
6
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
7
  * { font-family: 'Inter', sans-serif; }
8
  .sidebar {
9
- width: 320px;
10
- background: rgba(17, 24, 39, 0.95);
11
  backdrop-filter: blur(20px);
12
  -webkit-backdrop-filter: blur(20px);
13
  border-right: 1px solid rgba(255, 255, 255, 0.1);
@@ -236,10 +236,9 @@ class CustomSidebar extends HTMLElement {
236
  </svg>
237
  New Chat
238
  </button>
239
-
240
  <div class="nav-section">
241
  <div class="nav-title">Recent Chats</div>
242
- <div class="chat-history" id="recentChats">
243
  <div class="history-item">
244
  <svg class="history-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
245
  <path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
@@ -270,10 +269,9 @@ class CustomSidebar extends HTMLElement {
270
  </svg>
271
  TypeScript best practices
272
  </div>
273
- </div>
274
  </div>
275
-
276
- <div class="divider"></div>
277
 
278
  <div class="nav-section">
279
  <div class="nav-title">Araçlar</div>
 
6
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
7
  * { font-family: 'Inter', sans-serif; }
8
  .sidebar {
9
+ width: 280px;
10
+ background: rgba(17, 24, 39, 0.95);
11
  backdrop-filter: blur(20px);
12
  -webkit-backdrop-filter: blur(20px);
13
  border-right: 1px solid rgba(255, 255, 255, 0.1);
 
236
  </svg>
237
  New Chat
238
  </button>
 
239
  <div class="nav-section">
240
  <div class="nav-title">Recent Chats</div>
241
+ <div class="chat-history" id="recentChats">
242
  <div class="history-item">
243
  <svg class="history-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
244
  <path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
 
269
  </svg>
270
  TypeScript best practices
271
  </div>
272
+ </div>
273
  </div>
274
+ <div class="divider"></div>
 
275
 
276
  <div class="nav-section">
277
  <div class="nav-title">Araçlar</div>
index.html CHANGED
@@ -88,32 +88,30 @@
88
  <!-- Messages Container -->
89
  <div id="chatContainer" class="flex-1 overflow-y-auto scroll-smooth p-4 space-y-4" style="scrollbar-width: thin; scrollbar-color: #525252 #18181b;">
90
  <!-- AI Welcome Message -->
91
- <div class="flex items-start space-x-3 message-slide-in">
92
- <div class="w-8 h-8 rounded-full bg-gradient-to-br from-white to-zinc-600 flex items-center justify-center flex-shrink-0">
93
- <i data-feather="cpu" class="w-4 h-4 text-zinc-900"></i>
94
  </div>
95
- <div class="max-w-xl">
96
- <div class="bg-zinc-900 rounded-2xl rounded-tl-sm p-4 glow hover:scale-[1.02] transition-all duration-200">
97
- <p class="text-white leading-relaxed">Welcome to Neural Nexus AI 🚀</p>
98
- <p class="text-zinc-400 text-sm mt-2">I'm your advanced AI assistant. How can I help you today?</p>
99
  </div>
100
- <p class="text-xs text-zinc-500 mt-1">Just now</p>
101
  </div>
102
  </div>
103
-
104
- <div id="typingIndicator" class="hidden flex items-center space-x-3">
105
- <div class="w-8 h-8 rounded-full bg-gradient-to-br from-white to-zinc-600 flex items-center justify-center flex-shrink-0">
106
- <i data-feather="cpu" class="w-4 h-4 text-zinc-900"></i>
107
  </div>
108
- <div class="bg-zinc-900 rounded-2xl rounded-tl-sm p-4">
109
  <div class="typing-indicator flex space-x-1">
110
- <span class="w-2 h-2 bg-white rounded-full"></span>
111
- <span class="w-2 h-2 bg-white rounded-full"></span>
112
- <span class="w-2 h-2 bg-white rounded-full"></span>
113
  </div>
114
  </div>
115
  </div>
116
- </div>
117
  <!-- Advanced Input Area -->
118
  <div class="bg-zinc-900/40 backdrop-blur-xl border-t border-zinc-800/60 p-6 mt-auto">
119
  <!-- Model Selection & Tokens Bar -->
 
88
  <!-- Messages Container -->
89
  <div id="chatContainer" class="flex-1 overflow-y-auto scroll-smooth p-4 space-y-4" style="scrollbar-width: thin; scrollbar-color: #525252 #18181b;">
90
  <!-- AI Welcome Message -->
91
+ <div class="flex items-start space-x-2 message-slide-in">
92
+ <div class="w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center flex-shrink-0">
93
+ <i data-feather="cpu" class="w-4 h-4 text-zinc-300"></i>
94
  </div>
95
+ <div class="flex-1 max-w-3xl">
96
+ <div class="bg-zinc-800 rounded-lg p-3">
97
+ <p class="text-white text-sm">Welcome to Nixaut Copilot 🚀</p>
98
+ <p class="text-zinc-400 text-sm mt-1">I'm your AI assistant. How can I help you today?</p>
99
  </div>
 
100
  </div>
101
  </div>
102
+ <div id="typingIndicator" class="hidden flex items-start space-x-3">
103
+ <div class="w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center flex-shrink-0">
104
+ <i data-feather="cpu" class="w-4 h-4 text-zinc-300"></i>
 
105
  </div>
106
+ <div class="bg-zinc-800 rounded-lg p-3 max-w-xs">
107
  <div class="typing-indicator flex space-x-1">
108
+ <span class="w-2 h-2 bg-zinc-400 rounded-full"></span>
109
+ <span class="w-2 h-2 bg-zinc-400 rounded-full"></span>
110
+ <span class="w-2 h-2 bg-zinc-400 rounded-full"></span>
111
  </div>
112
  </div>
113
  </div>
114
+ </div>
115
  <!-- Advanced Input Area -->
116
  <div class="bg-zinc-900/40 backdrop-blur-xl border-t border-zinc-800/60 p-6 mt-auto">
117
  <!-- Model Selection & Tokens Bar -->
script.js CHANGED
@@ -102,35 +102,31 @@ function addMessage(content, sender) {
102
 
103
  const messageDiv = document.createElement('div');
104
  messageDiv.className = `flex items-start space-x-3 message-slide-in ${sender === 'user' ? 'flex-row-reverse space-x-reverse' : ''}`;
105
-
106
  if (sender === 'user') {
107
  messageDiv.innerHTML = `
108
  <div class="w-8 h-8 rounded-full bg-zinc-800 flex items-center justify-center flex-shrink-0">
109
  <i data-feather="user" class="w-4 h-4 text-zinc-400"></i>
110
  </div>
111
- <div class="max-w-xl">
112
- <div class="bg-gradient-to-r from-white to-zinc-100 text-zinc-900 rounded-2xl rounded-tr-sm p-4 hover:scale-[1.02] transition-all duration-200 shadow-lg">
113
- <p class="leading-relaxed">${content}</p>
114
  </div>
115
- <p class="text-xs text-zinc-500 mt-1 text-right">${timestamp}</p>
116
  </div>
117
  `;
118
  } else {
119
  const processedContent = marked.parse(content);
120
  messageDiv.innerHTML = `
121
- <div class="w-8 h-8 rounded-full bg-gradient-to-br from-white to-zinc-600 flex items-center justify-center flex-shrink-0">
122
- <i data-feather="cpu" class="w-4 h-4 text-zinc-900"></i>
123
  </div>
124
- <div class="max-w-xl">
125
- <div class="bg-zinc-900 rounded-2xl rounded-tl-sm p-4 glow hover:scale-[1.02] transition-all duration-200">
126
- <div class="markdown text-white">${processedContent}</div>
127
  </div>
128
- <p class="text-xs text-zinc-500 mt-1">${timestamp}</p>
129
  </div>
130
  `;
131
  }
132
-
133
- chatContainer.appendChild(messageDiv);
134
  chatContainer.scrollTop = chatContainer.scrollHeight;
135
 
136
  // Re-initialize feather icons for new elements
@@ -352,20 +348,19 @@ function clearChat() {
352
  if (confirm('Are you sure you want to clear the entire chat history?')) {
353
  const chatContainer = document.getElementById('chatContainer');
354
  chatContainer.innerHTML = `
355
- <div class="flex items-start space-x-3 message-slide-in">
356
- <div class="w-8 h-8 rounded-full bg-gradient-to-br from-white to-zinc-600 flex items-center justify-center flex-shrink-0">
357
- <i data-feather="cpu" class="w-4 h-4 text-zinc-900"></i>
358
  </div>
359
- <div class="max-w-xl">
360
- <div class="bg-zinc-900 rounded-2xl rounded-tl-sm p-4 glow hover:scale-[1.02] transition-all duration-200">
361
- <p class="text-white leading-relaxed">Welcome to Nixaut Copilot 🚀</p>
362
- <p class="text-zinc-400 text-sm mt-2">I'm your advanced AI assistant. How can I help you today?</p>
363
- </div>
364
- <p class="text-xs text-zinc-500 mt-1">Just now</p>
365
  </div>
366
  </div>
367
  `;
368
- chatHistory = [];
369
  saveChatHistory();
370
  feather.replace();
371
  }
 
102
 
103
  const messageDiv = document.createElement('div');
104
  messageDiv.className = `flex items-start space-x-3 message-slide-in ${sender === 'user' ? 'flex-row-reverse space-x-reverse' : ''}`;
 
105
  if (sender === 'user') {
106
  messageDiv.innerHTML = `
107
  <div class="w-8 h-8 rounded-full bg-zinc-800 flex items-center justify-center flex-shrink-0">
108
  <i data-feather="user" class="w-4 h-4 text-zinc-400"></i>
109
  </div>
110
+ <div class="flex-1 max-w-3xl">
111
+ <div class="bg-zinc-700 rounded-lg p-3">
112
+ <p class="text-white text-sm break-words">${content}</p>
113
  </div>
 
114
  </div>
115
  `;
116
  } else {
117
  const processedContent = marked.parse(content);
118
  messageDiv.innerHTML = `
119
+ <div class="w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center flex-shrink-0">
120
+ <i data-feather="cpu" class="w-4 h-4 text-zinc-300"></i>
121
  </div>
122
+ <div class="flex-1 max-w-3xl">
123
+ <div class="bg-zinc-800 rounded-lg p-3">
124
+ <div class="markdown text-white text-sm">${processedContent}</div>
125
  </div>
 
126
  </div>
127
  `;
128
  }
129
+ chatContainer.appendChild(messageDiv);
 
130
  chatContainer.scrollTop = chatContainer.scrollHeight;
131
 
132
  // Re-initialize feather icons for new elements
 
348
  if (confirm('Are you sure you want to clear the entire chat history?')) {
349
  const chatContainer = document.getElementById('chatContainer');
350
  chatContainer.innerHTML = `
351
+ <div class="flex items-start space-x-2 message-slide-in">
352
+ <div class="w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center flex-shrink-0">
353
+ <i data-feather="cpu" class="w-4 h-4 text-zinc-300"></i>
354
  </div>
355
+ <div class="flex-1 max-w-3xl">
356
+ <div class="bg-zinc-800 rounded-lg p-3">
357
+ <p class="text-white text-sm">Welcome to Nixaut Copilot 🚀</p>
358
+ <p class="text-zinc-400 text-sm mt-1">I'm your AI assistant. How can I help you today?</p>
359
+ </div>
 
360
  </div>
361
  </div>
362
  `;
363
+ chatHistory = [];
364
  saveChatHistory();
365
  feather.replace();
366
  }
style.css CHANGED
@@ -70,34 +70,32 @@ body {
70
  .float-animation {
71
  animation: float 3s ease-in-out infinite;
72
  }
73
-
74
  /* Markdown Styling */
75
- .markdown h1 { @apply text-2xl font-bold text-white mb-4 mt-6; }
76
- .markdown h2 { @apply text-xl font-semibold text-white mb-3 mt-5; }
77
- .markdown h3 { @apply text-lg font-medium text-white mb-2 mt-4; }
78
- .markdown p { @apply text-zinc-300 mb-4 leading-relaxed; }
79
- .markdown code { @apply bg-zinc-800 px-1 py-0.5 rounded text-sm text-green-400; }
80
  .markdown pre {
81
- @apply bg-zinc-900 rounded-lg p-4 overflow-x-auto mb-4 border border-zinc-800;
82
  font-family: 'Courier New', monospace;
83
  }
84
  .markdown pre code { @apply bg-transparent text-zinc-300; }
85
- .markdown ul { @apply list-disc list-inside text-zinc-300 mb-4 space-y-1; }
86
- .markdown ol { @apply list-decimal list-inside text-zinc-300 mb-4 space-y-1; }
87
  .markdown blockquote {
88
- @apply border-l-4 border-zinc-600 pl-4 italic text-zinc-400 mb-4;
89
  }
90
- .markdown a { @apply text-white underline underline-offset-2 hover:text-zinc-300; }
91
  .markdown table {
92
- @apply w-full border-collapse mb-4;
93
  }
94
  .markdown th {
95
- @apply border border-zinc-700 px-4 py-2 bg-zinc-900 text-left font-semibold;
96
  }
97
  .markdown td {
98
- @apply border border-zinc-700 px-4 py-2 text-zinc-300;
99
  }
100
-
101
  /* Transition Classes */
102
  .transition-all {
103
  transition-property: all;
 
70
  .float-animation {
71
  animation: float 3s ease-in-out infinite;
72
  }
 
73
  /* Markdown Styling */
74
+ .markdown h1 { @apply text-lg font-bold text-white mb-2 mt-3; }
75
+ .markdown h2 { @apply text-base font-semibold text-white mb-2 mt-2; }
76
+ .markdown h3 { @apply text-sm font-medium text-white mb-1 mt-2; }
77
+ .markdown p { @apply text-zinc-200 mb-2 leading-relaxed; }
78
+ .markdown code { @apply bg-zinc-700 px-1 py-0.5 rounded text-xs text-green-400; }
79
  .markdown pre {
80
+ @apply bg-zinc-900 rounded p-2 overflow-x-auto mb-2 text-xs;
81
  font-family: 'Courier New', monospace;
82
  }
83
  .markdown pre code { @apply bg-transparent text-zinc-300; }
84
+ .markdown ul { @apply list-disc list-inside text-zinc-200 mb-2 space-y-1 text-sm; }
85
+ .markdown ol { @apply list-decimal list-inside text-zinc-200 mb-2 space-y-1 text-sm; }
86
  .markdown blockquote {
87
+ @apply border-l-2 border-zinc-600 pl-3 italic text-zinc-400 mb-2 text-sm;
88
  }
89
+ .markdown a { @apply text-white underline hover:text-zinc-300 text-sm; }
90
  .markdown table {
91
+ @apply w-full border-collapse mb-2 text-sm;
92
  }
93
  .markdown th {
94
+ @apply border border-zinc-700 px-2 py-1 bg-zinc-900 text-left text-sm;
95
  }
96
  .markdown td {
97
+ @apply border border-zinc-700 px-2 py-1 text-zinc-300 text-sm;
98
  }
 
99
  /* Transition Classes */
100
  .transition-all {
101
  transition-property: all;