Files
BobRandomNumber-ComfyUI-Bas…/README.md
T
2026-03-10 16:37:31 -04:00

86 lines
5.5 KiB
Markdown

# ComfyUI-BasicOllama
A simplified node that provides access to Ollama. It allows you to send prompts and images to your Ollama instance and receive text-based responses with support for reasoning/thinking and system prompts.
## ⚠️ Requirements
**You must have Ollama installed and running on your local machine for this node to function.** You can download it from [https://ollama.com/](https://ollama.com/).
## 🚀 Features
* **Zero Startup Impact:** This node loads asynchronously and will not slow down your ComfyUI browser loading time.
* **Direct Ollama Integration:** Seamlessly connect to your local Ollama instance.
* **Automatic Image Detection:** The node automatically detects if an image is connected and sends it to Ollama for multimodal analysis.
* **Reasoning Support:** Toggle "think" mode to capture reasoning traces.
* **System Prompt Support:** Utilize the `system` parameter in the Ollama API for more control over model behavior.
* **Dynamic Prompt Templates:** Easily load your own system prompts from `.txt` files in the `prompts` directory.
* **Dynamic Image Inputs:** Start with one image input, and automatically add more as you connect them.
* **Easy Configuration:** Quickly set up your Ollama URL via a `config.json` file.
*
![](https://github.com/BobRandomNumber/ComfyUI-BasicOllama/blob/main/BasicOllama.png)
## 📦 Installation
1. **Clone the Repository:**
Navigate to your `ComfyUI/custom_nodes` directory and clone this repository:
 
```bash
git clone https://github.com/BobRandomNumber/ComfyUI-BasicOllama.git
```
2. **Restart your ComfyUI instance to load the new custom node.**
## ✨ Usage
The `BasicOllama` node can be found under the `Ollama` category in the ComfyUI menu. Connect optional image/s to the `image` inputs to have it automatically included in your prompt if desired.
### Inputs
| Name | Type | Description |
| ---------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `prompt` | `STRING` | The main text prompt to send to the Ollama model. |
| `ollama_model` | `COMBO` | Asynchronously populated list of available Ollama models. Use the **Refresh** button to update the list from your Ollama instance. |
| `generation_seed` | `INT` | Seed for randomness. Includes control for incrementing or fixing the seed after generation. |
| `enable_think` | `BOOLEAN` | If enabled, requests and captures the reasoning/thinking trace for supported models. |
| `saved_sys_prompt` | `COMBO` | A dropdown list of saved system prompts from the `.txt` files in the `prompts` directory. |
| `use_sys_prompt_below` | `BOOLEAN` | If checked (`True`), the `system_prompt` text box below will be used instead of the dropdown selection. |
| `system_prompt` | `STRING` | A multiline text box for a custom, one-off system prompt. |
| `image` | `IMAGE` | Optional image inputs for multimodal models. Connecting an image automatically creates a new input slot. |
### Outputs
| Name | Type | Description |
| ---------- | -------- | --------------------------------------------------------------------------- |
| `text` | `STRING` | The main text-based response from the Ollama model. |
| `thinking` | `STRING` | The reasoning trace generated by the model (if `enable_think` is active). |
## ✍️ Adding Custom System Prompts
You can easily add your own reusable system prompts to the `saved_sys_prompt` dropdown menu.
1. Navigate to the `ComfyUI-BasicOllama/prompts` directory.
2. Create a new text file (e.g., `my_prompt.txt`).
3. Write your system prompt inside this file.
4. Save the file and refresh your ComfyUI browser window.
The name of your file (without the `.txt` extension) will now appear as an option in the `saved_sys_prompt` dropdown.
## ⚙️ Configuration
By default, the `BasicOllama` node will attempt to connect to your Ollama instance at `http://localhost:11434`.
If your Ollama instance is running on a different URL/port, you can change it by editing the `config.json` file located in the `ComfyUI-BasicOllama` directory:
```json
{
"OLLAMA_URL": "http://your-ollama-url:11434"
}
```
## 🙏 Attribution
A special thank you to [@al-swaiti](https://github.com/al-swaiti) for creating the original [ComfyUI-OllamaGemini](https://github.com/al-swaiti/ComllamaGemini) whose Ollama node served as the foundation and inspiration for this.
This project is licensed under the [MIT License](LICENSE).