LLM integration with all the tabs
This commit is contained in:
67
index.html
67
index.html
@@ -106,9 +106,20 @@
|
||||
</div>
|
||||
|
||||
<h2 class="section-title">Interactive</h2>
|
||||
<a href="/pages/chat.html" class="card-link">
|
||||
<div class="ask-question-section">
|
||||
<div class="ask-question-box">
|
||||
<h3>💬 Ask a Question</h3>
|
||||
<p style="color: var(--pink-700); font-size: 0.95rem; margin-bottom: 1rem;">Ask anything about AI — terminology, concepts, techniques, or real-world applications. Powered by your configured LLM.</p>
|
||||
<div class="ask-question-input-row">
|
||||
<input class="ask-question-input" id="askInput" placeholder="Ask me anything about AI..." />
|
||||
<button class="llm-btn" onclick="askQuestion()" style="padding: 0.6rem 1.5rem;"><span class="icon">Send</span></button>
|
||||
</div>
|
||||
<div class="ask-question-answer" id="askAnswer"></div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/pages/chat.html" class="card-link" style="margin-top: 1.5rem; display: block;">
|
||||
<div class="card">
|
||||
<h3>💬 Chat</h3>
|
||||
<h3>💬 Full Chat</h3>
|
||||
<p>Try AI right now — ask questions, brainstorm ideas, get explanations, or just experiment. Powered by a real LLM API.</p>
|
||||
</div>
|
||||
</a>
|
||||
@@ -116,5 +127,57 @@
|
||||
|
||||
<footer>AI Cheat Sheet — A learning reference for artificial intelligence</footer>
|
||||
|
||||
<script src="lib/llm.js"></script>
|
||||
<script>
|
||||
(function(){
|
||||
function askQuestion() {
|
||||
var input = document.getElementById('askInput');
|
||||
var answer = document.getElementById('askAnswer');
|
||||
var text = input.value.trim();
|
||||
if (!text) return;
|
||||
|
||||
answer.classList.add('visible');
|
||||
answer.innerHTML = '<span class="llm-loading">Thinking...</span>';
|
||||
|
||||
var cheatSheetContext = `You are an AI educator answering questions based on this cheat sheet content:
|
||||
|
||||
TERMINOLOGY: Machine Learning (ML), Supervised Learning, Unsupervised Learning, Reinforcement Learning, Overfitting, Underfitting, NLP, Token, Embedding, Context Window, Paraphrasing, Sentiment Analysis, LLM, Pre-trained Model, Fine-tuning, Parameters, Inference, Weights. Acronyms: AI, ML, DL, NLP, LLM, RLHF, RAG, API, SFT, PoC, GAN, CNN, AGI, STT/ASR, TTS.
|
||||
|
||||
TECHNIQUES: Backpropagation, Epoch, Batch Size, Learning Rate, Transfer Learning, Data Augmentation, RLHF, SFT, Prompt Tuning, LoRA, Quantization, Distillation, Speculative Decoding, RAG, Agent/Tool Use, Chain-of-Thought.
|
||||
|
||||
USE CASES: Content Generation, Image Generation, Video & Audio, Summarization, Code Generation, Debugging & Review, Documentation, Code Translation, Chatbots & Assistants, Data Analysis, Research & Search, Translation, Email & Meeting Assistants, Document Processing, Healthcare, Finance, Automotive, Education, Manufacturing, Legal.
|
||||
|
||||
MODEL TYPES: LLMs (GPT-4, Claude, Gemini, Llama, Mistral), Encoder-Only (BERT, RoBERTa), Decoder-Only (GPT, Claude, Llama), Encoder-Decoder (T5, BART), CNN (ResNet, EfficientNet), ViT (CLIP, DINOv2), Diffusion (Stable Diffusion, DALL-E), GAN (StyleGAN), VQ-VAE, Flow Models, RNN/LSTM, MoE, Retrieval Models, SLMs (Phi-3, Gemma).
|
||||
|
||||
PROMPT ENGINEERING: Zero-Shot, Few-Shot, Chain-of-Thought, Role Prompting, Structured Output, Self-Consistency, ReAct. Tips: Be specific, use delimiters, provide context, iterate.
|
||||
|
||||
MATH & CONCEPTS: Attention, Self-Attention, Multi-Head Attention, Positional Encoding, FFN, Layer Norm, Loss Function, Gradient Descent, Adam, Gradient, Regularization, Batch Norm, Temperature, Top-K, Top-P, Greedy Decoding, Beam Search, Logits, Perplexity, Accuracy, Precision & Recall, F1 Score, BLEU/ROUGE, TPS. Formulas: Attention=softmax(QKᵀ/√dₖ)V, Cross-Entropy=-Σyᵢlog(pᵢ), Softmax=eˣⁱ/Σeˣʲ, ReLU=max(0,x), LayerNorm=(x-μ)/σ×γ+β, F1=2×(P×R)/(P+R), Perplexity=2^(cross-entropy).`;
|
||||
|
||||
var messages = [
|
||||
{ role: 'system', content: 'You are a helpful AI educator answering questions based on an AI cheat sheet. Use the context below to provide accurate, concise answers. If a question is outside the cheat sheet scope, say so but try to help anyway. Keep answers to 2-4 short paragraphs. Use formatting like bold text and code blocks where helpful.' },
|
||||
{ role: 'user', content: cheatSheetContext + '\n\nQuestion: ' + text }
|
||||
];
|
||||
|
||||
LLM.chatWithHistory('askAnswer', messages)
|
||||
.then(function() {
|
||||
answer.innerHTML = answer.innerHTML.replace('<span class="llm-loading">Thinking...</span>', '');
|
||||
})
|
||||
.catch(function() {});
|
||||
}
|
||||
|
||||
var askInput = document.getElementById('askInput');
|
||||
if (askInput) {
|
||||
askInput.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
askQuestion();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.askQuestion = askQuestion;
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user