跳到正文
DEV Community· Chandanpreet kaur·· 5 小時前AI 評分31

Ghost in the Terminal:在命令列運行的 AI 故事生成器

Ghost in the Terminal

AI 導讀

開發者製作了 Ghost in the Terminal,一款在命令列運行、以神秘幽靈口吻回應提問的 AI 故事生成器。它使用 Ollama 在本機運行開放權重模型 Gemma 3 1B,透過 Ollama 的本機 HTTP API 生成回應,毋須獨立的雲端 AI API 金鑰。模型下載後,只要 Ollama 和模型已在本機,就可離線運行。

正文

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

What I Built

I built Ghost in the Terminal, a spooky AI storyteller that lives in the command line.

Ask it a question, and it responds like a mysterious ghost hiding inside your computer. It can tell eerie stories about abandoned servers, forgotten programmers, and machines that seem to remember things they shouldn't.

The project combines the Halloween atmosphere with a practical experiment in running AI locally.

Demo

The demo runs directly in the terminal on my computer.

To try it:

  1. Install Ollama.
  2. Download the model with ollama run gemma3:1b.
  3. Clone or download the repository and run python ghost.py.

Example prompt: "What did this computer dream about last night?"

Code

GitHub repository: https://github.com/chandanpreetk853/ghost.py.git

The project uses Python's built-in libraries to communicate with Ollama's local API.

How I Built It

The project uses:

  • Python for the interactive terminal application.
  • Ollama to run the model locally.
  • Gemma 3 1B as the open-weight language model.
  • Ollama's local HTTP API to generate the ghost's responses.

The application sends prompts to the model running on the same computer. A system prompt gives the model its spooky personality and keeps its responses concise.

No separate cloud AI API key is required.

Why Does Open Innovation Matter?

For a small project like this, local AI makes experimentation accessible.

After downloading the model, the storyteller can run without an internet connection, provided Ollama and the model are available locally. Prompts can stay on the user's machine rather than being sent to a third-party AI service.

Using an open-weight model also gives developers more control over how they build their applications. They can experiment with different models, change the system prompt, and extend the program without depending on a proprietary hosted inference API.

This project is a small example of an important idea: AI experiments do not always need to start with an expensive cloud service.

The Spirit of It

A terminal is usually a place where we give machines instructions. I wanted to turn that relationship around and imagine what would happen if the machine had a story of its own.

The result is a tiny digital ghost: no supernatural powers, just a locally running model, a few lines of Python, and a little Halloween imagination.

Prize Categories

Open-source AI / open-weight models.

來源:DEV Community · dev.to