Spaces:
Running
Running
dropdown açılmıyor ayrıca sağdaki bilgi kısmında system statusu capabilitiesi falan direkt sağ kısmı kaldır. Solda ise sohbetler, hesap falan gözüksün. Textarea kısmını çok daha geliştşir, modernleştir ve detaylandır. Token sayısı, model seçme yeri falan orada olacak. Aşırı kaliteli olmalı orası.
Browse files- components/sidebar.js +164 -61
- index.html +108 -150
- script.js +117 -27
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:
|
| 10 |
-
background: rgba(17, 24, 39, 0.
|
| 11 |
backdrop-filter: blur(20px);
|
| 12 |
-webkit-backdrop-filter: blur(20px);
|
| 13 |
border-right: 1px solid rgba(255, 255, 255, 0.1);
|
|
@@ -20,7 +20,8 @@ class CustomSidebar extends HTMLElement {
|
|
| 20 |
z-index: 40;
|
| 21 |
transition: transform 0.3s ease;
|
| 22 |
}
|
| 23 |
-
|
|
|
|
| 24 |
margin-bottom: 2rem;
|
| 25 |
}
|
| 26 |
|
|
@@ -31,29 +32,30 @@ class CustomSidebar extends HTMLElement {
|
|
| 31 |
text-transform: uppercase;
|
| 32 |
letter-spacing: 0.05em;
|
| 33 |
padding: 0 1.5rem;
|
| 34 |
-
margin-bottom: 0.
|
| 35 |
}
|
| 36 |
|
| 37 |
.nav-item {
|
| 38 |
display: flex;
|
| 39 |
align-items: center;
|
| 40 |
gap: 0.75rem;
|
| 41 |
-
padding: 0.
|
| 42 |
color: #d1d5db;
|
| 43 |
text-decoration: none;
|
| 44 |
transition: all 0.2s ease;
|
| 45 |
position: relative;
|
| 46 |
cursor: pointer;
|
|
|
|
|
|
|
| 47 |
}
|
| 48 |
|
| 49 |
.nav-item:hover {
|
| 50 |
-
background: rgba(255, 255, 255, 0.
|
| 51 |
color: #ffffff;
|
| 52 |
-
padding-left: 2rem;
|
| 53 |
}
|
| 54 |
|
| 55 |
.nav-item.active {
|
| 56 |
-
background: rgba(255, 255, 255, 0.
|
| 57 |
color: #ffffff;
|
| 58 |
}
|
| 59 |
|
|
@@ -61,10 +63,13 @@ class CustomSidebar extends HTMLElement {
|
|
| 61 |
content: '';
|
| 62 |
position: absolute;
|
| 63 |
left: 0;
|
| 64 |
-
top:
|
| 65 |
-
|
|
|
|
| 66 |
width: 3px;
|
|
|
|
| 67 |
background: linear-gradient(135deg, #ffffff 0%, #9ca3af 100%);
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
.nav-icon {
|
|
@@ -79,52 +84,138 @@ class CustomSidebar extends HTMLElement {
|
|
| 79 |
|
| 80 |
.new-chat-btn {
|
| 81 |
margin: 0 1.5rem 1.5rem;
|
| 82 |
-
padding: 0.
|
| 83 |
background: linear-gradient(135deg, #ffffff 0%, #9ca3af 100%);
|
| 84 |
color: #111827;
|
| 85 |
border-radius: 12px;
|
| 86 |
font-weight: 600;
|
|
|
|
| 87 |
text-align: center;
|
| 88 |
cursor: pointer;
|
| 89 |
-
transition: all 0.
|
| 90 |
border: none;
|
| 91 |
display: flex;
|
| 92 |
align-items: center;
|
| 93 |
justify-content: center;
|
| 94 |
-
gap: 0.
|
|
|
|
| 95 |
}
|
| 96 |
|
| 97 |
.new-chat-btn:hover {
|
| 98 |
-
transform: translateY(-2px);
|
| 99 |
-
box-shadow: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
}
|
| 101 |
|
| 102 |
.chat-history {
|
| 103 |
-
max-height:
|
| 104 |
overflow-y: auto;
|
| 105 |
margin-bottom: 1rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
.history-item {
|
| 109 |
-
padding: 0.
|
| 110 |
-
color: #
|
| 111 |
font-size: 0.875rem;
|
| 112 |
cursor: pointer;
|
| 113 |
transition: all 0.2s ease;
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
| 117 |
}
|
| 118 |
|
| 119 |
.history-item:hover {
|
| 120 |
-
color: #
|
| 121 |
-
background: rgba(255, 255, 255, 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
}
|
| 123 |
|
| 124 |
.divider {
|
| 125 |
height: 1px;
|
| 126 |
-
background: rgba(255, 255, 255, 0.1);
|
| 127 |
-
margin: 1rem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
@media (max-width: 768px) {
|
|
@@ -140,82 +231,94 @@ class CustomSidebar extends HTMLElement {
|
|
| 140 |
|
| 141 |
<nav class="sidebar">
|
| 142 |
<button onclick="startNewChat()" class="new-chat-btn">
|
| 143 |
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2">
|
| 144 |
<path d="M12 5v14m-7-7h14"/>
|
| 145 |
</svg>
|
| 146 |
-
|
| 147 |
</button>
|
| 148 |
|
| 149 |
<div class="nav-section">
|
| 150 |
-
<div class="nav-title">
|
| 151 |
<div class="chat-history" id="recentChats">
|
| 152 |
-
<div class="history-item">
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
</div>
|
| 157 |
</div>
|
| 158 |
|
| 159 |
<div class="divider"></div>
|
| 160 |
|
| 161 |
<div class="nav-section">
|
| 162 |
-
<div class="nav-title">
|
| 163 |
-
<a href="/" class="nav-item
|
| 164 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 165 |
<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/>
|
| 166 |
<path d="M9 22V12h6v10"/>
|
| 167 |
</svg>
|
| 168 |
-
|
| 169 |
</a>
|
| 170 |
-
<a href="/chat" class="nav-item">
|
| 171 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 172 |
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
| 173 |
</svg>
|
| 174 |
-
|
| 175 |
</a>
|
| 176 |
<a href="/files" class="nav-item">
|
| 177 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 178 |
<path d="M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z"/>
|
| 179 |
<path d="M13 2v7h7"/>
|
| 180 |
</svg>
|
| 181 |
-
|
| 182 |
</a>
|
| 183 |
-
</div>
|
| 184 |
-
|
| 185 |
-
<div class="divider"></div>
|
| 186 |
-
|
| 187 |
-
<div class="nav-section">
|
| 188 |
-
<div class="nav-title">Settings</div>
|
| 189 |
<a href="/settings" class="nav-item">
|
| 190 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 191 |
<circle cx="12" cy="12" r="3"/>
|
| 192 |
<path d="M12 1v6m0 6v6m4.22-13.22l4.24 4.24M1.54 9.96l4.24 4.24m12.44 0l4.24 4.24M1.54 14.04l4.24-4.24"/>
|
| 193 |
</svg>
|
| 194 |
-
|
| 195 |
-
</a>
|
| 196 |
-
<a href="/about" class="nav-item">
|
| 197 |
-
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 198 |
-
<circle cx="12" cy="12" r="10"/>
|
| 199 |
-
<path d="M12 6v6l4 2"/>
|
| 200 |
-
</svg>
|
| 201 |
-
About
|
| 202 |
-
</svg>
|
| 203 |
</a>
|
| 204 |
</div>
|
| 205 |
|
| 206 |
<div class="divider"></div>
|
| 207 |
|
| 208 |
-
<div class="
|
| 209 |
-
<
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
</
|
| 213 |
-
|
| 214 |
-
</
|
| 215 |
</div>
|
| 216 |
</nav>
|
| 217 |
`;
|
| 218 |
-
|
| 219 |
|
| 220 |
// Add methods dynamically since shadow DOM doesn't allow direct access from parent
|
| 221 |
connectedCallback() {
|
|
|
|
| 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);
|
|
|
|
| 20 |
z-index: 40;
|
| 21 |
transition: transform 0.3s ease;
|
| 22 |
}
|
| 23 |
+
|
| 24 |
+
.nav-section {
|
| 25 |
margin-bottom: 2rem;
|
| 26 |
}
|
| 27 |
|
|
|
|
| 32 |
text-transform: uppercase;
|
| 33 |
letter-spacing: 0.05em;
|
| 34 |
padding: 0 1.5rem;
|
| 35 |
+
margin-bottom: 0.75rem;
|
| 36 |
}
|
| 37 |
|
| 38 |
.nav-item {
|
| 39 |
display: flex;
|
| 40 |
align-items: center;
|
| 41 |
gap: 0.75rem;
|
| 42 |
+
padding: 0.875rem 1.5rem;
|
| 43 |
color: #d1d5db;
|
| 44 |
text-decoration: none;
|
| 45 |
transition: all 0.2s ease;
|
| 46 |
position: relative;
|
| 47 |
cursor: pointer;
|
| 48 |
+
border-radius: 0 12px 12px 0;
|
| 49 |
+
margin-right: 0.75rem;
|
| 50 |
}
|
| 51 |
|
| 52 |
.nav-item:hover {
|
| 53 |
+
background: rgba(255, 255, 255, 0.08);
|
| 54 |
color: #ffffff;
|
|
|
|
| 55 |
}
|
| 56 |
|
| 57 |
.nav-item.active {
|
| 58 |
+
background: rgba(255, 255, 255, 0.12);
|
| 59 |
color: #ffffff;
|
| 60 |
}
|
| 61 |
|
|
|
|
| 63 |
content: '';
|
| 64 |
position: absolute;
|
| 65 |
left: 0;
|
| 66 |
+
top: 50%;
|
| 67 |
+
transform: translateY(-50%);
|
| 68 |
+
bottom: auto;
|
| 69 |
width: 3px;
|
| 70 |
+
height: 24px;
|
| 71 |
background: linear-gradient(135deg, #ffffff 0%, #9ca3af 100%);
|
| 72 |
+
border-radius: 0 3px 3px 0;
|
| 73 |
}
|
| 74 |
|
| 75 |
.nav-icon {
|
|
|
|
| 84 |
|
| 85 |
.new-chat-btn {
|
| 86 |
margin: 0 1.5rem 1.5rem;
|
| 87 |
+
padding: 0.875rem 1.5rem;
|
| 88 |
background: linear-gradient(135deg, #ffffff 0%, #9ca3af 100%);
|
| 89 |
color: #111827;
|
| 90 |
border-radius: 12px;
|
| 91 |
font-weight: 600;
|
| 92 |
+
font-size: 0.9375rem;
|
| 93 |
text-align: center;
|
| 94 |
cursor: pointer;
|
| 95 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 96 |
border: none;
|
| 97 |
display: flex;
|
| 98 |
align-items: center;
|
| 99 |
justify-content: center;
|
| 100 |
+
gap: 0.625rem;
|
| 101 |
+
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
|
| 102 |
}
|
| 103 |
|
| 104 |
.new-chat-btn:hover {
|
| 105 |
+
transform: translateY(-2px) scale(1.02);
|
| 106 |
+
box-shadow: 0 8px 25px rgba(255, 255, 255, 0.25);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.new-chat-btn:active {
|
| 110 |
+
transform: translateY(0) scale(0.98);
|
| 111 |
}
|
| 112 |
|
| 113 |
.chat-history {
|
| 114 |
+
max-height: 280px;
|
| 115 |
overflow-y: auto;
|
| 116 |
margin-bottom: 1rem;
|
| 117 |
+
padding-right: 0.5rem;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
.chat-history::-webkit-scrollbar {
|
| 121 |
+
width: 4px;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.chat-history::-webkit-scrollbar-track {
|
| 125 |
+
background: transparent;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.chat-history::-webkit-scrollbar-thumb {
|
| 129 |
+
background: #4b5563;
|
| 130 |
+
border-radius: 2px;
|
| 131 |
}
|
| 132 |
|
| 133 |
.history-item {
|
| 134 |
+
padding: 0.625rem 1.5rem;
|
| 135 |
+
color: #9ca3af;
|
| 136 |
font-size: 0.875rem;
|
| 137 |
cursor: pointer;
|
| 138 |
transition: all 0.2s ease;
|
| 139 |
+
border-radius: 0 8px 8px 0;
|
| 140 |
+
margin-right: 0.75rem;
|
| 141 |
+
line-height: 1.4;
|
| 142 |
+
display: flex;
|
| 143 |
+
align-items: center;
|
| 144 |
+
gap: 0.5rem;
|
| 145 |
}
|
| 146 |
|
| 147 |
.history-item:hover {
|
| 148 |
+
color: #ffffff;
|
| 149 |
+
background: rgba(255, 255, 255, 0.06);
|
| 150 |
+
padding-left: 2rem;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
.history-icon {
|
| 154 |
+
width: 16px;
|
| 155 |
+
height: 16px;
|
| 156 |
+
opacity: 0.6;
|
| 157 |
}
|
| 158 |
|
| 159 |
.divider {
|
| 160 |
height: 1px;
|
| 161 |
+
background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
|
| 162 |
+
margin: 1.5rem 1.5rem 1rem;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.account-section {
|
| 166 |
+
padding: 1rem 1.5rem;
|
| 167 |
+
background: rgba(255, 255, 255, 0.04);
|
| 168 |
+
border-radius: 12px;
|
| 169 |
+
margin: 0 1.5rem;
|
| 170 |
+
display: flex;
|
| 171 |
+
align-items: center;
|
| 172 |
+
gap: 0.75rem;
|
| 173 |
+
cursor: pointer;
|
| 174 |
+
transition: all 0.2s ease;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
.account-section:hover {
|
| 178 |
+
background: rgba(255, 255, 255, 0.08);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
.avatar {
|
| 182 |
+
width: 36px;
|
| 183 |
+
height: 36px;
|
| 184 |
+
border-radius: 50%;
|
| 185 |
+
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
|
| 186 |
+
display: flex;
|
| 187 |
+
align-items: center;
|
| 188 |
+
justify-content: center;
|
| 189 |
+
color: white;
|
| 190 |
+
font-weight: 600;
|
| 191 |
+
font-size: 0.875rem;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.account-info {
|
| 195 |
+
flex: 1;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
.account-name {
|
| 199 |
+
color: #ffffff;
|
| 200 |
+
font-weight: 500;
|
| 201 |
+
font-size: 0.875rem;
|
| 202 |
+
margin-bottom: 0.125rem;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
.account-plan {
|
| 206 |
+
color: #9ca3af;
|
| 207 |
+
font-size: 0.75rem;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
.badge {
|
| 211 |
+
background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
|
| 212 |
+
color: #ffffff;
|
| 213 |
+
padding: 0.25rem 0.625rem;
|
| 214 |
+
border-radius: 6px;
|
| 215 |
+
font-size: 0.625rem;
|
| 216 |
+
font-weight: 600;
|
| 217 |
+
text-transform: uppercase;
|
| 218 |
+
letter-spacing: 0.05em;
|
| 219 |
}
|
| 220 |
|
| 221 |
@media (max-width: 768px) {
|
|
|
|
| 231 |
|
| 232 |
<nav class="sidebar">
|
| 233 |
<button onclick="startNewChat()" class="new-chat-btn">
|
| 234 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5">
|
| 235 |
<path d="M12 5v14m-7-7h14"/>
|
| 236 |
</svg>
|
| 237 |
+
Yeni Sohbet
|
| 238 |
</button>
|
| 239 |
|
| 240 |
<div class="nav-section">
|
| 241 |
+
<div class="nav-title">Son Sohbetler</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"/>
|
| 246 |
+
</svg>
|
| 247 |
+
Responsive tasarım nasıl oluşturulur?
|
| 248 |
+
</div>
|
| 249 |
+
<div class="history-item">
|
| 250 |
+
<svg class="history-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 251 |
+
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
| 252 |
+
</svg>
|
| 253 |
+
JavaScript async paternleri
|
| 254 |
+
</div>
|
| 255 |
+
<div class="history-item">
|
| 256 |
+
<svg class="history-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 257 |
+
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
| 258 |
+
</svg>
|
| 259 |
+
CSS Grid vs Flexbox karşılaştırması
|
| 260 |
+
</div>
|
| 261 |
+
<div class="history-item">
|
| 262 |
+
<svg class="history-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 263 |
+
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
| 264 |
+
</svg>
|
| 265 |
+
React performans ipuçları
|
| 266 |
+
</div>
|
| 267 |
+
<div class="history-item">
|
| 268 |
+
<svg class="history-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 269 |
+
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
| 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>
|
| 280 |
+
<a href="/" class="nav-item">
|
| 281 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 282 |
<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/>
|
| 283 |
<path d="M9 22V12h6v10"/>
|
| 284 |
</svg>
|
| 285 |
+
Ana Sayfa
|
| 286 |
</a>
|
| 287 |
+
<a href="/chat" class="nav-item active">
|
| 288 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 289 |
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
| 290 |
</svg>
|
| 291 |
+
Sohbet
|
| 292 |
</a>
|
| 293 |
<a href="/files" class="nav-item">
|
| 294 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 295 |
<path d="M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z"/>
|
| 296 |
<path d="M13 2v7h7"/>
|
| 297 |
</svg>
|
| 298 |
+
Dosyalarım
|
| 299 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
<a href="/settings" class="nav-item">
|
| 301 |
<svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 302 |
<circle cx="12" cy="12" r="3"/>
|
| 303 |
<path d="M12 1v6m0 6v6m4.22-13.22l4.24 4.24M1.54 9.96l4.24 4.24m12.44 0l4.24 4.24M1.54 14.04l4.24-4.24"/>
|
| 304 |
</svg>
|
| 305 |
+
Ayarlar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
</a>
|
| 307 |
</div>
|
| 308 |
|
| 309 |
<div class="divider"></div>
|
| 310 |
|
| 311 |
+
<div class="account-section" onclick="showAccountModal()">
|
| 312 |
+
<div class="avatar">U</div>
|
| 313 |
+
<div class="account-info">
|
| 314 |
+
<div class="account-name">User</div>
|
| 315 |
+
<div class="account-plan">Pro Plan</div>
|
| 316 |
+
</div>
|
| 317 |
+
<div class="badge">Pro</div>
|
| 318 |
</div>
|
| 319 |
</nav>
|
| 320 |
`;
|
| 321 |
+
}
|
| 322 |
|
| 323 |
// Add methods dynamically since shadow DOM doesn't allow direct access from parent
|
| 324 |
connectedCallback() {
|
index.html
CHANGED
|
@@ -68,7 +68,7 @@
|
|
| 68 |
<!-- Left Sidebar -->
|
| 69 |
<custom-sidebar class="w-64 bg-zinc-900/50 backdrop-blur-xl border-r border-zinc-800"></custom-sidebar>
|
| 70 |
<!-- Main Chat Area -->
|
| 71 |
-
<main class="flex-1 flex flex-col bg-zinc-950 relative overflow-hidden">
|
| 72 |
<!-- Chat Header -->
|
| 73 |
<div class="bg-zinc-900/30 backdrop-blur-lg border-b border-zinc-800 p-4 flex items-center justify-between">
|
| 74 |
<div class="flex items-center space-x-3">
|
|
@@ -114,168 +114,126 @@
|
|
| 114 |
</div>
|
| 115 |
</div>
|
| 116 |
</div>
|
| 117 |
-
<!-- Input Area -->
|
| 118 |
-
<div class="bg-zinc-900/
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
<!-- Right Sidebar -->
|
| 154 |
-
<aside class="w-80 bg-zinc-900/50 backdrop-blur-xl border-l border-zinc-800 p-6 space-y-6">
|
| 155 |
-
<!-- Model Selection -->
|
| 156 |
-
<div class="bg-zinc-800/50 rounded-xl p-4 glow">
|
| 157 |
-
<h3 class="font-semibold text-white mb-3 flex items-center">
|
| 158 |
-
<i data-feather="cpu" class="w-4 h-4 mr-2"></i>
|
| 159 |
-
Model Selection
|
| 160 |
-
</h3>
|
| 161 |
-
<div id="modelDropdown" class="relative">
|
| 162 |
-
<button onclick="toggleModelDropdown()" class="w-full bg-zinc-900 border border-zinc-700 rounded-lg px-4 py-3 text-left text-white flex items-center justify-between hover:border-zinc-600 transition-all duration-200">
|
| 163 |
-
<span id="selectedModel" class="flex items-center">
|
| 164 |
-
<div class="w-2 h-2 bg-green-400 rounded-full mr-2"></div>
|
| 165 |
-
Max
|
| 166 |
-
</span>
|
| 167 |
-
<svg class="w-5 h-5 text-zinc-400 transition-transform" id="modelDropdownArrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 168 |
-
<path d="M6 9l6 6 6-6"/>
|
| 169 |
-
</svg>
|
| 170 |
-
</button>
|
| 171 |
-
<div id="modelDropdownMenu" class="hidden absolute top-full left-0 right-0 mt-2 bg-zinc-900 border border-zinc-700 rounded-lg shadow-xl z-50">
|
| 172 |
-
<div onclick="selectModel('Max')" class="px-4 py-3 text-white hover:bg-zinc-800 cursor-pointer transition-colors duration-150 flex items-center">
|
| 173 |
-
<div class="w-2 h-2 bg-green-400 rounded-full mr-2"></div>
|
| 174 |
-
<div class="flex-1">
|
| 175 |
-
<div class="font-medium">Max</div>
|
| 176 |
-
<div class="text-xs text-zinc-400">Most capable, best quality</div>
|
| 177 |
-
</div>
|
| 178 |
-
</div>
|
| 179 |
-
<div onclick="selectModel('Turbo')" class="px-4 py-3 text-white hover:bg-zinc-800 cursor-pointer transition-colors duration-150 flex items-center">
|
| 180 |
-
<div class="w-2 h-2 bg-blue-400 rounded-full mr-2"></div>
|
| 181 |
-
<div class="flex-1">
|
| 182 |
-
<div class="font-medium">Turbo</div>
|
| 183 |
-
<div class="text-xs text-zinc-400">Fast responses, good quality</div>
|
| 184 |
</div>
|
| 185 |
</div>
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
|
|
|
|
|
|
| 191 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
</div>
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
<div class="
|
| 196 |
-
<div class="font-medium">Deep Research</div>
|
| 197 |
-
<div class="text-xs text-zinc-400">Advanced analysis & insights</div>
|
| 198 |
-
</div>
|
| 199 |
</div>
|
| 200 |
</div>
|
| 201 |
</div>
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
<span>Data Analysis</span>
|
| 235 |
-
</div>
|
| 236 |
-
<div class="flex items-center space-x-2 text-sm text-zinc-400">
|
| 237 |
-
<div class="w-2 h-2 bg-green-400 rounded-full"></div>
|
| 238 |
-
<span>Creative Writing</span>
|
| 239 |
-
</div>
|
| 240 |
-
<div class="flex items-center space-x-2 text-sm text-zinc-400">
|
| 241 |
-
<div class="w-2 h-2 bg-green-400 rounded-full"></div>
|
| 242 |
-
<span>Problem Solving</span>
|
| 243 |
</div>
|
| 244 |
</div>
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
<!-- Memory Usage -->
|
| 262 |
-
<div>
|
| 263 |
-
<h3 class="font-semibold text-white mb-3 flex items-center">
|
| 264 |
-
<i data-feather="hard-drive" class="w-4 h-4 mr-2"></i>
|
| 265 |
-
Memory Context
|
| 266 |
-
</h3>
|
| 267 |
-
<div class="bg-zinc-800/50 rounded-xl p-3">
|
| 268 |
-
<div class="flex justify-between text-xs mb-2">
|
| 269 |
-
<span class="text-zinc-400">Used</span>
|
| 270 |
-
<span class="text-white">68%</span>
|
| 271 |
</div>
|
| 272 |
-
<div class="
|
| 273 |
-
<
|
|
|
|
|
|
|
| 274 |
</div>
|
| 275 |
-
<p class="text-xs text-zinc-500 mt-2">6,800 / 10,000 tokens</p>
|
| 276 |
</div>
|
| 277 |
</div>
|
| 278 |
-
|
| 279 |
<script src="components/header.js"></script>
|
| 280 |
<script src="components/sidebar.js"></script>
|
| 281 |
<script src="script.js"></script>
|
|
|
|
| 68 |
<!-- Left Sidebar -->
|
| 69 |
<custom-sidebar class="w-64 bg-zinc-900/50 backdrop-blur-xl border-r border-zinc-800"></custom-sidebar>
|
| 70 |
<!-- Main Chat Area -->
|
| 71 |
+
<main class="flex-1 flex flex-col bg-zinc-950 relative overflow-hidden max-h-full">
|
| 72 |
<!-- Chat Header -->
|
| 73 |
<div class="bg-zinc-900/30 backdrop-blur-lg border-b border-zinc-800 p-4 flex items-center justify-between">
|
| 74 |
<div class="flex items-center space-x-3">
|
|
|
|
| 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 -->
|
| 120 |
+
<div class="mb-4 flex items-center justify-between">
|
| 121 |
+
<div class="flex items-center space-x-4">
|
| 122 |
+
<!-- Model Selector -->
|
| 123 |
+
<div id="modelDropdown" class="relative">
|
| 124 |
+
<button onclick="toggleModelDropdown()" class="flex items-center space-x-2 bg-zinc-800/60 hover:bg-zinc-800/80 border border-zinc-700/50 hover:border-zinc-600/50 rounded-lg px-3 py-2 text-sm text-white transition-all duration-200">
|
| 125 |
+
<div id="modelIndicator" class="w-2 h-2 bg-green-400 rounded-full"></div>
|
| 126 |
+
<span id="selectedModelText" class="font-medium">Max</span>
|
| 127 |
+
<svg class="w-4 h-4 text-zinc-400 transition-transform" id="modelDropdownArrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 128 |
+
<path d="M6 9l6 6 6-6"/>
|
| 129 |
+
</svg>
|
| 130 |
+
</button>
|
| 131 |
+
<div id="modelDropdownMenu" class="hidden absolute bottom-full left-0 mb-2 bg-zinc-900 border border-zinc-700 rounded-lg shadow-2xl z-50 min-w-[200px]">
|
| 132 |
+
<div onclick="selectModel('Max')" class="px-3 py-2 text-white hover:bg-zinc-800 cursor-pointer transition-colors duration-150 flex items-center space-x-2">
|
| 133 |
+
<div class="w-2 h-2 bg-green-400 rounded-full"></div>
|
| 134 |
+
<div>
|
| 135 |
+
<div class="font-medium text-sm">Max</div>
|
| 136 |
+
<div class="text-xs text-zinc-400">En yetenekli</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
<div onclick="selectModel('Turbo')" class="px-3 py-2 text-white hover:bg-zinc-800 cursor-pointer transition-colors duration-150 flex items-center space-x-2">
|
| 140 |
+
<div class="w-2 h-2 bg-blue-400 rounded-full"></div>
|
| 141 |
+
<div>
|
| 142 |
+
<div class="font-medium text-sm">Turbo</div>
|
| 143 |
+
<div class="text-xs text-zinc-400">Hızlı yanıt</div>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
<div onclick="selectModel('Lite')" class="px-3 py-2 text-white hover:bg-zinc-800 cursor-pointer transition-colors duration-150 flex items-center space-x-2">
|
| 147 |
+
<div class="w-2 h-2 bg-yellow-400 rounded-full"></div>
|
| 148 |
+
<div>
|
| 149 |
+
<div class="font-medium text-sm">Lite</div>
|
| 150 |
+
<div class="text-xs text-zinc-400">Ekonomik</div>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
</div>
|
| 154 |
</div>
|
| 155 |
+
|
| 156 |
+
<!-- Web Search Toggle -->
|
| 157 |
+
<button id="webSearchToggle" onclick="toggleWebSearch()" class="flex items-center space-x-1.5 bg-zinc-800/60 hover:bg-zinc-800/80 border border-zinc-700/50 hover:border-zinc-600/50 rounded-lg px-3 py-2 text-sm text-white transition-all duration-200">
|
| 158 |
+
<i data-feather="search" class="w-3.5 h-3.5"></i>
|
| 159 |
+
<span>Web</span>
|
| 160 |
+
<div class="w-8 h-4 bg-zinc-700 rounded-full relative">
|
| 161 |
+
<div id="webSearchToggleCircle" class="absolute left-0.5 top-0.5 w-3 h-3 bg-zinc-500 rounded-full transition-transform duration-200"></div>
|
| 162 |
</div>
|
| 163 |
+
</button>
|
| 164 |
+
</div>
|
| 165 |
+
|
| 166 |
+
<!-- Token Counter -->
|
| 167 |
+
<div class="flex items-center space-x-3">
|
| 168 |
+
<div class="flex items-center space-x-2">
|
| 169 |
+
<i data-feather="cpu" class="w-3.5 h-3.5 text-zinc-400"></i>
|
| 170 |
+
<span id="tokenCount" class="text-xs text-zinc-400 font-medium">0 / 4096 tokens</span>
|
| 171 |
</div>
|
| 172 |
+
<!-- Progress Bar -->
|
| 173 |
+
<div class="w-20 bg-zinc-800 rounded-full h-1.5 relative overflow-hidden">
|
| 174 |
+
<div id="tokenProgressBar" class="absolute top-0 left-0 h-full bg-gradient-to-r from-white to-zinc-400 rounded-full transition-all duration-300" style="width: 0%"></div>
|
|
|
|
|
|
|
|
|
|
| 175 |
</div>
|
| 176 |
</div>
|
| 177 |
</div>
|
| 178 |
+
|
| 179 |
+
<!-- Main Input Container -->
|
| 180 |
+
<div class="relative bg-zinc-800/40 rounded-2xl border border-zinc-700/50 hover:border-zinc-600/50 transition-all duration-200 focus-within:border-white/50 focus-within:shadow-lg focus-within:shadow-white/5">
|
| 181 |
+
<!-- Textarea -->
|
| 182 |
+
<textarea
|
| 183 |
+
id="messageInput"
|
| 184 |
+
rows="1"
|
| 185 |
+
placeholder="Mesajınızı buraya yazın... (@ ile belge ekle, / komutlar için)"
|
| 186 |
+
class="w-full bg-transparent text-white placeholder-zinc-500 resize-none focus:outline-none px-4 py-3.5 pr-24 text-sm leading-relaxed"
|
| 187 |
+
style="min-height: 52px; max-height: 120px;"
|
| 188 |
+
onkeypress="handleKeyPress(event)"
|
| 189 |
+
oninput="handleInput(this)"
|
| 190 |
+
></textarea>
|
| 191 |
+
|
| 192 |
+
<!-- Action Buttons -->
|
| 193 |
+
<div class="absolute right-2 bottom-2 flex items-center space-x-1.5">
|
| 194 |
+
<button onclick="attachFile()" class="p-2 hover:bg-zinc-700/50 rounded-lg transition-all duration-200 group">
|
| 195 |
+
<i data-feather="paperclip" class="w-4 h-4 text-zinc-400 group-hover:text-white"></i>
|
| 196 |
+
</button>
|
| 197 |
+
<button onclick="showVoiceInput()" class="p-2 hover:bg-zinc-700/50 rounded-lg transition-all duration-200 group">
|
| 198 |
+
<i data-feather="mic" class="w-4 h-4 text-zinc-400 group-hover:text-white"></i>
|
| 199 |
+
</button>
|
| 200 |
+
<button onclick="stopGeneration()" id="stopButton" class="hidden p-2 hover:bg-red-500/20 rounded-lg transition-all duration-200 group">
|
| 201 |
+
<i data-feather="square" class="w-4 h-4 text-red-400 group-hover:text-red-300"></i>
|
| 202 |
+
</button>
|
| 203 |
+
<button
|
| 204 |
+
onclick="sendMessage()"
|
| 205 |
+
id="sendButton"
|
| 206 |
+
class="p-2 bg-gradient-to-r from-white to-zinc-200 text-zinc-900 rounded-lg hover:scale-105 transition-all duration-200 hover:shadow-lg hover:shadow-white/20 disabled:opacity-50 disabled:cursor-not-allowed"
|
| 207 |
+
>
|
| 208 |
+
<i data-feather="send" class="w-4 h-4"></i>
|
| 209 |
+
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
</div>
|
| 211 |
</div>
|
| 212 |
+
|
| 213 |
+
<!-- Bottom Actions Bar -->
|
| 214 |
+
<div class="mt-3 flex items-center justify-between">
|
| 215 |
+
<div class="flex items-center space-x-3">
|
| 216 |
+
<button onclick="clearChat()" class="text-xs text-zinc-500 hover:text-white transition-colors duration-200 flex items-center space-x-1">
|
| 217 |
+
<i data-feather="trash-2" class="w-3 h-3"></i>
|
| 218 |
+
<span>Temizle</span>
|
| 219 |
+
</button>
|
| 220 |
+
<button onclick="exportChat()" class="text-xs text-zinc-500 hover:text-white transition-colors duration-200 flex items-center space-x-1">
|
| 221 |
+
<i data-feather="download" class="w-3 h-3"></i>
|
| 222 |
+
<span>Dışa Aktar</span>
|
| 223 |
+
</button>
|
| 224 |
+
<button onclick="showSettings()" class="text-xs text-zinc-500 hover:text-white transition-colors duration-200 flex items-center space-x-1">
|
| 225 |
+
<i data-feather="settings" class="w-3 h-3"></i>
|
| 226 |
+
<span>Ayarlar</span>
|
| 227 |
+
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
</div>
|
| 229 |
+
<div class="flex items-center space-x-2 text-xs text-zinc-500">
|
| 230 |
+
<span>Enter gönderir</span>
|
| 231 |
+
<span>•</span>
|
| 232 |
+
<span>Shift+Enter yeni satır</span>
|
| 233 |
</div>
|
|
|
|
| 234 |
</div>
|
| 235 |
</div>
|
| 236 |
+
</main>
|
| 237 |
<script src="components/header.js"></script>
|
| 238 |
<script src="components/sidebar.js"></script>
|
| 239 |
<script src="script.js"></script>
|
script.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
|
|
| 1 |
// Global Variables
|
| 2 |
let chatHistory = [];
|
| 3 |
let currentModel = 'Max';
|
| 4 |
let isCompactMode = false;
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
// Initialize
|
| 8 |
document.addEventListener('DOMContentLoaded', function() {
|
| 9 |
initializeApp();
|
|
@@ -53,12 +57,11 @@ function setupEventListeners() {
|
|
| 53 |
this.style.height = Math.min(this.scrollHeight, 120) + 'px';
|
| 54 |
});
|
| 55 |
}
|
| 56 |
-
|
| 57 |
-
functionsendMessage() {
|
| 58 |
const input = document.getElementById('messageInput');
|
| 59 |
const message = input.value.trim();
|
| 60 |
|
| 61 |
-
if (!message || !isConnected) return;
|
| 62 |
|
| 63 |
// Add user message
|
| 64 |
addMessage(message, 'user');
|
|
@@ -66,18 +69,30 @@ functionsendMessage() {
|
|
| 66 |
// Clear input
|
| 67 |
input.value = '';
|
| 68 |
input.style.height = 'auto';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
// Show typing indicator
|
| 71 |
showTypingIndicator();
|
| 72 |
|
| 73 |
// Simulate AI response
|
|
|
|
|
|
|
| 74 |
setTimeout(() => {
|
|
|
|
| 75 |
hideTypingIndicator();
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
addMessage(response, 'ai');
|
| 78 |
-
},
|
| 79 |
}
|
| 80 |
-
|
| 81 |
function addMessage(content, sender) {
|
| 82 |
const chatContainer = document.getElementById('chatContainer');
|
| 83 |
const timestamp = new Date().toLocaleTimeString('en-US', {
|
|
@@ -174,30 +189,114 @@ function toggleModelDropdown() {
|
|
| 174 |
arrow.style.transform = 'rotate(0deg)';
|
| 175 |
}
|
| 176 |
}
|
| 177 |
-
|
| 178 |
function selectModel(model) {
|
| 179 |
currentModel = model;
|
| 180 |
-
const
|
| 181 |
-
const
|
|
|
|
|
|
|
| 182 |
'Max': { color: 'green' },
|
| 183 |
'Turbo': { color: 'blue' },
|
| 184 |
-
'Lite': { color: 'yellow' }
|
| 185 |
-
'Deep Research': { color: 'purple' }
|
| 186 |
};
|
| 187 |
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
${model}
|
| 191 |
-
`;
|
| 192 |
|
| 193 |
// Close dropdown
|
| 194 |
document.getElementById('modelDropdownMenu').classList.add('hidden');
|
| 195 |
document.getElementById('modelDropdownArrow').style.transform = 'rotate(0deg)';
|
| 196 |
|
| 197 |
-
// Update
|
| 198 |
updateModelStatus(model);
|
| 199 |
}
|
| 200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
function updateModelStatus(model) {
|
| 202 |
const responseTimes = {
|
| 203 |
'Max': '~1.2s',
|
|
@@ -213,15 +312,6 @@ function updateModelStatus(model) {
|
|
| 213 |
}
|
| 214 |
});
|
| 215 |
}
|
| 216 |
-
|
| 217 |
-
// Close dropdown when clicking outside
|
| 218 |
-
document.addEventListener('click', function(event) {
|
| 219 |
-
const dropdown = document.getElementById('modelDropdown');
|
| 220 |
-
if (!dropdown.contains(event.target)) {
|
| 221 |
-
document.getElementById('modelDropdownMenu').classList.add('hidden');
|
| 222 |
-
document.getElementById('modelDropdownArrow').style.transform = 'rotate(0deg)';
|
| 223 |
-
}
|
| 224 |
-
});
|
| 225 |
function handleKeyPress(event) {
|
| 226 |
if (event.key === 'Enter' && !event.shiftKey) {
|
| 227 |
event.preventDefault();
|
|
|
|
| 1 |
+
|
| 2 |
// Global Variables
|
| 3 |
let chatHistory = [];
|
| 4 |
let currentModel = 'Max';
|
| 5 |
let isCompactMode = false;
|
| 6 |
+
let isConnected = true;
|
| 7 |
+
let webSearchEnabled = false;
|
| 8 |
+
let isGenerating = false;
|
| 9 |
+
let currentTokenCount = 0;
|
| 10 |
+
const maxTokens = 4096;
|
| 11 |
// Initialize
|
| 12 |
document.addEventListener('DOMContentLoaded', function() {
|
| 13 |
initializeApp();
|
|
|
|
| 57 |
this.style.height = Math.min(this.scrollHeight, 120) + 'px';
|
| 58 |
});
|
| 59 |
}
|
| 60 |
+
function sendMessage() {
|
|
|
|
| 61 |
const input = document.getElementById('messageInput');
|
| 62 |
const message = input.value.trim();
|
| 63 |
|
| 64 |
+
if (!message || !isConnected || isGenerating) return;
|
| 65 |
|
| 66 |
// Add user message
|
| 67 |
addMessage(message, 'user');
|
|
|
|
| 69 |
// Clear input
|
| 70 |
input.value = '';
|
| 71 |
input.style.height = 'auto';
|
| 72 |
+
updateTokenCount('');
|
| 73 |
+
|
| 74 |
+
// Set generating state
|
| 75 |
+
isGenerating = true;
|
| 76 |
+
handleInput(input);
|
| 77 |
|
| 78 |
// Show typing indicator
|
| 79 |
showTypingIndicator();
|
| 80 |
|
| 81 |
// Simulate AI response
|
| 82 |
+
const responseTime = currentModel === 'Max' ? 2000 : currentModel === 'Turbo' ? 1000 : 500;
|
| 83 |
+
|
| 84 |
setTimeout(() => {
|
| 85 |
+
isGenerating = false;
|
| 86 |
hideTypingIndicator();
|
| 87 |
+
handleInput(input);
|
| 88 |
+
|
| 89 |
+
let response = generateAIResponse(message);
|
| 90 |
+
if (webSearchEnabled) {
|
| 91 |
+
response += '\n\n🔍 *Web araması sonucu: `https://example.com`*';
|
| 92 |
+
}
|
| 93 |
addMessage(response, 'ai');
|
| 94 |
+
}, responseTime + Math.random() * 1000);
|
| 95 |
}
|
|
|
|
| 96 |
function addMessage(content, sender) {
|
| 97 |
const chatContainer = document.getElementById('chatContainer');
|
| 98 |
const timestamp = new Date().toLocaleTimeString('en-US', {
|
|
|
|
| 189 |
arrow.style.transform = 'rotate(0deg)';
|
| 190 |
}
|
| 191 |
}
|
|
|
|
| 192 |
function selectModel(model) {
|
| 193 |
currentModel = model;
|
| 194 |
+
const selectedText = document.getElementById('selectedModelText');
|
| 195 |
+
const indicator = document.getElementById('modelIndicator');
|
| 196 |
+
|
| 197 |
+
const modelConfig = {
|
| 198 |
'Max': { color: 'green' },
|
| 199 |
'Turbo': { color: 'blue' },
|
| 200 |
+
'Lite': { color: 'yellow' }
|
|
|
|
| 201 |
};
|
| 202 |
|
| 203 |
+
selectedText.textContent = model;
|
| 204 |
+
indicator.className = `w-2 h-2 bg-${modelConfig[model].color}-400 rounded-full`;
|
|
|
|
|
|
|
| 205 |
|
| 206 |
// Close dropdown
|
| 207 |
document.getElementById('modelDropdownMenu').classList.add('hidden');
|
| 208 |
document.getElementById('modelDropdownArrow').style.transform = 'rotate(0deg)';
|
| 209 |
|
| 210 |
+
// Update model status
|
| 211 |
updateModelStatus(model);
|
| 212 |
}
|
| 213 |
|
| 214 |
+
function toggleWebSearch() {
|
| 215 |
+
webSearchEnabled = !webSearchEnabled;
|
| 216 |
+
const toggleCircle = document.getElementById('webSearchToggleCircle');
|
| 217 |
+
const toggleButton = document.getElementById('webSearchToggle');
|
| 218 |
+
|
| 219 |
+
if (webSearchEnabled) {
|
| 220 |
+
toggleCircle.style.transform = 'translateX(16px)';
|
| 221 |
+
toggleCircle.classList.add('bg-green-400');
|
| 222 |
+
toggleCircle.classList.remove('bg-zinc-500');
|
| 223 |
+
} else {
|
| 224 |
+
toggleCircle.style.transform = 'translateX(0)';
|
| 225 |
+
toggleCircle.classList.remove('bg-green-400');
|
| 226 |
+
toggleCircle.classList.add('bg-zinc-500');
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
function handleInput(textarea) {
|
| 231 |
+
// Auto resize
|
| 232 |
+
textarea.style.height = 'auto';
|
| 233 |
+
textarea.style.height = Math.min(textarea.scrollHeight, 120) + 'px';
|
| 234 |
+
|
| 235 |
+
// Update token count
|
| 236 |
+
updateTokenCount(textarea.value);
|
| 237 |
+
|
| 238 |
+
// Show/hide appropriate buttons
|
| 239 |
+
const sendButton = document.getElementById('sendButton');
|
| 240 |
+
const stopButton = document.getElementById('stopButton');
|
| 241 |
+
|
| 242 |
+
if (isGenerating) {
|
| 243 |
+
sendButton.classList.add('hidden');
|
| 244 |
+
stopButton.classList.remove('hidden');
|
| 245 |
+
} else {
|
| 246 |
+
sendButton.classList.remove('hidden');
|
| 247 |
+
stopButton.classList.add('hidden');
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
function updateTokenCount(text) {
|
| 252 |
+
if (!text) text = '';
|
| 253 |
+
// Rough estimation: average 1 token per 4 characters
|
| 254 |
+
currentTokenCount = Math.ceil(text.length / 4);
|
| 255 |
+
|
| 256 |
+
const tokenCountElement = document.getElementById('tokenCount');
|
| 257 |
+
const progressBar = document.getElementById('tokenProgressBar');
|
| 258 |
+
|
| 259 |
+
tokenCountElement.textContent = `${currentTokenCount} / ${maxTokens} tokens`;
|
| 260 |
+
|
| 261 |
+
const percentage = Math.min((currentTokenCount / maxTokens) * 100, 100);
|
| 262 |
+
progressBar.style.width = percentage + '%';
|
| 263 |
+
|
| 264 |
+
// Change color based on percentage
|
| 265 |
+
if (percentage > 80) {
|
| 266 |
+
progressBar.className = 'absolute top-0 left-0 h-full bg-gradient-to-r from-red-500 to-orange-500 rounded-full transition-all duration-300';
|
| 267 |
+
} else if (percentage > 60) {
|
| 268 |
+
progressBar.className = 'absolute top-0 left-0 h-full bg-gradient-to-r from-yellow-500 to-orange-500 rounded-full transition-all duration-300';
|
| 269 |
+
} else {
|
| 270 |
+
progressBar.className = 'absolute top-0 left-0 h-full bg-gradient-to-r from-white to-zinc-400 rounded-full transition-all duration-300';
|
| 271 |
+
}
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
function attachFile() {
|
| 275 |
+
const input = document.createElement('input');
|
| 276 |
+
input.type = 'file';
|
| 277 |
+
input.onchange = e => {
|
| 278 |
+
const file = e.target.files[0];
|
| 279 |
+
if (file) {
|
| 280 |
+
addMessage(`📎 ${file.name} eklendi`, 'user');
|
| 281 |
+
// Handle file upload logic here
|
| 282 |
+
}
|
| 283 |
+
};
|
| 284 |
+
input.click();
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
function showVoiceInput() {
|
| 288 |
+
alert('Sesli giriş yakında eklenecek!');
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
function stopGeneration() {
|
| 292 |
+
isGenerating = false;
|
| 293 |
+
hideTypingIndicator();
|
| 294 |
+
handleInput(document.getElementById('messageInput'));
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
function showSettings() {
|
| 298 |
+
alert('Ayarlar sayfası yakında eklenecek!');
|
| 299 |
+
}
|
| 300 |
function updateModelStatus(model) {
|
| 301 |
const responseTimes = {
|
| 302 |
'Max': '~1.2s',
|
|
|
|
| 312 |
}
|
| 313 |
});
|
| 314 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
function handleKeyPress(event) {
|
| 316 |
if (event.key === 'Enter' && !event.shiftKey) {
|
| 317 |
event.preventDefault();
|