⚙️

Open NotebookLLM 教學系列

Part 3: 環境設定與安裝

從零開始安裝並運行 Open NotebookLLM

Python 虛擬環境 Node.js 前端 API Key 設定

📋 環境需求

🐍 Python

版本:3.10+

用於後端 Flask 伺服器

📦 Node.js

版本:18+

用於前端 React 開發

📥 npm

版本:9+

Node.js 套件管理器

🎬 FFmpeg (可選)

用於音檔處理

STT 語音轉文字需要

📥 步驟 1:Clone 專案

# 從 GitHub Clone 專案
git clone https://github.com/ChatGPT3a01/open-notebookllm.git

# 進入專案目錄
cd open-notebookllm
                
提示:如果沒有安裝 Git,可以直接從 GitHub 下載 ZIP 檔案解壓縮。

🔑 步驟 2:設定環境變數

# Windows
copy .env.example backend\.env

# macOS/Linux
cp .env.example backend/.env
                

編輯 backend/.env 檔案,填入你的 API Key:

# 選擇 AI Provider
AI_PROVIDER=gemini

# Gemini 設定
GEMINI_API_KEY=你的-Gemini-API-Key
GEMINI_MODEL=gemini-2.0-flash

# OpenAI 設定 (可選)
OPENAI_API_KEY=你的-OpenAI-API-Key
                

🔐 取得 API Key

🌟 Gemini (推薦)

aistudio.google.com

免費額度、多模態支援

🧠 OpenAI

platform.openai.com

GPT-4o + DALL-E 3

🎯 Anthropic

console.anthropic.com

Claude 系列模型

⚡ Groq

console.groq.com

免費額度、超高速

🐍 步驟 3:安裝後端

# 進入後端目錄
cd backend

# 建立虛擬環境
python -m venv venv

# 啟動虛擬環境
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

# 安裝依賴
pip install -r requirements.txt
                
重要:每次開啟新終端機都要先啟動虛擬環境!

📦 步驟 4:安裝前端

開啟新的終端機視窗

# 進入前端目錄
cd frontend

# 安裝依賴
npm install

# 安裝額外套件
npm install -D @tailwindcss/typography
                
提示:前端使用 npm,不需要 Python 虛擬環境。

🚀 步驟 5:啟動服務

後端 (終端機 1)

cd backend
venv\Scripts\activate
python app.py
                        

運行於 http://localhost:5000

前端 (終端機 2)

cd frontend
npm run dev
                        

運行於 http://localhost:3000

成功!開啟瀏覽器訪問 http://localhost:3000 即可使用!

🏠 可選:Ollama 本地模型

如果想完全離線使用,可以安裝 Ollama:

  1. ollama.ai 下載安裝
  2. 啟動 Ollama 服務:ollama serve
  3. 下載模型:ollama pull llama3.2
  4. 設定 .env:AI_PROVIDER=ollama
優點:完全免費、離線使用、資料不外傳!

🎯 Part 3 總結

環境需求

Python 3.10+、Node.js 18+

後端設定

虛擬環境 + pip install

前端設定

npm install

API Key

設定在 backend/.env

下一步:Part 4 將介紹來源管理與 RAG 搜尋功能!
➡️ 前往 Part 4:來源管理與RAG搜尋