Files
BobRandomNumber-ComfyUI-Bas…/README.md
T
2025-11-30 02:54:04 -05:00

77 lines
4.7 KiB
Markdown

# ComfyUI-BasicOllama
A simplified node that provides access to Ollama. It allows you to send prompts, system prompts, and images to your Ollama instance and receive text-based responses.
## ⚠️ 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/).
![](https://github.com/BobRandomNumber/ComfyUI-BasicOllama/blob/main/BasicOllama.png)
## 🚀 Features
* **Direct Ollama Integration:** Seamlessly connect to your local Ollama instance.
* **System Prompt Support:** Utilize the `system` parameter in the Ollama API for more control over model behavior.
* **Dynamic Prompt Templates:** Load system prompts from `.txt` files in the `prompts` directory.
* **Text and Image Support:** Send both text prompts and images to multimodal Ollama models.
* **Multiple Image Inputs:** Input up to five images for analysis.
* **Easy Configuration:** Quickly set up your Ollama URL via a `config.json` file.
## 📦 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
```
2. **Install Dependencies:**
Navigate to the newly cloned directory and install the required packages:
```bash
cd ComfyUI-BasicOllama
pip install -r requirements.txt
```
3. **Restart ComfyUI:**
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.
### Inputs
| Name | Type | Description |
| ---------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `prompt` | `STRING` | The main text prompt to send to the Ollama model. |
| `input_type` | `COMBO` (`text`, `image`) | The type of input to send. `text` for text-only prompts, and `image` to include images. |
| `ollama_model` | `COMBO` | A list of available Ollama models on your local instance. |
| `keep_alive` | `INT` | The duration (in minutes) that the Ollama model should remain loaded in memory after the request is complete. |
| `saved_sys_prompt` | `COMBO` | A dropdown list of saved system prompts from the `.txt` files in the `prompts` directory. This is used as the system prompt by default. |
| `use_sys_prompt_below` | `BOOLEAN` | If checked (`True`), the `system_prompt` text box below will be used instead of the dropdown selection. If unchecked (`False`), the `saved_sys_prompt` dropdown is used. |
| `system_prompt` | `STRING` | A multiline text box for a custom, one-off system prompt. This is only active when `use_sys_prompt_below` is checked. |
| `image1` - `image5` | `IMAGE` (Optional) | Up to five optional image inputs for multimodal models. |
### Outputs
| Name | Type | Description |
| ------ | -------- | ----------------------------------------- |
| `text` | `STRING` | The text-based response from the Ollama model. |
## ⚙️ 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/ComfyUI-OllamaGemini) which served as the foundation for this.
This project is licensed under the [MIT License](LICENSE).