Daniil-plotnikov commited on
Commit
4ddfd3d
·
verified ·
1 Parent(s): 501c75e

Напиши для меня главную страницу типа perplexity, где вводишь запрос и получаешь ответ от ии с указанием источника, процесса поиска по сайтам, постепенным как бы печатанием текста. Пока что с mock данными

Browse files
Files changed (6) hide show
  1. README.md +7 -4
  2. components/footer.js +60 -0
  3. components/navbar.js +44 -0
  4. index.html +68 -19
  5. script.js +145 -0
  6. style.css +29 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Mindmeld Explorer
3
- emoji: 📚
4
  colorFrom: yellow
5
- colorTo: yellow
 
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: MindMeld Explorer 🔍
 
3
  colorFrom: yellow
4
+ colorTo: green
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).
components/footer.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background-color: rgba(0, 0, 0, 0.8);
8
+ backdrop-filter: blur(10px);
9
+ }
10
+ .footer-link:hover {
11
+ color: #ffffff;
12
+ }
13
+ </style>
14
+ <footer class="border-t border-gray-800 py-8 mt-12">
15
+ <div class="container mx-auto px-4">
16
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
17
+ <div>
18
+ <h3 class="text-lg font-semibold mb-4">MindMeld Explorer</h3>
19
+ <p class="text-gray-400">AI-powered search that understands your questions and provides reliable answers.</p>
20
+ </div>
21
+ <div>
22
+ <h4 class="font-medium mb-4">Product</h4>
23
+ <ul class="space-y-2">
24
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white transition">Features</a></li>
25
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white transition">Pricing</a></li>
26
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white transition">API</a></li>
27
+ </ul>
28
+ </div>
29
+ <div>
30
+ <h4 class="font-medium mb-4">Company</h4>
31
+ <ul class="space-y-2">
32
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white transition">About</a></li>
33
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white transition">Blog</a></li>
34
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white transition">Careers</a></li>
35
+ </ul>
36
+ </div>
37
+ <div>
38
+ <h4 class="font-medium mb-4">Connect</h4>
39
+ <div class="flex space-x-4">
40
+ <a href="#" class="text-gray-400 hover:text-white transition">
41
+ <i data-feather="twitter"></i>
42
+ </a>
43
+ <a href="#" class="text-gray-400 hover:text-white transition">
44
+ <i data-feather="linkedin"></i>
45
+ </a>
46
+ <a href="#" class="text-gray-400 hover:text-white transition">
47
+ <i data-feather="github"></i>
48
+ </a>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
53
+ © 2023 MindMeld Explorer. All rights reserved.
54
+ </div>
55
+ </div>
56
+ </footer>
57
+ `;
58
+ }
59
+ }
60
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ nav {
7
+ background-color: rgba(0, 0, 0, 0.8);
8
+ backdrop-filter: blur(10px);
9
+ }
10
+ .nav-link:hover {
11
+ color: #ffffff;
12
+ }
13
+ .nav-link:hover i {
14
+ stroke: #ffffff;
15
+ }
16
+ </style>
17
+ <nav class="border-b border-gray-800 py-4">
18
+ <div class="container mx-auto px-4 flex justify-between items-center">
19
+ <a href="/" class="flex items-center">
20
+ <div class="text-2xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent">MindMeld</div>
21
+ </a>
22
+ <div class="flex items-center space-x-6">
23
+ <a href="#" class="nav-link text-gray-400 hover:text-white transition flex items-center">
24
+ <i data-feather="home" class="mr-1" width="18"></i>
25
+ Home
26
+ </a>
27
+ <a href="#" class="nav-link text-gray-400 hover:text-white transition flex items-center">
28
+ <i data-feather="bookmark" class="mr-1" width="18"></i>
29
+ Saved
30
+ </a>
31
+ <a href="#" class="nav-link text-gray-400 hover:text-white transition flex items-center">
32
+ <i data-feather="settings" class="mr-1" width="18"></i>
33
+ Settings
34
+ </a>
35
+ <button class="bg-white text-black px-4 py-2 rounded-full text-sm font-medium hover:bg-gray-200 transition">
36
+ Upgrade
37
+ </button>
38
+ </div>
39
+ </div>
40
+ </nav>
41
+ `;
42
+ }
43
+ }
44
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,19 +1,68 @@
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>MindMeld Explorer - AI-Powered Search</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="components/navbar.js"></script>
12
+ <script src="components/footer.js"></script>
13
+ </head>
14
+ <body class="bg-black text-white min-h-screen flex flex-col">
15
+ <custom-navbar></custom-navbar>
16
+
17
+ <main class="flex-grow container mx-auto px-4 py-8 max-w-4xl">
18
+ <div class="text-center mb-12">
19
+ <h1 class="text-5xl font-bold mb-4 bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent">MindMeld Explorer</h1>
20
+ <p class="text-xl text-gray-300">Ask anything. Get AI-powered answers with sources.</p>
21
+ </div>
22
+
23
+ <div class="relative mb-16">
24
+ <div class="flex items-center border-2 border-gray-700 rounded-full px-6 py-4 bg-gray-900 focus-within:border-gray-500 transition-all">
25
+ <input type="text" id="search-input" placeholder="Ask anything..."
26
+ class="flex-grow bg-transparent outline-none text-lg text-white placeholder-gray-500">
27
+ <button id="search-btn" class="ml-2 p-2 rounded-full bg-white text-black hover:bg-gray-200 transition">
28
+ <i data-feather="search"></i>
29
+ </button>
30
+ </div>
31
+ <div class="absolute -bottom-8 left-0 right-0 text-center text-gray-500 text-sm">
32
+ Try "What's the capital of France?" or "Explain quantum computing"
33
+ </div>
34
+ </div>
35
+
36
+ <div id="search-results" class="space-y-8 hidden">
37
+ <!-- Results will be inserted here -->
38
+ </div>
39
+
40
+ <div id="example-queries" class="grid grid-cols-1 md:grid-cols-2 gap-4">
41
+ <div class="p-6 border border-gray-800 rounded-xl hover:bg-gray-900 cursor-pointer transition">
42
+ <h3 class="text-lg font-medium mb-2">"Explain blockchain technology"</h3>
43
+ <p class="text-gray-400">Get a simple explanation with key concepts</p>
44
+ </div>
45
+ <div class="p-6 border border-gray-800 rounded-xl hover:bg-gray-900 cursor-pointer transition">
46
+ <h3 class="text-lg font-medium mb-2">"Latest SpaceX launch details"</h3>
47
+ <p class="text-gray-400">Find up-to-date information with sources</p>
48
+ </div>
49
+ <div class="p-6 border border-gray-800 rounded-xl hover:bg-gray-900 cursor-pointer transition">
50
+ <h3 class="text-lg font-medium mb-2">"How to make sourdough bread"</h3>
51
+ <p class="text-gray-400">Step-by-step guide with expert tips</p>
52
+ </div>
53
+ <div class="p-6 border border-gray-800 rounded-xl hover:bg-gray-900 cursor-pointer transition">
54
+ <h3 class="text-lg font-medium mb-2">"Best productivity techniques"</h3>
55
+ <p class="text-gray-400">Research-backed methods to boost efficiency</p>
56
+ </div>
57
+ </div>
58
+ </main>
59
+
60
+ <custom-footer></custom-footer>
61
+
62
+ <script src="script.js"></script>
63
+ <script>
64
+ feather.replace();
65
+ </script>
66
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
67
+ </body>
68
+ </html>
script.js ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', () => {
2
+ const searchInput = document.getElementById('search-input');
3
+ const searchBtn = document.getElementById('search-btn');
4
+ const searchResults = document.getElementById('search-results');
5
+ const exampleQueries = document.getElementById('example-queries');
6
+
7
+ // Mock data for demonstration
8
+ const mockResponses = {
9
+ "what's the capital of france": {
10
+ answer: "The capital of France is Paris. Paris is located in the northern part of France on the Seine River and has been an important city for over 2,000 years.",
11
+ sources: [
12
+ { name: "Wikipedia", url: "https://en.wikipedia.org/wiki/Paris" },
13
+ { name: "Britannica", url: "https://www.britannica.com/place/Paris" }
14
+ ],
15
+ process: [
16
+ "Searching for 'capital of France' across verified sources",
17
+ "Analyzing geographical data from multiple references",
18
+ "Cross-referencing historical records",
19
+ "Verifying with official government sources"
20
+ ]
21
+ },
22
+ "explain quantum computing": {
23
+ answer: "Quantum computing is an area of computing focused on developing computer technology based on the principles of quantum theory, which explains the behavior of energy and material on the atomic and subatomic levels. Unlike classical computers that use bits (0s and 1s), quantum computers use quantum bits or qubits which can exist in multiple states simultaneously (superposition) and be entangled with each other, enabling them to solve certain complex problems much faster than classical computers.",
24
+ sources: [
25
+ { name: "IBM Research", url: "https://research.ibm.com/quantum-computing" },
26
+ { name: "Nature Journal", url: "https://www.nature.com/articles/s41534-019-0187-2" }
27
+ ],
28
+ process: [
29
+ "Compiling definitions from leading research institutions",
30
+ "Analyzing recent scientific papers on quantum mechanics",
31
+ "Comparing explanations from multiple experts",
32
+ "Simplifying complex concepts for general understanding"
33
+ ]
34
+ }
35
+ };
36
+
37
+ searchBtn.addEventListener('click', performSearch);
38
+ searchInput.addEventListener('keypress', (e) => {
39
+ if (e.key === 'Enter') performSearch();
40
+ });
41
+
42
+ // Add click handlers to example queries
43
+ document.querySelectorAll('#example-queries > div').forEach(example => {
44
+ example.addEventListener('click', () => {
45
+ const query = example.querySelector('h3').textContent.replace(/"/g, '');
46
+ searchInput.value = query;
47
+ performSearch();
48
+ });
49
+ });
50
+
51
+ function performSearch() {
52
+ const query = searchInput.value.trim().toLowerCase();
53
+ if (!query) return;
54
+
55
+ exampleQueries.classList.add('hidden');
56
+ searchResults.classList.remove('hidden');
57
+ searchResults.innerHTML = '';
58
+
59
+ // Show loading state
60
+ const loadingHTML = `
61
+ <div class="p-6 rounded-xl bg-gray-900 border border-gray-800">
62
+ <div class="flex items-center mb-4">
63
+ <div class="h-4 w-4 rounded-full bg-white mr-2 animate-pulse"></div>
64
+ <div class="text-sm text-gray-400">Processing your query...</div>
65
+ </div>
66
+ <div class="space-y-2">
67
+ ${mockResponses[query]?.process.map(step => `
68
+ <div class="flex items-center">
69
+ <div class="h-2 w-2 rounded-full bg-gray-500 mr-2"></div>
70
+ <div class="search-process h-3 rounded-full" style="width: ${Math.random() * 50 + 30}%"></div>
71
+ </div>
72
+ `).join('')}
73
+ </div>
74
+ </div>
75
+ `;
76
+ searchResults.innerHTML = loadingHTML;
77
+
78
+ // Simulate API delay
79
+ setTimeout(() => {
80
+ showResults(query);
81
+ }, 2000);
82
+ }
83
+
84
+ function showResults(query) {
85
+ const response = mockResponses[query] || {
86
+ answer: "I couldn't find a specific answer to that question. Try rephrasing or asking something else.",
87
+ sources: [],
88
+ process: []
89
+ };
90
+
91
+ const resultHTML = `
92
+ <div class="p-6 rounded-xl bg-gray-900 border border-gray-800">
93
+ <div class="flex items-start mb-6">
94
+ <div class="bg-white text-black rounded-full p-2 mr-4">
95
+ <i data-feather="check-circle"></i>
96
+ </div>
97
+ <div class="flex-grow">
98
+ <h2 class="text-xl font-semibold mb-2">Answer</h2>
99
+ <div class="typing-effect text-gray-200">${response.answer}</div>
100
+ </div>
101
+ </div>
102
+
103
+ ${response.sources.length > 0 ? `
104
+ <div class="mt-6">
105
+ <h3 class="text-lg font-medium mb-3">Sources</h3>
106
+ <div class="flex flex-wrap gap-2">
107
+ ${response.sources.map(source => `
108
+ <a href="${source.url}" target="_blank" class="source-badge px-3 py-1 bg-gray-800 rounded-full text-sm flex items-center">
109
+ <i data-feather="external-link" class="mr-1" width="14"></i>
110
+ ${source.name}
111
+ </a>
112
+ `).join('')}
113
+ </div>
114
+ </div>
115
+ ` : ''}
116
+
117
+ ${response.process.length > 0 ? `
118
+ <div class="mt-6 pt-6 border-t border-gray-800">
119
+ <h3 class="text-lg font-medium mb-3">Search Process</h3>
120
+ <div class="space-y-3">
121
+ ${response.process.map((step, i) => `
122
+ <div class="flex items-start">
123
+ <div class="text-gray-500 mr-3">${i + 1}.</div>
124
+ <div class="text-gray-300">${step}</div>
125
+ </div>
126
+ `).join('')}
127
+ </div>
128
+ </div>
129
+ ` : ''}
130
+ </div>
131
+
132
+ <div class="p-6 rounded-xl bg-gray-900 border border-gray-800">
133
+ <h3 class="text-lg font-medium mb-4">Related Questions</h3>
134
+ <div class="space-y-3">
135
+ <div class="p-3 hover:bg-gray-800 rounded-lg cursor-pointer">What are some interesting facts about ${query.includes('france') ? 'Paris' : 'quantum computing'}?</div>
136
+ <div class="p-3 hover:bg-gray-800 rounded-lg cursor-pointer">How does ${query.includes('france') ? 'Paris compare to other European capitals' : 'quantum computing differ from classical computing'}?</div>
137
+ <div class="p-3 hover:bg-gray-800 rounded-lg cursor-pointer">What is the history of ${query.includes('france') ? 'Paris as the capital of France' : 'quantum computing development'}?</div>
138
+ </div>
139
+ </div>
140
+ `;
141
+
142
+ searchResults.innerHTML = resultHTML;
143
+ feather.replace();
144
+ }
145
+ });
style.css CHANGED
@@ -1,28 +1,38 @@
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
+ @keyframes typing {
2
+ from { width: 0 }
3
+ to { width: 100% }
4
  }
5
 
6
+ @keyframes blink-caret {
7
+ from, to { border-color: transparent }
8
+ 50% { border-color: white }
9
  }
10
 
11
+ .typing-effect {
12
+ overflow: hidden;
13
+ white-space: nowrap;
14
+ border-right: 2px solid;
15
+ animation:
16
+ typing 3.5s steps(40, end),
17
+ blink-caret .75s step-end infinite;
18
  }
19
 
20
+ .source-badge {
21
+ transition: all 0.3s ease;
 
 
 
 
22
  }
23
 
24
+ .source-badge:hover {
25
+ transform: translateY(-2px);
26
+ box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
27
  }
28
+
29
+ .search-process {
30
+ background: linear-gradient(90deg, #333333, #555555, #333333);
31
+ background-size: 200% 100%;
32
+ animation: shimmer 1.5s infinite linear;
33
+ }
34
+
35
+ @keyframes shimmer {
36
+ 0% { background-position: 200% 0; }
37
+ 100% { background-position: -200% 0; }
38
+ }