The Visual Zettelkasten is an Obsidian plugin designed to enhance your note-taking experience by integrating AI-powered template generation and a sophisticated recommendation system. The plugin operates entirely offline, ensuring data privacy and compliance with organizational policies that prohibit the use of external APIs. It utilizes local AI models:
- Llama 2 via
llama.cpp
for text generation. - Janus for multi-modal tasks (image processing and generation).
This guide provides comprehensive, step-by-step instructions to set up the Visual Zettelkasten plugin on your PC. It is designed for users who are familiar with downloading and installing Python and its libraries.
- Prerequisites
- Project Structure
- Environment Setup
- Configuration
- Running the Application
- Usage Guide
- Troubleshooting
- Conclusion
Before you begin, ensure that you have the following installed on your PC:
- Python 3.8 or higher: For running the backend server.
- Node.js and npm: For building the Obsidian plugin.
- Obsidian: The note-taking application where the plugin will be installed.
Note: This guide assumes you are using a Windows PC. Adjust the commands accordingly if you are using macOS or Linux.
The project consists of two main components:
- Obsidian Plugin (Frontend): Manages user interactions within Obsidian.
- Python Backend (Backend): Processes data using local AI models.
The folder structure is as follows:
visual-zettelkasten/
├── obsidian-plugin/
│ ├── src/
│ │ ├── main.ts
│ │ ├── settings.ts
│ │ ├── VisualZettelkastenSettingTab.ts
│ │ ├── TemplateSelectionModal.ts
│ │ ├── TemplateCustomizationModal.ts
│ │ ├── CustomInputModal.ts
│ │ ├── DefineRelationshipsModal.ts
│ │ ├── DrawingCanvasModal.ts
│ │ └── styles.css
│ ├── manifest.json
│ ├── package.json
│ ├── tsconfig.json
│ └── .eslintrc.json
├── backend/
│ ├── app.py
│ ├── requirements.txt
│ ├── models/
│ │ ├── llama.cpp/ # Directory for llama.cpp and Llama 2 model files
│ │ └── janus/ # Directory for Janus model files
│ └── data/
│ ├── embeddings/ # Directory for storing embeddings
│ └── access_metadata.json # File for tracking document access metadata
└── README.md
-
Download Python:
- Go to the official Python website.
- Download the latest version of Python 3.8 or higher.
-
Install Python:
- Run the installer.
- Important: Check the box that says "Add Python to PATH" during installation.
-
Download Node.js:
- Visit the official Node.js website.
- Download the LTS (Long Term Support) version for your operating system.
-
Install Node.js:
- Run the installer and follow the prompts.
-
Verify Installation:
- Open Command Prompt (Windows) or Terminal (macOS/Linux).
- Run
node -v
andnpm -v
to verify the installations.
-
Download Git:
- Go to the official Git website.
- Download the appropriate installer for your OS.
-
Install Git:
- Run the installer and follow the prompts.
- Use default settings unless you have specific preferences.
For llama.cpp
, you need a C++ compiler:
-
Windows:
- Install Visual Studio Build Tools.
- During installation, select "Desktop development with C++".
-
macOS:
- Install Xcode Command Line Tools:
xcode-select --install
- Install Xcode Command Line Tools:
-
Linux:
- Install
build-essential
:sudo apt-get install build-essential
- Install
-
Register and Accept Terms:
- Visit the Llama 2 page on Meta's website.
- Follow the instructions to request access to the model.
- Accept the license agreement.
-
Download Model Weights:
- Download the Llama 2 model weights suitable for your hardware (e.g., 7B, 13B, 70B parameters).
- Note: Larger models require more RAM and GPU memory.
-
Place Model Files:
- Create a directory
visual-zettelkasten/backend/models/llama.cpp/
. - Place the downloaded model files in this directory.
- Create a directory
-
Obtain Janus Model:
- Visit the official Janus model repository or website.
- Follow the instructions to download the Janus model files.
-
Place Model Files:
- Create a directory
visual-zettelkasten/backend/models/janus/
. - Place the Janus model files in this directory.
- Create a directory
Open Command Prompt or Terminal and run:
git clone https://github.com/yourusername/visual-zettelkasten.git
Replace yourusername
with the appropriate username or repository path.
cd visual-zettelkasten/backend
python -m venv venv
Activate the virtual environment:
- Windows:
venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
pip install -r requirements.txt
Content of requirements.txt
:
flask
torch
numpy
scikit-learn
# Include any additional dependencies required by llama.cpp and Janus
-
Navigate to the
llama.cpp
Directory:cd models/llama.cpp
-
Clone
llama.cpp
Repository:git clone https://github.com/ggerganov/llama.cpp.git
-
Build the Project:
-
Windows:
mkdir build cd build cmake .. cmake --build . --config Release
-
macOS/Linux:
make
-
Open app.py
in a text editor and update the paths to point to your model files:
# app.py
LLAMA_CPP_PATH = "path/to/llama.cpp"
LLAMA_MODEL_PATH = "path/to/llama2/model.bin"
JANUS_MODEL_PATH = "path/to/janus/model"
Replace the placeholders with the actual paths.
If you haven't already, download and install Obsidian from the official website.
-
Navigate to the Plugin Directory:
cd visual-zettelkasten/obsidian-plugin
-
Install Dependencies:
npm install
-
Build the Plugin:
npm run build
This will generate the necessary plugin files (main.js
, manifest.json
, styles.css
).
-
Locate Obsidian's Plugins Folder:
- Open Obsidian.
- Go to
Settings
>Community Plugins
>Open plugins folder
. - This will open the
.obsidian/plugins
directory in your file explorer.
-
Copy Plugin Files:
- Create a new folder named
visual-zettelkasten
inside the plugins folder. - Copy the following files into this folder:
main.js
manifest.json
styles.css
- Create a new folder named
-
Enable the Plugin:
- In Obsidian, go to
Settings
>Community Plugins
. - Find
Visual Zettelkasten
in the list and enable it.
- In Obsidian, go to
If the backend requires any environment variables (e.g., model configurations), set them accordingly.
In Command Prompt or Terminal (ensure the virtual environment is activated if you created one):
python app.py
- The server should start on
http://localhost:8000
. - Keep this terminal window open while using the plugin.
-
Open Plugin Settings:
- Go to
Settings
>Visual Zettelkasten
.
- Go to
-
Configure Backend URL:
- Custom Backend URL: Set to
http://localhost:8000
. - Use Custom Backend: Ensure this option is enabled.
- Custom Backend URL: Set to
-
Configure Local Models (if applicable):
- Enable Locally Running Models: Enable this option.
- Whisper Model Path: If you are using a local transcription model, provide the path or leave it blank if not used.
- Phi3.5 Vision Model Path: Since we're using Janus, you may update this to reflect Janus's capabilities or leave it as is if not applicable.
- Jina Embeddings Endpoint: If you have an embeddings service running, provide the endpoint, or leave it as default.
-
Additional Settings:
- Generation Parameters: Adjust creativity level, topic relevance, diversity level, and the number of templates as per your preference.
- Predefined Templates: You can add or modify predefined templates here.
- Additional Document Folders: Specify any folders within your Obsidian vault that contain documents you want the plugin to include in its analysis.
-
Start the Backend Server:
- Ensure
app.py
is running:python app.py
- Ensure
-
Open Obsidian:
- Launch Obsidian if it's not already open.
-
Use the Plugin:
- Use the command palette (press
Ctrl+P
orCmd+P
) and typeOpen Visual Zettelkasten
to start using the plugin. - Alternatively, if the plugin adds a ribbon icon, click on it to launch the plugin.
- Use the command palette (press
-
Open Visual Zettelkasten:
- Access the plugin via the command palette or ribbon icon.
-
Select Templates:
- Choose from predefined templates or AI-generated templates.
- You can select multiple templates for comparison or combination.
-
Customize Templates:
- Modify the content of templates as needed.
- Use the Template Customization modal to make changes.
-
Provide Custom Inputs:
- Use the Custom Input modal to add your own text, voice recordings, drawings, or images.
- The plugin will process these inputs to generate more personalized templates.
-
Define Relationships:
- If you selected multiple templates, you can define relationships or preferences between them.
- This influences the recommendation system and future template generation.
-
Create Notes:
- Once satisfied, finalize the templates and create new notes in your vault.
- The notes will include any customizations and inputs you provided.
-
Backend Server Not Running:
- Issue: The plugin cannot communicate with the backend.
- Solution: Ensure that
app.py
is running in the terminal and that the server is listening onhttp://localhost:8000
.
-
Model Files Not Found:
- Issue: The backend cannot locate the Llama 2 or Janus model files.
- Solution: Verify that the model paths in
app.py
are correct and point to the actual locations of the model files.
-
Insufficient System Resources:
- Issue: The models require more RAM or GPU memory than available.
- Solution: Consider using smaller model variants or upgrading your hardware.
-
Plugin Not Appearing in Obsidian:
- Issue: The plugin does not show up in the list of community plugins.
- Solution: Ensure that the plugin files are placed in the correct directory and that
manifest.json
is present.
-
Errors During Plugin Build:
- Issue: Errors occur when running
npm run build
. - Solution: Ensure all dependencies are installed with
npm install
. Check for error messages and install any missing packages.
- Issue: Errors occur when running
-
Dependency Issues:
- Issue: Missing Python packages or incorrect versions.
- Solution: Re-run
pip install -r requirements.txt
and ensure all packages are installed.
You have now set up the Visual Zettelkasten plugin and its backend on your PC. This setup allows you to enhance your note-taking experience in Obsidian with AI-powered template generation and multi-modal inputs, all while ensuring your data remains private and secure.
Remember:
- Keep the backend server running while using the plugin.
- Regularly update the plugin and backend if new versions are released.
- Adjust settings and parameters to fine-tune the plugin to your workflow.
- Obsidian Documentation: https://help.obsidian.md/
- llama.cpp Repository: https://github.com/ggerganov/llama.cpp
- Janus Model Information: Refer to the official Janus documentation or repository.
- Python Virtual Environments: https://docs.python.org/3/tutorial/venv.html
If you encounter any issues not covered in this guide, consider reaching out to the community forums or the plugin's support channels for assistance.
Happy note-taking with Visual Zettelkasten!