🎯 What You'll Learn — สิ่งที่คุณจะได้เรียนรู้
How to run an AI chatbot entirely on your own device — your laptop, desktop, or Android phone. No internet. No account. No cost. Your conversations stay 100% private.
วิธีรันแชทบอท AI บนอุปกรณ์ของคุณเองทั้งหมด — แล็ปท็อป เดสก์ท็อป หรือโทรศัพท์ Android ไม่ต้องใช้อินเทอร์เน็ต ไม่ต้องสมัครบัญชี ไม่เสียค่าใช้จ่าย บทสนทนาของคุณเป็นส่วนตัว 100%
🗺️ Choose Your Path — เลือกเส้นทาง
| Device / อุปกรณ์ | Method / วิธี | Difficulty / ความยาก |
|---|---|---|
| PC or Laptop (Windows, Mac, Linux) คอมพิวเตอร์หรือแล็ปท็อป | Ollama + local_chat.html Section 1 & 2 ด้านล่าง → | Easy — 10 min ง่าย — 10 นาที |
| Android Phone โทรศัพท์ Android | Google AI Edge Gallery Section 3 ด้านล่าง → | Very Easy — 5 min ง่ายมาก — 5 นาที |
🦙 Section 1: Ollama Setup — ติดตั้ง Ollama
🇹🇭 ภาษาไทย
🇬🇧 English
Ollama is a free program that lets you run AI models on your own computer. It runs as a background server — you install it once, and then web pages or other apps can talk to the AI through its API.
1 Download and Install Ollama — ดาวน์โหลดและติดตั้ง
Go to ollama.com and download the installer for your operating system (Windows, Mac, or Linux).
ไปที่ ollama.com แล้วดาวน์โหลดตัวติดตั้งสำหรับระบบปฏิบัติการของคุณ
Run the installer. On Windows, Ollama will appear as a small llama icon in your
รันตัวติดตั้ง บน Windows, Ollama จะปรากฏเป็นไอคอนลามะเล็กๆ ที่ถาดระบบ (มุมล่างขวาของหน้าจอ)
🎉 That's It — You Have a Local AI! — แค่นี้ก็มี AI บนเครื่องแล้ว!
If all you want is a local AI model to chat with, you're done. Open a terminal, type ollama run gemma3:1b, and start talking. No account, no internet, no cost. Everything below is optional — it's about building a nicer interface on top.
ถ้าคุณแค่อยากได้โมเดล AI บนเครื่องเพื่อแชท เสร็จแล้ว เปิดเทอร์มินัล พิมพ์ ollama run gemma3:1b แล้วเริ่มคุยได้เลย ไม่ต้องมีบัญชี ไม่ต้องใช้เน็ต ไม่เสียเงิน เนื้อหาด้านล่างเป็นเรื่องการสร้างอินเตอร์เฟสที่สวยขึ้น
When you open Ollama, you'll see a simple window that says "Ollama is running". That's it — there's no built-in chat window. Ollama is a
เมื่อเปิด Ollama คุณจะเห็นหน้าต่างที่แสดง "Ollama is running" เท่านั้น — ไม่มีหน้าแชทในตัว Ollama เป็นเซิร์ฟเวอร์ ไม่ใช่แอปแชท มันทำงานเงียบๆ เบื้องหลังและรอให้มีอะไรส่งข้อความมา
You can chat with it using the
คุณสามารถแชทผ่านเทอร์มินัล หรือสร้างอินเตอร์เฟสของตัวเอง — หน้าเว็บ, แอปเดสก์ท็อป, แอปมือถือ — อะไรก็ได้ที่ส่ง HTTP requests ได้ นั่นคือพลังของ Ollama: มันให้สมอง AI แล้วคุณเลือกหน้าตาเอง
How It Works — ทำงานอย่างไร
When Ollama starts, it opens a http://localhost:11434 and get a reply from the AI.
เมื่อ Ollama เริ่มทำงาน มันจะเปิดพอร์ตบนคอมพิวเตอร์ — พอร์ต 11434 เหมือนประตูที่โปรแกรมอื่นมาเคาะได้ โปรแกรมใดๆ บนคอมพิวเตอร์สามารถส่งข้อความไปที่ http://localhost:11434 แล้วได้คำตอบจาก AI
Architecture — สถาปัตยกรรม
localhost:11434/api/chat ▼
ทุกอย่างเกิดขึ้นบนเครื่องของคุณ ไม่ต้องใช้อินเทอร์เน็ต ไม่มีข้อมูลถูกส่งไปที่ไหน
What Happens When You Send a Message — เกิดอะไรขึ้นเมื่อคุณส่งข้อความ
Here's the exact flow when you type "Hello" in local_chat.html:
- Your browser sends a
POST request tohttp://localhost:11434/api/chatwith your message asJSON - Ollama receives the request and loads the model (e.g. Gemma 3) into
memory (RAM or GPU) - The model processes your message
token by token — each token is roughly one word - Ollama packages the complete reply as JSON and sends it back to your browser
- JavaScript in the HTML page displays the reply and speaks it aloud using
text-to-speech
นี่คือขั้นตอนที่เกิดขึ้นเมื่อคุณพิมพ์ "Hello" ใน local_chat.html: เบราว์เซอร์ส่ง POST request → Ollama โหลดโมเดล → โมเดลสร้างคำตอบทีละโทเค็น → Ollama ส่ง JSON กลับ → JavaScript แสดงคำตอบและอ่านออกเสียง
💡 Build Your Own Interface — สร้างอินเตอร์เฟสของคุณเอง
🇬🇧 English
Because Ollama is just an API server, you can build any kind of interface you want. Our local_chat.html is one example — a single HTML file with an animated avatar. But you could also build:
- A Python script that chats in the terminal
- A voice-only assistant (no screen needed)
- A study tool that quizzes you on vocabulary
- A writing helper that checks your grammar
All you need is to send a POST request to localhost:11434/api/chat with your message. Here's the simplest example:
🇹🇭 ภาษาไทย
เพราะ Ollama เป็นแค่ local_chat.html ของเราเป็นแค่ตัวอย่างหนึ่ง — ไฟล์ HTML เดียวที่มีอวาตาร์แอนิเมชัน แต่คุณยังสามารถสร้างสิ่งเหล่านี้ได้:
Python script ที่แชทในเทอร์มินัล — เขียนโค้ดไม่กี่บรรทัดก็คุยกับ AI ได้แล้วVoice assistant ที่ใช้เสียงอย่างเดียว (ไม่ต้องมีหน้าจอ) — เหมาะสำหรับคนที่ชอบพูดมากกว่าพิมพ์- เครื่องมือ
quiz คำศัพท์ — ให้ AI ออกข้อสอบและตรวจคำตอบให้ - ตัวช่วยเขียน (
writing helper ) ที่ตรวจgrammar ให้ — ส่งข้อความไปแล้ว AI จะแก้ไขให้
สิ่งที่คุณต้องทำมีแค่ส่ง localhost:11434/api/chat พร้อมข้อความของคุณ นี่คือตัวอย่างที่ง่ายที่สุด:
🇹🇭 อธิบายโค้ด
fetch() — เป็น
model — ชื่อgemma3:1b) ถ้าดาวน์โหลดโมเดลอื่นก็เปลี่ยนชื่อตรงนี้
messages — role: 'user' หมายถึงข้อความจากผู้ใช้ และ content คือเนื้อหาข้อความ
stream: false — บอกให้ Ollama สร้างคำตอบให้เสร็จทั้งหมดก่อนแล้วค่อยส่งกลับมาทีเดียว (ถ้าเป็น true จะส่งกลับมาทีละคำแบบ
data.message.content — คำตอบจาก AI จะอยู่ใน
🇬🇧 Code Explained
fetch() — a JavaScript function that sends an HTTP request to a server. Here, it sends your message to Ollama running on your own machine.
model — the name of the AI model you downloaded (e.g. gemma3:1b). Change this if you downloaded a different model.
messages — an array of messages. role: 'user' means it's from you, and content is your actual message text.
stream: false — tells Ollama to generate the full reply before sending it back all at once. If true, it sends words one at a time (streaming).
data.message.content — the AI's reply lives in this field. Display it on your page, speak it aloud, or do anything you want with it.
2 Download a Model — ดาวน์โหลดโมเดล
Open a
This downloads Gemma 3 (1 billion parameters) — about 1.5 GB. It's small enough to run on most computers.
คำสั่งนี้จะดาวน์โหลด Gemma 3 (1 พันล้านพารามิเตอร์) — ประมาณ 1.5 GB เล็กพอที่จะรันได้บนคอมพิวเตอร์ส่วนใหญ่
💡 Bigger Models — โมเดลที่ใหญ่กว่า
| Model โมเดล | Size ขนาด | RAM Needed RAM ที่ต้องการ | Quality คุณภาพ |
|---|---|---|---|
gemma3:1b | 1.5 GB | ~4 GB | Good for simple chat ดีสำหรับแชทง่ายๆ |
gemma3:4b | 3 GB | ~6 GB | Better reasoning ให้เหตุผลดีขึ้น |
gemma3:12b | 8 GB | ~12 GB | Near cloud quality ใกล้เคียงคุณภาพคลาวด์ |
llama3:8b | 4.7 GB | ~8 GB | Great all-around ดีรอบด้าน |
Choose based on your RAM. If you get an "out of memory" error, use a smaller model.
เลือกตามขนาด RAM ถ้าเจอข้อผิดพลาด "out of memory" ให้ใช้โมเดลที่เล็กกว่า
3 Test It — ทดสอบ
In the same terminal, run:
If you get a reply, Ollama is working! You can also type ollama run gemma3:1b without a message to start an interactive chat in the terminal.
ถ้าได้คำตอบกลับมา แสดงว่า Ollama ทำงานแล้ว! คุณสามารถพิมพ์ ollama run gemma3:1b โดยไม่ใส่ข้อความเพื่อเริ่มแชทในเทอร์มินัลได้
4 Allow Web Access (Important!) — อนุญาตให้เว็บเข้าถึง
By default, Ollama blocks web pages from connecting to it. To allow our chat page to work, you need to set the OLLAMA_ORIGINS
Windows (PowerShell):
Mac / Linux (Terminal):
After running this, restart Ollama — quit it from the system tray and reopen it.
หลังจากรันคำสั่งนี้ รีสตาร์ท Ollama — ปิดจากถาดระบบแล้วเปิดใหม่
⚠️ Make It Permanent — ตั้งค่าถาวร
The command above only lasts for the current session. To make it permanent on Windows:
Settings → System → About → Advanced system settings → Environment Variables → New
Name: OLLAMA_ORIGINS — Value: *
คำสั่งด้านบนใช้ได้แค่เซสชันปัจจุบัน เพื่อตั้งค่าถาวรบน Windows ให้เพิ่มตัวแปรสภาพแวดล้อมผ่าน Settings
🌐 Section 2: Chat UI — หน้าเว็บแชท
🇹🇭 ภาษาไทย
Ollama ไม่มีหน้าแชทในตัว — มันเป็นแค่
🇬🇧 English
Ollama has no built-in chat UI — it's just a background server. But we can use a simple HTML page as a frontend — no installation needed, just open the file in your browser.
🇹🇭 มันทำงานอย่างไร?
1. คุณเปิดไฟล์ HTML ในเบราว์เซอร์
2. คุณพิมพ์ข้อความ
3. JavaScript ส่งข้อความไปที่ Ollama ผ่าน localhost:11434)
4. Ollama สร้างคำตอบด้วยโมเดล AI
5. คำตอบปรากฏในหน้าเว็บพร้อมเสียงพูด
🇬🇧 How does it work?
1. You open the HTML file in your browser
2. You type a message
3. JavaScript sends it to Ollama via API (localhost:11434)
4. Ollama generates a reply using the AI model
5. The reply appears on the page with text-to-speech
⬇️ Download the Chat Page — ดาวน์โหลดหน้าแชท
This is a single HTML file with an animated avatar, voice input (microphone), and text-to-speech. Works offline once downloaded.
ไฟล์ HTML เดียวพร้อมอวาตาร์แอนิเมชัน, ป้อนเสียง (ไมค์), และ text-to-speech ทำงานแบบออฟไลน์หลังดาวน์โหลด
⬇️ Download local_chat.htmlOr open it directly: Open local_chat.html
1 Open the File — เปิดไฟล์
Download local_chat.html and open it in Chrome or Edge (double-click the file, or drag it into the browser).
ดาวน์โหลด local_chat.html แล้วเปิดใน Chrome หรือ Edge
2 Check Connection — ตรวจสอบการเชื่อมต่อ
At the top of the page, you should see a green dot and "Connected". If you see a red dot, make sure:
- Ollama is running (llama icon in system tray)
- You set
OLLAMA_ORIGINS=*and restarted Ollama - The URL in Settings matches (default:
http://localhost:11434)
3 Chat! — แชทได้เลย!
Type a message and press Send (or hit Enter). The avatar will animate and speak the reply.
Features:
- 🎤 Microphone — tap the mic button to speak instead of typing (Chrome/Edge only)
- 🔊 Text-to-Speech — the avatar speaks every reply automatically
- ⚙️ Settings — change model, system prompt, voice, or Ollama URL
- ⬇️ Download — save the page for fully offline use
💡 Use from Your Phone — ใช้จากโทรศัพท์
If Ollama runs on your PC, you can chat from your phone on the same Wi-Fi network:
- Find your PC's IP address (run
ipconfigon Windows) - On your phone, open
http://YOUR_PC_IP:11434in Chrome to verify - Open local_chat.html on your phone and change the URL in Settings to
http://YOUR_PC_IP:11434
ถ้า Ollama รันบน PC คุณสามารถแชทจากโทรศัพท์ผ่าน Wi-Fi เดียวกันได้ — เปลี่ยน URL ใน Settings เป็น IP ของ PC
✅ PC / Laptop Tutorial Complete! — จบบทเรียนสำหรับคอมพิวเตอร์แล้ว!
If you're on a laptop or desktop, you're all set. You have Ollama running, a model downloaded, and a chat page to talk to it. Everything below is for phones — skip it if you don't need it.
ถ้าคุณใช้แล็ปท็อปหรือเดสก์ท็อป เสร็จสมบูรณ์แล้ว คุณมี Ollama ทำงาน โมเดลดาวน์โหลดแล้ว และหน้าแชทพร้อมใช้ เนื้อหาด้านล่างสำหรับโทรศัพท์ — ข้ามได้ถ้าไม่ต้องการ
📱 Section 3: Google AI Edge Gallery — สำหรับโทรศัพท์
🇹🇭 ภาษาไทย
ส่วนนี้สำหรับโทรศัพท์ — ถ้าคุณอยากรัน AI บน Android หรือ iPhone โดยไม่ต้องใช้คอมพิวเตอร์เลย
🇬🇧 English
This section is for phones — if you want to run AI on your Android or iPhone without needing a computer at all. Google AI Edge Gallery is a free app from Google that runs AI directly on your phone's processor and memory. No internet, no server, no computer required.
1 Install the App — ติดตั้งแอป
Open the Google Play Store and search for "Google AI Edge Gallery". Install it (it's free).
เปิด Google Play Store แล้วค้นหา "Google AI Edge Gallery" ติดตั้ง (ฟรี)
Also available on the Apple App Store for iPhone.
2 Download a Model — ดาวน์โหลดโมเดล
When you open the app, you'll see several tiles. Tap "AI Chat" or "Prompt Lab".
The app will ask you to download a model. Choose one:
| Model โมเดล | Size ขนาด | Best For เหมาะสำหรับ |
|---|---|---|
| Gemma 3n E2B ⭐ | ~1.5 GB | Most phones — fast and efficient โทรศัพท์ส่วนใหญ่ — เร็วและประหยัด |
| Gemma 3n E4B | ~3 GB | Newer phones with 8+ GB RAM — better quality โทรศัพท์ใหม่ที่มี RAM 8 GB+ — คุณภาพดีกว่า |
The download happens over Wi-Fi. Once done, the model works completely offline.
การดาวน์โหลดใช้ Wi-Fi เมื่อเสร็จแล้ว โมเดลจะทำงานแบบออฟไลน์ได้ทั้งหมด
3 Start Chatting — เริ่มแชท
After the model downloads, select it and start typing. The AI responds directly on your phone — no data leaves your device.
หลังจากโมเดลดาวน์โหลดเสร็จ เลือกโมเดลแล้วเริ่มพิมพ์ AI ตอบบนโทรศัพท์โดยตรง — ไม่มีข้อมูลออกจากอุปกรณ์ของคุณ
💡 Thinking Mode — โหมดคิด
Toggle "Thinking Mode" to see the model's step-by-step reasoning process. This works with Gemma 4 models and shows how the AI arrives at its answer.
เปิด "Thinking Mode" เพื่อดูกระบวนการคิดทีละขั้นของโมเดล
🧩 Section 4: Agent Skills — ทักษะของเอเจนต์
🇹🇭 ภาษาไทย
🇬🇧 English
Agent Skills are what make Edge Gallery really interesting — they're modular tools that give the AI abilities beyond just chatting. For example: searching Wikipedia, showing interactive maps, generating QR codes, or even tracking your mood.
How Skills Work — ทักษะทำงานอย่างไร
Each skill is a small package of HTML and JavaScript. Here's the flow:
- You type a message in the Agent Skills chat
- The AI reads your message and decides if a skill is relevant
- If yes, the AI automatically calls the skill — you don't need to do anything special
- The skill runs its code and returns a result — text, an image, or an interactive web page
- The result appears in your chat as a rich card
แต่ละทักษะเป็นแพ็กเกจเล็กๆ ของ HTML และ JavaScript คุณแค่พิมพ์ข้อความ แล้ว AI จะเลือกทักษะที่เหมาะสมเองโดยอัตโนมัติ
Built-in Skills — ทักษะที่มีมาให้
| Skill ทักษะ | What It Does ทำอะไร | Try Saying... ลองพูดว่า... |
|---|---|---|
| 🗺️ Interactive Map แผนที่ | Shows places on a Google Map แสดงสถานที่บน Google Map | "Show me the Eiffel Tower on a map" |
| 📖 Wikipedia วิกิพีเดีย | Looks up facts from Wikipedia ค้นหาข้อมูลจาก Wikipedia | "Look up photosynthesis on Wikipedia" |
| 📱 QR Code คิวอาร์โค้ด | Generates a QR code สร้าง QR code | "Make a QR code for google.com" |
| 😊 Mood Tracker ติดตามอารมณ์ | Tracks your daily mood with charts ติดตามอารมณ์รายวันพร้อมกราฟ | "Log my mood as happy today" |
| #️⃣ Hash Calculator คำนวณแฮช | Computes SHA-1 hashes คำนวณค่าแฮช SHA-1 | "Calculate the hash of hello world" |
How Skills Are Built — ทักษะสร้างจากอะไร
Every skill has the same structure:
The SKILL.md file tells the AI when and how to use the skill. It contains:
- Name and description — so the AI knows what the skill does
- Instructions — tells the AI exactly what data to pass to the script
The index.html file contains the actual code. It exposes one function that the AI calls:
The function can return:
- result — plain text shown in the chat
- image — a base64 image displayed inline
- webview — a full interactive HTML page (maps, charts, games, etc.)
Loading Custom Skills — โหลดทักษะที่กำหนดเอง
The app supports loading skills three ways:
- Featured list — browse community skills in the app
- From URL — enter a URL pointing to the skill folder (requires proper web hosting like GitHub Pages)
- Local import — load a skill folder from your phone's storage
To access these options: open Agent Skills, select a model, then look for the Skills management area in the chat interface.
เพื่อเข้าถึงตัวเลือกเหล่านี้: เปิด Agent Skills เลือกโมเดล แล้วมองหาส่วนจัดการ Skills ในหน้าแชท
⚠️ Note — หมายเหตุ
Agent Skills and custom skill loading are new features (added in v1.0.11, April 2025). The UI may vary depending on your app version and device. The feature is still evolving — if you don't see the skill manager, check for app updates in the Play Store.
Agent Skills เป็นฟีเจอร์ใหม่ (เพิ่มในเวอร์ชัน 1.0.11) UI อาจแตกต่างกันตามเวอร์ชันและอุปกรณ์ ถ้าไม่เห็นตัวจัดการทักษะ ให้ตรวจสอบอัปเดตแอปใน Play Store
⚖️ Ollama vs Edge Gallery — เปรียบเทียบ
| Feature ฟีเจอร์ | Ollama + local_chat.html | Google AI Edge Gallery |
|---|---|---|
| Device อุปกรณ์ | PC, Laptop, Mac คอมพิวเตอร์, แล็ปท็อป | Android, iPhone โทรศัพท์ |
| Setup การติดตั้ง | Install Ollama + download model ติดตั้ง Ollama + ดาวน์โหลดโมเดล | Install app + download model ติดตั้งแอป + ดาวน์โหลดโมเดล |
| Chat UI หน้าแชท | HTML page in browser หน้า HTML ในเบราว์เซอร์ | Built into the app มีในแอปเลย |
| Voice input ป้อนเสียง | Yes (Chrome/Edge) ได้ (Chrome/Edge) | No (keyboard only) ไม่ได้ (แป้นพิมพ์เท่านั้น) |
| Text-to-speech อ่านออกเสียง | Yes (browser voices) ได้ (เสียงเบราว์เซอร์) | No ไม่ได้ |
| Custom avatar อวาตาร์ | Yes (CSS animated face) ได้ (หน้าแอนิเมชัน CSS) | No ไม่มี |
| Extensible ขยายได้ | Edit HTML/JS freely แก้ไข HTML/JS ได้อิสระ | Agent Skills system ระบบ Agent Skills |
| API access เข้าถึง API | Yes (localhost:11434) ได้ | No external API ไม่มี API ภายนอก |
| Offline ออฟไลน์ | Yes (after setup) ได้ (หลังติดตั้ง) | Yes (after model download) ได้ (หลังดาวน์โหลดโมเดล) |
| Cost ค่าใช้จ่าย | Free ฟรี | Free ฟรี |
🎉 You Did It! — สำเร็จแล้ว!
You now have a private AI running on your own device. No cloud, no subscription, no data leaving your machine. Welcome to the future of personal AI.
ตอนนี้คุณมี AI ส่วนตัวที่รันบนอุปกรณ์ของคุณเอง ไม่มีคลาวด์ ไม่ต้องสมัครสมาชิก ไม่มีข้อมูลออกจากเครื่อง ยินดีต้อนรับสู่อนาคตของ AI ส่วนบุคคล