Spaces:
Running
Running
File size: 14,664 Bytes
67486c5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 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 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | <!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>پارسگوی - دستیار هوشمند فارسی</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
'vazir': ['Vazir', 'system-ui'],
},
colors: {
primary: {
50: '#f0f9ff',
100: '#e0f2fe',
500: '#0ea5e9',
600: '#0284c7',
700: '#0369a1',
}
}
}
}
}
</script>
<link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/font-face.css" rel="stylesheet">
<style>
body {
font-family: 'Vazir', sans-serif;
}
.rtl {
direction: rtl;
}
.message-bubble-user {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 18px 18px 4px 18px;
}
.message-bubble-ai {
background: #f1f5f9;
color: #334155;
border-radius: 18px 18px 18px 4px;
}
.code-block {
background: #1e293b;
color: #e2e8f0;
border-radius: 8px;
font-family: 'Monaco', 'Consolas', monospace;
}
</style>
</head>
<body class="bg-gray-50 font-vazir rtl">
<!-- Navigation -->
<nav class="bg-white shadow-sm border-b border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<div class="flex items-center">
<div class="flex-shrink-0">
<h1 class="text-xl font-bold text-gray-900">پارسگوی 🧠</h1>
</div>
<div class="hidden md:block mr-8">
<div class="flex items-baseline space-x-4 space-x-reverse">
<a href="/" class="text-gray-900 hover:text-primary-600 px-3 py-2 rounded-md text-sm font-medium">چت</a>
<a href="/history.html" class="text-gray-500 hover:text-primary-600 px-3 py-2 rounded-md text-sm font-medium">تاریخچه</a>
<a href="/personas.html" class="text-gray-500 hover:text-primary-600 px-3 py-2 rounded-md text-sm font-medium">شخصیتها</a>
<a href="/profile.html" class="text-gray-500 hover:text-primary-600 px-3 py-2 rounded-md text-sm font-medium">پروفایل</a>
</div>
</div>
</div>
<div class="flex items-center">
<button id="themeToggle" class="p-2 text-gray-500 hover:text-primary-600">
<i data-feather="moon"></i>
</button>
<button id="authButton" class="mr-4 bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 rounded-md text-sm font-medium">
ورود / ثبتنام
</button>
</div>
</div>
</div>
</nav>
<!-- Main Chat Interface -->
<div class="max-w-4xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
<!-- Chat Header -->
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-3 space-x-reverse">
<div class="w-12 h-12 bg-gradient-to-r from-primary-500 to-primary-600 rounded-full flex items-center justify-center text-white font-bold">
AI
</div>
<div>
<h2 class="text-lg font-semibold text-gray-900">دستیار هوشمند فارسی</h2>
<p class="text-sm text-gray-500">همیشه در دسترس برای کمک به شما</p>
</div>
</div>
<div class="flex items-center space-x-2 space-x-reverse">
<button id="voiceInput" class="p-2 text-gray-500 hover:text-primary-600 rounded-full hover:bg-gray-100">
<i data-feather="mic"></i>
</button>
<button id="clearChat" class="p-2 text-gray-500 hover:text-red-600 rounded-full hover:bg-gray-100">
<i data-feather="trash-2"></i>
</button>
</div>
</div>
</div>
<!-- Chat Messages -->
<div id="chatMessages" class="space-y-4 mb-6 min-h-[400px]">
<!-- Welcome Message -->
<div class="flex justify-start">
<div class="message-bubble-ai p-4 max-w-[80%]">
<div class="flex items-center space-x-2 space-x-reverse mb-2">
<div class="w-6 h-6 bg-primary-500 rounded-full flex items-center justify-center text-white text-xs">
AI
</div>
<span class="text-sm text-gray-500">پارسگوی</span>
</div>
<p class="text-gray-800">سلام! من پارسگوی هستم، دستیار هوشمند فارسی شما. چگونه میتوانم کمکتان کنم؟</p>
</div>
</div>
</div>
<!-- Chat Input -->
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4">
<div class="flex space-x-3 space-x-reverse">
<div class="flex-1">
<textarea
id="messageInput"
placeholder="پیام خود را اینجا بنویسید... (برای استفاده از گفتار، روی آیکون میکروفون کلیک کنید)"
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent resize-none"
rows="3"
></textarea>
</div>
<div class="flex flex-col space-y-2">
<button id="sendMessage" class="bg-primary-500 hover:bg-primary-600 text-white p-3 rounded-lg transition-colors">
<i data-feather="send"></i>
</button>
<button id="attachFile" class="text-gray-500 hover:text-primary-600 p-3 rounded-lg border border-gray-300 hover:border-primary-500">
<i data-feather="paperclip"></i>
</button>
</div>
</div>
<div class="mt-3 flex items-center justify-between text-sm text-gray-500">
<div class="flex items-center space-x-2 space-x-reverse">
<button id="regenerateBtn" class="hover:text-primary-600">
<i data-feather="refresh-cw" class="w-4 h-4"></i>
تولید مجدد
</button>
</div>
<div>
<span id="charCount">0/4000</span>
</div>
</div>
</div>
</div>
<!-- Auth Modal -->
<div id="authModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
<div class="bg-white rounded-lg p-6 w-full max-w-md">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">ورود / ثبتنام</h3>
<button id="closeAuthModal" class="text-gray-500 hover:text-gray-700">
<i data-feather="x"></i>
</button>
</div>
<form id="authForm" class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">ایمیل</label>
<input type="email" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent" required>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">رمز عبور</label>
<input type="password" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent" required>
</div>
<button type="submit" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-2 px-4 rounded-lg transition-colors">
ادامه
</button>
<div class="text-center">
<a href="#" class="text-sm text-primary-600 hover:text-primary-700">فراموشی رمز عبور</a>
</div>
</form>
</div>
</div>
<script>
// Initialize Feather Icons
feather.replace();
// Theme Toggle
const themeToggle = document.getElementById('themeToggle');
themeToggle.addEventListener('click', () => {
document.body.classList.toggle('dark');
const icon = themeToggle.querySelector('i');
if (document.body.classList.contains('dark')) {
document.body.classList.add('bg-gray-900', 'text-white');
icon.setAttribute('data-feather', 'sun');
} else {
document.body.classList.remove('bg-gray-900', 'text-white');
icon.setAttribute('data-feather', 'moon');
}
feather.replace();
});
// Auth Modal
const authButton = document.getElementById('authButton');
const authModal = document.getElementById('authModal');
const closeAuthModal = document.getElementById('closeAuthModal');
authButton.addEventListener('click', () => {
authModal.classList.remove('hidden');
});
closeAuthModal.addEventListener('click', () => {
authModal.classList.add('hidden');
});
// Chat Functionality
const messageInput = document.getElementById('messageInput');
const sendMessage = document.getElementById('sendMessage');
const chatMessages = document.getElementById('chatMessages');
const charCount = document.getElementById('charCount');
messageInput.addEventListener('input', () => {
charCount.textContent = `${messageInput.value.length}/4000`;
});
sendMessage.addEventListener('click', sendChatMessage);
messageInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
sendChatMessage();
}
});
function sendChatMessage() {
const message = messageInput.value.trim();
if (!message) return;
// Add user message
addMessage(message, 'user');
// Clear input
messageInput.value = '';
charCount.textContent = '0/4000';
// Simulate AI response
setTimeout(() => {
addMessage('این یک پاسخ شبیهسازی شده از هوش مصنوعی است. در نسخه کامل، پاسخ واقعی از API دریافت میشود.', 'ai');
}, 1000);
}
function addMessage(text, sender) {
const messageDiv = document.createElement('div');
messageDiv.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
const bubbleClass = sender === 'user' ? 'message-bubble-user' : 'message-bubble-ai';
messageDiv.innerHTML = `
<div class="${bubbleClass} p-4 max-w-[80%]">
<div class="flex items-center space-x-2 space-x-reverse mb-2">
${sender === 'ai' ? `
<div class="w-6 h-6 bg-primary-500 rounded-full flex items-center justify-center text-white text-xs">
AI
</div>
<span class="text-sm ${sender === 'user' ? 'text-blue-100' : 'text-gray-500'}">
${sender === 'user' ? 'شما' : 'پارسگوی'}
</span>
</div>
<p class="${sender === 'user' ? 'text-white' : 'text-gray-800'}">${text}</p>
</div>
`;
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
// Voice Input
const voiceInput = document.getElementById('voiceInput');
voiceInput.addEventListener('click', () => {
// In a real implementation, this would use the Web Speech API
alert('قابلیت گفتار به متن در مرورگر شما فعال شد. شروع به صحبت کنید...');
});
// Clear Chat
document.getElementById('clearChat').addEventListener('click', () => {
if (confirm('آیا از پاک کردن تمام پیامها مطمئن هستید؟')) {
chatMessages.innerHTML = `
<div class="flex justify-start">
<div class="message-bubble-ai p-4 max-w-[80%]">
<div class="flex items-center space-x-2 space-x-reverse mb-2">
<div class="w-6 h-6 bg-primary-500 rounded-full flex items-center justify-center text-white text-xs">
AI
</div>
<span class="text-sm text-gray-500">پارسگوی</span>
</div>
<p class="text-gray-800">سلام! من پارسگوی هستم، دستیار هوشمند فارسی شما. چگونه میتوانم کمکتان کنم؟</p>
</div>
</div>
`;
}
});
</script>
</body>
</html> |