Skip to content

Update and rename index.rst to index.html #704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AI Teacher (WebLLM)</title>
<script src="https://mlc.ai/web-llm/dist/webllm.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
background: #e9f0ff;
text-align: center;
padding: 20px;
}
#chat {
width: 90%;
max-width: 700px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 12px;
box-shadow: 0 0 10px #ccc;
}
#output {
border: 1px solid #ccc;
min-height: 150px;
padding: 10px;
text-align: left;
margin-top: 20px;
border-radius: 10px;
white-space: pre-wrap;
}
input, button {
padding: 10px;
margin-top: 10px;
width: 70%;
border-radius: 6px;
}
</style>
</head>
<body>
<h2>👩‍🏫 Ask Your AI Teacher (Offline Web)</h2>
<div id="chat">
<input type="text" id="question" placeholder="Ask a Class 10 question..." />
<br/>
<button onclick="askTeacher()">Ask</button>
<div id="output">Model is loading, please wait...</div>
</div>

<script>
let chat = null;

// Load the model (only runs once)
window.onload = async () => {
chat = new window.webllm.ChatModule();
await chat.reload("RedPajama-INCITE-Chat-3B-v1"); // 3B model
document.getElementById("output").innerHTML = "✅ Model ready! Ask your question.";
};

async function askTeacher() {
const question = document.getElementById("question").value;
const output = document.getElementById("output");
output.innerHTML = "🧠 Thinking...";

const reply = await chat.chat(question);
output.innerHTML = reply;
}
</script>
</body>
</html>
35 changes: 0 additions & 35 deletions docs/index.rst

This file was deleted.