跳到正文
DEV Community· Jeffery Kachukwucide·· 3 小時前AI 評分44

The Room Is Not Empty:在裝置上運行的鬧鬼聊天機械人

The Room Is Not Empty: a haunted chatbot that runs on your own device

AI 導讀

The Room Is Not Empty 是一款在用戶裝置上運行的鬧鬼聊天機械人,對話越久,回覆越令人不安。裝置支援 WebGPU 時,應用會透過 WebLLM 在瀏覽器運行 Llama 3.2 1B;否則會改用預先寫好的台詞。整個應用只有一個 index.html 檔案,沒有後端;約 700 MB 的模型下載完成後,可在關閉 Wi-Fi 的情況下運行,聊天內容不會傳送至伺服器。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine.

What I Built

The Room Is Not Empty is a chat window that gets worse the longer you talk to it. It starts friendly. By the third message it repeats your words back slightly wrong. By the fifth it knows the time and your battery level. By the eighth, your first message has changed, and it has noticed the silence. By the eleventh, it has picked three words from everything you typed, told you it knows which of them is reading, and locked the chat.

I took "Ghost in the Machine" literally. The ghost is the model, and the machine is your own phone.

Demo

Live: https://anthonyonyenaobijeffery-debug.github.io/The-Haunted-Chatbot/

[Insert your screen recording here]

Try it for eleven messages before you judge it.

Code

https://github.com/anthonyonyenaobijeffery-debug/The-Haunted-Chatbot

The whole app is one index.html file with no backend, so you can read it in one sitting.

How I Built It

The app has two parts that work together:

  • The director (the script). Six stages decide how the room behaves. Each stage has a rule, such as "repeat two to four of the person's words, slightly wrong," or "quote the exact words they just said, then ask why." The stage follows the turn count, so the fear builds on a schedule.
  • The voice (the model). Where WebGPU is available, Llama 3.2 1B runs in the browser through WebLLM. It reads the conversation and writes each reply under the current stage's rule.

If the device can't run the model, or the model's reply breaks the illusion (for example, by calling itself an AI), pre-written lines take over. They still borrow your words, so the scene holds. The fallback is scripted, and I say so plainly: the model makes the replies personal, and the script makes them frightening on schedule.

The effects are plain CSS and JavaScript: a flicker on the screen, a blurred reveal on each line, and a jolt when the room changes. They are turned off for users who prefer reduced motion. Battery level and time are read on the device and never sent anywhere.

Why Open Innovation Matters

This project depends on the model being open. Once it's downloaded, it runs with the Wi-Fi off, so the chat stays inside the room. Nothing you type goes to a server, and you don't need a key or a subscription to be scared. Because the model is open, I can change how it behaves at each stage without asking a provider for permission. A closed API could write similar lines, but it would need your messages to do it, and it could change or disappear without notice.

The tradeoffs are real. The first download is about 700 MB, and phones without WebGPU get the scripted version.

The Spirit of It

I wanted the page to feel like something you shouldn't have opened. The screen is the only light, the edges go dark, and the text uses an old-print serif.

[Add the moment it landed for you when you tested it. This is the part judges remember, so make it specific.]

Demo link : https://anthonyonyenaobijeffery-debug.github.io/The-Haunted-Chatbot/

來源:DEV Community · dev.to