Skip to content

Commit 05c564e

Browse files
authored
Merge pull request #255 from suurt8ll/feat/dev-env-improvements
feat(dev): dev env improvements
2 parents edcc938 + 8887b16 commit 05c564e

7 files changed

Lines changed: 436 additions & 207 deletions

File tree

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
.env
1+
# Ignore all environment files
2+
.env*
3+
# Except the example templates
4+
!.env.example
5+
!.env.*.example
6+
27
.venv/
38
.vscode/
49
**/__pycache__/

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,43 @@ The plugins are organized by type within the `plugins/` directory:
1313
- `gemini_manifold_companion.py`: A companion filter for "Gemini Manifold google_genai" pipe providing enhanced functionality, such as Google Search grounding. See the [Detailed Documentation](docs/plugins/filters/gemini_manifold_companion.md) for more information.
1414
- `system_prompt_injector.py`: Allows changing chat options like system prompt and temperature from the chatbox. It would pair nicely with Prompts feature Open WebUI offers.
1515

16+
## Installation/Updating
17+
18+
### Option 1: Manual (Copy-Paste)
19+
1. Open your Open WebUI instance and navigate to **Admin Panel** -> **Functions** -> **New Function** or click on a single one if you want to update it.
20+
2. Copy the entire content of the desired `.py` file from this repo and paste it into the editor.
21+
3. **CRITICAL:** Ensure the `id` field in the Open WebUI interface matches the `id` defined in the file's frontmatter (docstring). Some logic within these plugins depends on these IDs being exact.
22+
23+
*Example from `gemini_manifold.py`:*
24+
```python
25+
"""
26+
title: Gemini Manifold google_genai
27+
id: gemini_manifold_google_genai
28+
...
29+
"""
30+
```
31+
32+
### Option 2: Automated (One-Time Sync)
33+
Use the included utility script to automatically create/update multiple functions at once via the Open WebUI API.
34+
35+
1. **Clone the repo:** `git clone https://github.com/suurt8ll/open_webui_functions.git`
36+
2. **Configure:** Copy `dev/.env.install.example` to `dev/.env.install`.
37+
- Set `ONE_TIME_RUN=true`.
38+
- Set `API_KEY`, [this doc page](https://docs.openwebui.com/reference/monitoring/#authentication-setup-for-api-key-) explains how to get it.
39+
- List the files you want to install in `FILEPATHS`.
40+
- Set `HOST`, `PORT` etc.
41+
3. **Setup Environment:**
42+
```bash
43+
python3.11 -m venv .venv
44+
source .venv/bin/activate
45+
pip install -r requirements.txt
46+
```
47+
4. **Run Sync:**
48+
```bash
49+
python dev/function_updater.py --env dev/.env.install
50+
```
51+
The script will wait for a connection, sync the functions, and exit.
52+
1653
## Utilities
1754

1855
The `utils/` directory contains shared code and utility modules used by the plugins:

dev/.env.example

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
API_ENDPOINT=http://localhost:8080
1+
# Python version to use for virtual environments (dev.sh)
2+
PYTHON_VERSION=3.11
3+
4+
# Network configuration for the Open WebUI backend
5+
# Protocol can be http or https (defaults to http if omitted)
6+
PROTOCOL=http
7+
HOST=127.0.0.1
8+
PORT=8080
9+
10+
# API key from Open WebUI (Settings -> Account)
211
API_KEY=sk-0000
3-
POLLING_INTERVAL=5
4-
FILEPATHS="../gemini_manifold.py,
5-
../venice_manifold.py,
6-
../gemini_manifold_companion.py,
7-
../system_prompt_injector.py,
8-
../test_and_example_functions/pipe_template.py,"
12+
# How often to poll for changes if file watcher misses something (seconds)
13+
POLLING_INTERVAL=60
14+
15+
# If true, the script will wait for a connection, sync all files once, and then exit.
16+
# Set this to true for automated one-time installations or deployments.
17+
ONE_TIME_RUN=false
18+
19+
# Comma-separated paths to the function files.
20+
# Relative paths are resolved relative to the location of this .env file.
21+
FILEPATHS="../plugins/pipes/gemini_manifold.py,../plugins/filters/gemini_manifold_companion.py"

dev/.env.install.example

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Python version to use for virtual environments (dev.sh)
2+
PYTHON_VERSION=3.11
3+
4+
# Network configuration for the Open WebUI backend
5+
# Protocol can be http or https (defaults to http if omitted)
6+
PROTOCOL=http
7+
HOST=127.0.0.1
8+
PORT=8080
9+
10+
# API key from Open WebUI (Settings -> Account)
11+
API_KEY=sk-0000
12+
13+
# How often to poll for changes if file watcher misses something (seconds)
14+
# (Ignored when ONE_TIME_RUN is true)
15+
POLLING_INTERVAL=60
16+
17+
# Set to true for automated one-time installations or deployments.
18+
# The script will sync all files once and then exit.
19+
ONE_TIME_RUN=true
20+
21+
# Comma-separated paths to the function files.
22+
# Relative paths are resolved relative to the location of this .env file.
23+
FILEPATHS="../plugins/pipes/gemini_manifold.py,
24+
../plugins/filters/gemini_manifold_companion.py,
25+
../plugins/filters/gemini_map_grounding_toggle.py,
26+
../plugins/filters/gemini_paid_api.py,
27+
../plugins/filters/gemini_reasoning_toggle.py,
28+
../plugins/filters/gemini_url_context_toggle.py,
29+
../plugins/filters/gemini_vertex_ai_toggle.py"

0 commit comments

Comments
 (0)