VishekKumar1 commited on
Commit
42e4d80
·
verified ·
1 Parent(s): 97fb55b

Mujhe chat GPT ki tarah ek app banakar do jo ki superfast Ho chat gpt se bhi jyada advance

Browse files
Files changed (4) hide show
  1. README.md +8 -5
  2. index.html +167 -19
  3. script.js +129 -0
  4. style.css +179 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Quantum Chat Ai
3
- emoji: 👁
4
- colorFrom: yellow
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: ⚡️ Quantum Chat AI 🚀
3
+ colorFrom: red
4
+ colorTo: pink
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
index.html CHANGED
@@ -1,19 +1,167 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Quantum Chat AI - Beyond GPT</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <link rel="stylesheet" href="style.css">
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ </head>
13
+ <body class="bg-gray-900 text-white">
14
+ <!-- Navigation -->
15
+ <nav class="fixed top-0 w-full bg-gray-800/90 backdrop-blur-lg border-b border-gray-700 z-50">
16
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
17
+ <div class="flex items-center justify-between h-16">
18
+ <div class="flex items-center space-x-3">
19
+ <div class="w-8 h-8 bg-gradient-to-r from-blue-500 to-purple-600 rounded-full animate-pulse"></div>
20
+ <h1 class="text-xl font-bold bg-gradient-to-r from-blue-400 to-purple-400 bg-clip-text text-transparent">
21
+ Quantum Chat AI
22
+ </h1>
23
+ </div>
24
+ <div class="flex items-center space-x-4">
25
+ <button id="themeToggle" class="p-2 rounded-lg hover:bg-gray-700 transition-colors">
26
+ <i data-feather="sun" class="w-5 h-5"></i>
27
+ </button>
28
+ <button id="settingsBtn" class="p-2 rounded-lg hover:bg-gray-700 transition-colors">
29
+ <i data-feather="settings" class="w-5 h-5"></i>
30
+ </button>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </nav>
35
+
36
+ <!-- Main Content -->
37
+ <main class="pt-16 min-h-screen flex flex-col">
38
+ <!-- Chat Container -->
39
+ <div class="flex-1 flex flex-col max-w-4xl mx-auto w-full px-4 py-6">
40
+ <!-- Welcome Screen -->
41
+ <div id="welcomeScreen" class="flex-1 flex flex-col items-center justify-center text-center">
42
+ <div class="mb-8">
43
+ <div class="w-24 h-24 mx-auto mb-4 bg-gradient-to-r from-blue-500 to-purple-600 rounded-full animate-pulse"></div>
44
+ <h2 class="text-4xl font-bold mb-4 bg-gradient-to-r from-blue-400 to-purple-400 bg-clip-text text-transparent">
45
+ Quantum Chat AI
46
+ </h2>
47
+ <p class="text-gray-400 text-lg">The future of AI conversation is here</p>
48
+ </div>
49
+
50
+ <!-- Quick Actions -->
51
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4 w-full max-w-2xl">
52
+ <button class="quick-action-btn" data-prompt="Explain quantum computing">
53
+ <i data-feather="cpu" class="w-8 h-8 mb-2 text-blue-400"></i>
54
+ <span>Quantum Computing</span>
55
+ </button>
56
+ <button class="quick-action-btn" data-prompt="Create a poem about stars">
57
+ <i data-feather="star" class="w-8 h-8 mb-2 text-purple-400"></i>
58
+ <span>Creative Writing</span>
59
+ </button>
60
+ <button class="quick-action-btn" data-prompt="Solve complex equations">
61
+ <i data-feather="calculator" class="w-8 h-8 mb-2 text-green-400"></i>
62
+ <span>Mathematics</span>
63
+ </button>
64
+ </div>
65
+ </div>
66
+
67
+ <!-- Chat Messages -->
68
+ <div id="chatContainer" class="hidden flex-1 overflow-y-auto mb-6 space-y-4">
69
+ <!-- Messages will be dynamically added here -->
70
+ </div>
71
+
72
+ <!-- Input Area -->
73
+ <div class="relative">
74
+ <div class="flex items-end space-x-3">
75
+ <div class="flex-1 relative">
76
+ <textarea
77
+ id="messageInput"
78
+ class="w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-3 pr-12 resize-none focus:outline-none focus:border-blue-500 transition-colors"
79
+ placeholder="Ask me anything..."
80
+ rows="1"
81
+ ></textarea>
82
+ <button id="attachBtn" class="absolute right-3 top-3 text-gray-400 hover:text-white transition-colors">
83
+ <i data-feather="paperclip" class="w-5 h-5"></i>
84
+ </button>
85
+ </div>
86
+ <button id="sendBtn" class="bg-gradient-to-r from-blue-500 to-purple-600 p-3 rounded-lg hover:from-blue-600 hover:to-purple-700 transition-all transform hover:scale-105">
87
+ <i data-feather="send" class="w-5 h-5"></i>
88
+ </button>
89
+ </div>
90
+
91
+ <!-- Suggestions -->
92
+ <div id="suggestions" class="flex flex-wrap gap-2 mt-3">
93
+ <span class="suggestion-chip" data-suggestion="What's the meaning of life?">What's the meaning of life?</span>
94
+ <span class="suggestion-chip" data-suggestion="Tell me a joke">Tell me a joke</span>
95
+ <span class="suggestion-chip" data-suggestion="How to build an app?">How to build an app?</span>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </main>
100
+
101
+ <!-- Settings Modal -->
102
+ <div id="settingsModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-50">
103
+ <div class="flex items-center justify-center min-h-screen p-4">
104
+ <div class="bg-gray-800 rounded-xl p-6 w-full max-w-md">
105
+ <div class="flex items-center justify-between mb-6">
106
+ <h3 class="text-xl font-bold">Settings</h3>
107
+ <button id="closeSettings" class="text-gray-400 hover:text-white">
108
+ <i data-feather="x" class="w-5 h-5"></i>
109
+ </button>
110
+ </div>
111
+
112
+ <div class="space-y-4">
113
+ <div>
114
+ <label class="block text-sm font-medium mb-2">AI Model</label>
115
+ <select class="w-full bg-gray-700 border border-gray-600 rounded-lg px-3 py-2 focus:outline-none focus:border-blue-500">
116
+ <option>Quantum AI v3.0</option>
117
+ <option>Neural Net Plus</option>
118
+ <option>Deep Thinker</option>
119
+ </select>
120
+ </div>
121
+
122
+ <div>
123
+ <label class="block text-sm font-medium mb-2">Response Speed</label>
124
+ <input type="range" min="1" max="10" value="8" class="w-full">
125
+ <div class="flex justify-between text-xs text-gray-400 mt-1">
126
+ <span>Slow</span>
127
+ <span>Fast</span>
128
+ </div>
129
+ </div>
130
+
131
+ <div>
132
+ <label class="flex items-center space-x-3">
133
+ <input type="checkbox" checked class="rounded">
134
+ <span>Enable Smart Suggestions</span>
135
+ </label>
136
+ </div>
137
+
138
+ <div>
139
+ <label class="flex items-center space-x-3">
140
+ <input type="checkbox" checked class="rounded">
141
+ <span>Voice Input</span>
142
+ </label>
143
+ </div>
144
+ </div>
145
+
146
+ <button class="w-full mt-6 bg-gradient-to-r from-blue-500 to-purple-600 py-2 rounded-lg hover:from-blue-600 hover:to-purple-700 transition-all">
147
+ Save Settings
148
+ </button>
149
+ </div>
150
+ </div>
151
+ </div>
152
+
153
+ <!-- Loading Overlay -->
154
+ <div id="loadingOverlay" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-40">
155
+ <div class="flex items-center justify-center min-h-screen">
156
+ <div class="text-center">
157
+ <div class="w-16 h-16 mx-auto mb-4 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"></div>
158
+ <p class="text-lg">Quantum AI is thinking...</p>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <script src="script.js"></script>
164
+ <script>feather.replace();</script>
165
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
166
+ </body>
167
+ </html>
script.js ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Global variables
2
+ let isDarkMode = true;
3
+ let currentChat = [];
4
+ let isTyping = false;
5
+
6
+ // DOM elements
7
+ const messageInput = document.getElementById('messageInput');
8
+ const sendBtn = document.getElementById('sendBtn');
9
+ const chatContainer = document.getElementById('chatContainer');
10
+ const welcomeScreen = document.getElementById('welcomeScreen');
11
+ const themeToggle = document.getElementById('themeToggle');
12
+ const settingsBtn = document.getElementById('settingsBtn');
13
+ const settingsModal = document.getElementById('settingsModal');
14
+ const closeSettings = document.getElementById('closeSettings');
15
+ const loadingOverlay = document.getElementById('loadingOverlay');
16
+ const suggestions = document.getElementById('suggestions');
17
+
18
+ // Initialize
19
+ document.addEventListener('DOMContentLoaded', () => {
20
+ initializeApp();
21
+ });
22
+
23
+ function initializeApp() {
24
+ setupEventListeners();
25
+ setupAutoResize();
26
+ setupQuickActions();
27
+ setupSuggestionChips();
28
+
29
+ // Auto-focus input
30
+ messageInput.focus();
31
+ }
32
+
33
+ // Event listeners
34
+ function setupEventListeners() {
35
+ sendBtn.addEventListener('click', sendMessage);
36
+ messageInput.addEventListener('keypress', (e) => {
37
+ if (e.key === 'Enter' && !e.shiftKey) {
38
+ e.preventDefault();
39
+ sendMessage();
40
+ }
41
+ });
42
+
43
+ themeToggle.addEventListener('click', toggleTheme);
44
+ settingsBtn.addEventListener('click', () => settingsModal.classList.remove('hidden'));
45
+ closeSettings.addEventListener('click', () => settingsModal.classList.add('hidden'));
46
+
47
+ // Handle suggestion clicks
48
+ document.querySelectorAll('.suggestion-chip').forEach(chip => {
49
+ chip.addEventListener('click', () => {
50
+ messageInput.value = chip.dataset.suggestion;
51
+ messageInput.focus();
52
+ });
53
+ });
54
+ }
55
+
56
+ // Auto-resize textarea
57
+ function setupAutoResize() {
58
+ messageInput.addEventListener('input', () => {
59
+ messageInput.style.height = 'auto';
60
+ messageInput.style.height = Math.min(messageInput.scrollHeight, 120) + 'px';
61
+ });
62
+ }
63
+
64
+ // Quick actions
65
+ function setupQuickActions() {
66
+ document.querySelectorAll('.quick-action-btn').forEach(btn => {
67
+ btn.addEventListener('click', () => {
68
+ const prompt = btn.dataset.prompt;
69
+ messageInput.value = prompt;
70
+ sendMessage();
71
+ });
72
+ });
73
+ }
74
+
75
+ // Suggestion chips
76
+ function setupSuggestionChips() {
77
+ const suggestionTexts = [
78
+ "What's the meaning of life?",
79
+ "Tell me a joke",
80
+ "How to build an app?",
81
+ "Explain quantum physics",
82
+ "Write a haiku",
83
+ "Solve x² + 5x + 6 = 0",
84
+ "Best programming language?",
85
+ "Tell me a fun fact"
86
+ ];
87
+
88
+ // Update suggestions periodically
89
+ setInterval(() => {
90
+ const chips = suggestions.querySelectorAll('.suggestion-chip');
91
+ chips.forEach((chip, index) => {
92
+ const randomIndex = Math.floor(Math.random() * suggestionTexts.length);
93
+ chip.textContent = suggestionTexts[randomIndex];
94
+ chip.dataset.suggestion = suggestionTexts[randomIndex];
95
+ });
96
+ }, 10000);
97
+ }
98
+
99
+ // Send message
100
+ async function sendMessage() {
101
+ const message = messageInput.value.trim();
102
+ if (!message || isTyping) return;
103
+
104
+ // Hide welcome screen
105
+ welcomeScreen.classList.add('hidden');
106
+ chatContainer.classList.remove('hidden');
107
+
108
+ // Add user message
109
+ addMessage(message, 'user');
110
+ messageInput.value = '';
111
+ messageInput.style.height = 'auto';
112
+
113
+ // Show typing indicator
114
+ showTypingIndicator();
115
+
116
+ // Simulate AI response
117
+ await simulateAIResponse(message);
118
+ }
119
+
120
+ // Add message to chat
121
+ function addMessage(content, sender) {
122
+ const messageDiv = document.createElement('div');
123
+ messageDiv.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'} message-enter`;
124
+
125
+ const messageContent = document.createElement('div');
126
+ messageContent.className = sender === 'user' ? 'user-message' : 'ai-message';
127
+
128
+ // Check if content is code
129
+ if (content.includes('
style.css CHANGED
@@ -1,28 +1,188 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
 
 
 
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
 
 
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
 
 
 
 
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Custom styles and animations */
2
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
3
+
4
+ * {
5
+ font-family: 'Inter', sans-serif;
6
+ }
7
+
8
+ /* Custom scrollbar */
9
+ ::-webkit-scrollbar {
10
+ width: 6px;
11
+ }
12
+
13
+ ::-webkit-scrollbar-track {
14
+ background: #1f2937;
15
+ }
16
+
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #4b5563;
19
+ border-radius: 3px;
20
+ }
21
+
22
+ ::-webkit-scrollbar-thumb:hover {
23
+ background: #6b7280;
24
+ }
25
+
26
+ /* Message animations */
27
+ .message-enter {
28
+ animation: messageEnter 0.3s ease-out;
29
+ }
30
+
31
+ @keyframes messageEnter {
32
+ from {
33
+ opacity: 0;
34
+ transform: translateY(20px);
35
+ }
36
+ to {
37
+ opacity: 1;
38
+ transform: translateY(0);
39
+ }
40
+ }
41
+
42
+ /* Typing indicator */
43
+ .typing-indicator {
44
+ display: flex;
45
+ align-items: center;
46
+ padding: 1rem;
47
+ background: #374151;
48
+ border-radius: 1rem;
49
+ width: fit-content;
50
+ }
51
+
52
+ .typing-indicator span {
53
+ height: 8px;
54
+ width: 8px;
55
+ background-color: #9ca3af;
56
+ border-radius: 50%;
57
+ display: inline-block;
58
+ margin: 0 2px;
59
+ animation: typing 1.4s infinite ease-in-out both;
60
+ }
61
+
62
+ .typing-indicator span:nth-child(1) {
63
+ animation-delay: -0.32s;
64
+ }
65
+
66
+ .typing-indicator span:nth-child(2) {
67
+ animation-delay: -0.16s;
68
+ }
69
+
70
+ @keyframes typing {
71
+ 0%, 80%, 100% {
72
+ transform: scale(0.8);
73
+ opacity: 0.5;
74
+ }
75
+ 40% {
76
+ transform: scale(1);
77
+ opacity: 1;
78
+ }
79
+ }
80
+
81
+ /* Quick action buttons */
82
+ .quick-action-btn {
83
+ background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
84
+ border: 1px solid #6b7280;
85
+ border-radius: 1rem;
86
+ padding: 1.5rem;
87
+ display: flex;
88
+ flex-direction: column;
89
+ align-items: center;
90
+ cursor: pointer;
91
+ transition: all 0.3s ease;
92
+ color: white;
93
+ }
94
+
95
+ .quick-action-btn:hover {
96
+ transform: translateY(-2px);
97
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
98
+ border-color: #3b82f6;
99
+ }
100
+
101
+ /* Suggestion chips */
102
+ .suggestion-chip {
103
+ background: #374151;
104
+ border: 1px solid #4b5563;
105
+ border-radius: 9999px;
106
+ padding: 0.5rem 1rem;
107
+ font-size: 0.875rem;
108
+ cursor: pointer;
109
+ transition: all 0.2s ease;
110
+ }
111
+
112
+ .suggestion-chip:hover {
113
+ background: #4b5563;
114
+ border-color: #3b82f6;
115
+ }
116
+
117
+ /* Gradient text */
118
+ .gradient-text {
119
+ background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
120
+ -webkit-background-clip: text;
121
+ -webkit-text-fill-color: transparent;
122
+ background-clip: text;
123
+ }
124
+
125
+ /* Pulse animation for AI avatar */
126
+ .animate-pulse {
127
+ animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
128
  }
129
 
130
+ @keyframes pulse {
131
+ 0%, 100% {
132
+ opacity: 1;
133
+ }
134
+ 50% {
135
+ opacity: .5;
136
+ }
137
  }
138
 
139
+ /* Message bubbles */
140
+ .user-message {
141
+ background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
142
+ border-radius: 1rem 1rem 0 1rem;
143
+ padding: 1rem;
144
+ max-width: 80%;
145
+ word-wrap: break-word;
146
  }
147
 
148
+ .ai-message {
149
+ background: #374151;
150
+ border-radius: 1rem 1rem 1rem 0;
151
+ padding: 1rem;
152
+ max-width: 80%;
153
+ word-wrap: break-word;
154
  }
155
 
156
+ /* Code blocks */
157
+ .code-block {
158
+ background: #1f2937;
159
+ border: 1px solid #374151;
160
+ border-radius: 0.5rem;
161
+ padding: 1rem;
162
+ margin: 1rem 0;
163
+ overflow-x: auto;
164
  }
165
+
166
+ .code-block code {
167
+ color: #f3f4f6;
168
+ font-family: 'Fira Code', 'Courier New', monospace;
169
+ }
170
+
171
+ /* Image previews */
172
+ .image-preview {
173
+ max-width: 300px;
174
+ border-radius: 0.5rem;
175
+ overflow: hidden;
176
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
177
+ }
178
+
179
+ /* Responsive adjustments */
180
+ @media (max-width: 640px) {
181
+ .user-message, .ai-message {
182
+ max-width: 90%;
183
+ }
184
+
185
+ .quick-action-btn {
186
+ padding: 1rem;
187
+ }
188
+ }