Bài đăng

Đang hiển thị bài đăng từ Tháng 5, 2026

Code for AI

JavaScript: // 1. Setup your Hugging Face API Token (or another provider key) const HF_TOKEN = "Put_In_Your_Huggingface_Token" ; // 2. Point to the DeepSeek model on Hugging Face's router const MODEL_NAME = "deepseek-ai/DeepSeek-V3" ; // Or your preferred DeepSeek endpoint // Grab the HTML elements const chatBox = document . getElementById ( "chat-box" ); const userInput = document . getElementById ( "user-input" ); const sendBtn = document . getElementById ( "send-btn" ); // Function to display messages function addMessage ( text , sender ) { const messageDiv = document . createElement ( "div" ); messageDiv . classList . add ( "message" ); messageDiv . classList . add ( sender === "user" ? "user-message" : "ai-message" ); messageDiv . textContent = text ; chatBox . appendChild ( messageDiv ); chatBox . scrollTop = chatBox . scrollHeight ; } // Function to send...