Spaces:
Running
Running
create me an LLm
Browse files- index.html +18 -2
- llm.html +127 -0
index.html
CHANGED
|
@@ -102,7 +102,13 @@
|
|
| 102 |
Password Gen
|
| 103 |
</div>
|
| 104 |
</button>
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
<div class="p-8">
|
| 107 |
<!-- QR Code Generator -->
|
| 108 |
<div id="qr" class="tab-content active">
|
|
@@ -139,9 +145,19 @@
|
|
| 139 |
</div>
|
| 140 |
</div>
|
| 141 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
<!-- Password Generator -->
|
| 144 |
-
|
| 145 |
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Password Generator</h2>
|
| 146 |
<div class="mb-4">
|
| 147 |
<div class="flex items-center gap-4 mb-4">
|
|
|
|
| 102 |
Password Gen
|
| 103 |
</div>
|
| 104 |
</button>
|
| 105 |
+
<button class="tab-btn px-6 py-4 font-medium text-gray-300 hover:text-white border-b-2 border-transparent hover:border-cyan-400 transition-all" data-tab="llm">
|
| 106 |
+
<div class="flex items-center gap-2">
|
| 107 |
+
<i data-feather="message-square" class="w-5 h-5"></i>
|
| 108 |
+
AI Chat
|
| 109 |
+
</div>
|
| 110 |
+
</button>
|
| 111 |
+
</div>
|
| 112 |
<div class="p-8">
|
| 113 |
<!-- QR Code Generator -->
|
| 114 |
<div id="qr" class="tab-content active">
|
|
|
|
| 145 |
</div>
|
| 146 |
</div>
|
| 147 |
</div>
|
| 148 |
+
<!-- LLM Chat -->
|
| 149 |
+
<div id="llm" class="tab-content">
|
| 150 |
+
<div class="text-center py-12">
|
| 151 |
+
<h2 class="text-3xl font-semibold text-white mb-4">AI Chat Assistant</h2>
|
| 152 |
+
<p class="text-gray-300 mb-6">This tool opens in a new page for better experience.</p>
|
| 153 |
+
<a href="llm.html" class="bg-gradient-to-r from-cyan-500 to-blue-600 hover:from-cyan-600 hover:to-blue-700 text-white px-6 py-3 rounded-xl inline-flex items-center gap-2 shadow-lg hover:shadow-cyan-500/20 transition-all">
|
| 154 |
+
<i data-feather="message-square"></i> Open Chat
|
| 155 |
+
</a>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
|
| 159 |
<!-- Password Generator -->
|
| 160 |
+
<div id="password" class="tab-content">
|
| 161 |
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Password Generator</h2>
|
| 162 |
<div class="mb-4">
|
| 163 |
<div class="flex items-center gap-4 mb-4">
|
llm.html
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>LLM Chat | Swiss Army Web Tools</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<style>
|
| 11 |
+
.message {
|
| 12 |
+
max-width: 80%;
|
| 13 |
+
animation: fadeIn 0.3s ease;
|
| 14 |
+
}
|
| 15 |
+
@keyframes fadeIn {
|
| 16 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 17 |
+
to { opacity: 1; transform: translateY(0); }
|
| 18 |
+
}
|
| 19 |
+
#thinkingIndicator {
|
| 20 |
+
display: none;
|
| 21 |
+
}
|
| 22 |
+
#thinkingIndicator.visible {
|
| 23 |
+
display: flex;
|
| 24 |
+
}
|
| 25 |
+
</style>
|
| 26 |
+
</head>
|
| 27 |
+
<body class="min-h-screen bg-gradient-to-br from-gray-900 to-gray-800">
|
| 28 |
+
<div class="container mx-auto px-4 py-8">
|
| 29 |
+
<header class="text-center mb-8">
|
| 30 |
+
<h1 class="text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-cyan-400 to-blue-500">
|
| 31 |
+
LLM Chat Assistant
|
| 32 |
+
</h1>
|
| 33 |
+
<p class="text-gray-300 mt-2">Chat with our AI assistant powered by OpenAI</p>
|
| 34 |
+
</header>
|
| 35 |
+
|
| 36 |
+
<div class="bg-gray-800 rounded-2xl shadow-xl overflow-hidden max-w-4xl mx-auto border border-gray-700 backdrop-blur-sm bg-opacity-50">
|
| 37 |
+
<div class="p-6 h-[70vh] overflow-y-auto" id="chatContainer">
|
| 38 |
+
<div class="message bg-gray-700 p-4 rounded-2xl mb-4 ml-auto">
|
| 39 |
+
<p>Hello! I'm your AI assistant. How can I help you today?</p>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
<div class="p-4 border-t border-gray-700 relative">
|
| 44 |
+
<div id="thinkingIndicator" class="absolute -top-4 left-0 right-0 justify-center items-center gap-2 text-gray-400">
|
| 45 |
+
<div class="flex space-x-1">
|
| 46 |
+
<div class="w-2 h-2 bg-gray-400 rounded-full animate-bounce"></div>
|
| 47 |
+
<div class="w-2 h-2 bg-gray-400 rounded-full animate-bounce" style="animation-delay: 0.2s"></div>
|
| 48 |
+
<div class="w-2 h-2 bg-gray-400 rounded-full animate-bounce" style="animation-delay: 0.4s"></div>
|
| 49 |
+
</div>
|
| 50 |
+
<span>Thinking...</span>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<div class="flex gap-2">
|
| 54 |
+
<textarea id="userInput" class="flex-1 px-4 py-3 bg-gray-700 border border-gray-600 rounded-xl focus:outline-none focus:ring-2 focus:ring-cyan-500 text-white placeholder-gray-400 resize-none"
|
| 55 |
+
rows="1" placeholder="Type your message here..." autocomplete="off"></textarea>
|
| 56 |
+
<button id="sendBtn" class="bg-gradient-to-r from-cyan-500 to-blue-600 hover:from-cyan-600 hover:to-blue-700 text-white px-5 py-3 rounded-xl flex items-center gap-2 shadow-lg hover:shadow-cyan-500/20 transition-all">
|
| 57 |
+
<i data-feather="send"></i>
|
| 58 |
+
</button>
|
| 59 |
+
</div>
|
| 60 |
+
<p class="text-xs text-gray-500 mt-2">Note: This is a demo using mock responses. In a real implementation, you would connect to an LLM API.</p>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
|
| 65 |
+
<script>
|
| 66 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 67 |
+
feather.replace();
|
| 68 |
+
|
| 69 |
+
const chatContainer = document.getElementById('chatContainer');
|
| 70 |
+
const userInput = document.getElementById('userInput');
|
| 71 |
+
const sendBtn = document.getElementById('sendBtn');
|
| 72 |
+
const thinkingIndicator = document.getElementById('thinkingIndicator');
|
| 73 |
+
|
| 74 |
+
// Auto-resize textarea
|
| 75 |
+
userInput.addEventListener('input', function() {
|
| 76 |
+
this.style.height = 'auto';
|
| 77 |
+
this.style.height = (this.scrollHeight) + 'px';
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
// Send message on Enter (Shift+Enter for new line)
|
| 81 |
+
userInput.addEventListener('keydown', function(e) {
|
| 82 |
+
if (e.key === 'Enter' && !e.shiftKey) {
|
| 83 |
+
e.preventDefault();
|
| 84 |
+
sendMessage();
|
| 85 |
+
}
|
| 86 |
+
});
|
| 87 |
+
|
| 88 |
+
sendBtn.addEventListener('click', sendMessage);
|
| 89 |
+
|
| 90 |
+
function sendMessage() {
|
| 91 |
+
const message = userInput.value.trim();
|
| 92 |
+
if (!message) return;
|
| 93 |
+
|
| 94 |
+
// Add user message to chat
|
| 95 |
+
addMessage(message, 'user');
|
| 96 |
+
userInput.value = '';
|
| 97 |
+
userInput.style.height = 'auto';
|
| 98 |
+
|
| 99 |
+
// Show thinking indicator
|
| 100 |
+
thinkingIndicator.classList.add('visible');
|
| 101 |
+
|
| 102 |
+
// Mock AI response (in a real app, you'd call an API here)
|
| 103 |
+
setTimeout(() => {
|
| 104 |
+
thinkingIndicator.classList.remove('visible');
|
| 105 |
+
const mockResponses = [
|
| 106 |
+
"Interesting question! Based on my knowledge, I'd say...",
|
| 107 |
+
"Thanks for asking. Here's what I know about that...",
|
| 108 |
+
"I'm glad you asked! The answer is...",
|
| 109 |
+
"That's a great question. Let me think about that...",
|
| 110 |
+
"I don't have all the answers, but here's what I can tell you..."
|
| 111 |
+
];
|
| 112 |
+
const randomResponse = mockResponses[Math.floor(Math.random() * mockResponses.length)];
|
| 113 |
+
addMessage(randomResponse, 'ai');
|
| 114 |
+
}, 1500 + Math.random() * 2000);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
function addMessage(text, sender) {
|
| 118 |
+
const messageDiv = document.createElement('div');
|
| 119 |
+
messageDiv.className = `message p-4 rounded-2xl mb-4 ${sender === 'user' ? 'bg-cyan-600 ml-auto' : 'bg-gray-700 mr-auto'}`;
|
| 120 |
+
messageDiv.innerHTML = `<p>${text.replace(/\n/g, '<br>')}</p>`;
|
| 121 |
+
chatContainer.appendChild(messageDiv);
|
| 122 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 123 |
+
}
|
| 124 |
+
});
|
| 125 |
+
</script>
|
| 126 |
+
</body>
|
| 127 |
+
</html>
|