File size: 465 Bytes
e4a8653
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
document.getElementById("sendBtn").addEventListener("click", async () => {
  const input = document.getElementById("userInput").value.trim();
  const output = document.getElementById("response");
  if (!input) return;

  output.textContent = "Generating response...";
  try {
    const reply = await puter.ai.chat(input, { model: "gemini-2.5-flash" });
    output.textContent = reply;
  } catch (err) {
    output.textContent = "❌ Error: " + err.message;
  }
});