Skip to content

Commit 1c12275

Browse files
committed
bumped Visionatrix to the latest version
Signed-off-by: bigcat88 <[email protected]>
1 parent 93e835d commit 1c12275

File tree

8 files changed

+82
-63
lines changed

8 files changed

+82
-63
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.3.0 - 2025-03-xx]
6+
7+
This release contains breaking changes, first you need to uninstall old app **with its data removal** and after that install this version.
8+
9+
## Added
10+
11+
- Many flows were updated, some new flows were added.
12+
- **Optional** remote token decoding using HuggingFace for some flows were added.
13+
- `Surprise Me` - new feature to use LLM to create a random prompt.
14+
- Many useful small UI additions(`Export flow`, `Editing flow` actions).
15+
- Added support for `HaRP` deploy type - successor of `DSP`(Nextcloud 32+ only).
16+
17+
## Changes
18+
19+
- Visionatrix service has been updated from version `1.11.1` to `2.0.1`.
20+
- Now Visionatrix **correctly stores all models and configs** in the configured ExApp storage and no more breaking changes expected.
21+
22+
## Fixes
23+
24+
- Fixed broken flows **Mad Scientist** and **PhotoStickers 2**.
25+
526
## [1.2.1 - 2025-02-23]
627

728
The Visionatrix service has been updated from version `1.11.0` to `1.11.1`.

Dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ ARG BUILD_TYPE
66
ENV VIX_HOST="127.0.0.1"
77
ENV VIX_PORT=8288
88
ENV USER_BACKENDS="vix_db;nextcloud"
9-
ENV MODELS_DIR="/nc_app_visionatrix_data/vix_models"
10-
ENV TASKS_FILES_DIR="/nc_app_visionatrix_data/vix_tasks_files"
9+
ENV BASE_DATA_DIR="/nc_app_visionatrix_data"
1110
ENV VIX_SERVER_FULL_MODELS="1"
1211

1312
RUN apt-get update && apt-get install -y git \
@@ -38,7 +37,7 @@ RUN cd /Visionatrix && \
3837
echo "Installing PyTorch for ARM64"; \
3938
venv/bin/python -m pip install torch==2.6.0 torchvision torchaudio; \
4039
elif [ "$BUILD_TYPE" = "rocm" ]; then \
41-
venv/bin/python -m pip install torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1; \
40+
venv/bin/python -m pip install torch==2.6.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2.4; \
4241
elif [ "$BUILD_TYPE" = "cpu" ]; then \
4342
venv/bin/python -m pip install torch==2.6.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; \
4443
else \
@@ -49,11 +48,7 @@ RUN cd /Visionatrix && \
4948
RUN cd /Visionatrix && \
5049
venv/bin/python -m pip install "psycopg[binary]" greenlet && \
5150
venv/bin/python -m pip install . && \
52-
rm -rf ~/.cache/pip
53-
54-
RUN cd /Visionatrix && \
55-
venv/bin/python -m visionatrix install && \
56-
AUTO_INIT_CONFIG_MODELS_DIR=$MODELS_DIR venv/bin/python scripts/easy_install.py && \
51+
venv/bin/python -m visionatrix install && \
5752
rm visionatrix.db && \
5853
rm -rf ~/.cache/pip
5954

@@ -80,7 +75,6 @@ RUN cd /Visionatrix && \
8075
# Setup ExApp dependencies
8176
COPY ex_app_scripts/init_pgsql.sh /ex_app_scripts/init_pgsql.sh
8277
COPY ex_app_scripts/entrypoint.sh /ex_app_scripts/entrypoint.sh
83-
COPY ex_app_scripts/run_visionatrix.sh /ex_app_scripts/run_visionatrix.sh
8478

8579
RUN chmod +x /ex_app_scripts/*.sh
8680

@@ -99,7 +93,6 @@ WORKDIR /Visionatrix
9993

10094
CMD ["/bin/sh", \
10195
"/ex_app_scripts/entrypoint.sh", \
102-
"/ex_app/lib/main.py", \
103-
"/ex_app_scripts/run_visionatrix.sh"]
96+
"/ex_app/lib/main.py"]
10497

10598
HEALTHCHECK --interval=5s --timeout=2s --retries=300 CMD /healthcheck.sh

appinfo/info.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Share your custom workflows, big or small. For guidance on creating AI workflows
3434
3535
📚 For more details, visit the [repository](https://github.com/cloud-py-api/visionatrix) readme.
3636
]]></description>
37-
<version>1.2.1</version>
37+
<version>1.3.0</version>
3838
<licence>MIT</licence>
3939
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
4040
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
@@ -55,7 +55,7 @@ Share your custom workflows, big or small. For guidance on creating AI workflows
5555
<docker-install>
5656
<registry>ghcr.io</registry>
5757
<image>cloud-py-api/visionatrix</image>
58-
<image-tag>1.11.1</image-tag>
58+
<image-tag>2.0.1.dev0</image-tag>
5959
</docker-install>
6060
<routes>
6161
<route>

ex_app/lib/main.py

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from nc_py_api.ex_app import (
2323
AppAPIAuthMiddleware,
2424
nc_app,
25-
persistent_storage,
2625
run_app,
2726
setup_nextcloud_logging,
2827
)
@@ -43,8 +42,12 @@
4342
# os.environ["APP_PORT"] = "24000"
4443
# os.environ["APP_ID"] = "visionatrix"
4544
# os.environ["APP_SECRET"] = "12345" # noqa
45+
# os.environ["NC_DEV_SKIP_RUN"] = "1"
4646
# ---------Enf of configuration values for manual deploy---------
4747

48+
SUPERUSER_NAME = "visionatrix_admin"
49+
SUPERUSER_PASSWORD = "".join(random.choice(string.ascii_letters + string.digits) for i in range(10)) # noqa
50+
4851
SERVICE_URL = os.environ.get("VISIONATRIX_URL", "http://127.0.0.1:8288")
4952

5053
logging.basicConfig(
@@ -60,10 +63,7 @@
6063
current_translator.set(translation(os.getenv("APP_ID"), LOCALE_DIR, languages=["en"], fallback=True))
6164

6265
ENABLED_FLAG = NextcloudApp().enabled_state
63-
SUPERUSER_PASSWORD_PATH = Path(persistent_storage()).joinpath("superuser.txt")
64-
SUPERUSER_NAME = "visionatrix_admin"
65-
SUPERUSER_PASSWORD: str = ""
66-
print(str(SUPERUSER_PASSWORD_PATH), flush=True) # for development only
66+
6767
INSTALLED_FLOWS = []
6868

6969
PROJECT_ROOT_FOLDER = Path(__file__).parent.parent.parent
@@ -90,9 +90,9 @@ async def dispatch(self, request: Request, call_next):
9090
async def lifespan(_app: FastAPI):
9191
global SUPERUSER_PASSWORD
9292

93+
SUPERUSER_PASSWORD = os.environ["ADMIN_OVERRIDE"].split(":")[1]
9394
print(_("Visionatrix"), flush=True)
9495
setup_nextcloud_logging("visionatrix", logging_level=logging.WARNING)
95-
SUPERUSER_PASSWORD = Path(SUPERUSER_PASSWORD_PATH).read_text()
9696
_t1 = asyncio.create_task(start_nextcloud_provider_registration()) # noqa
9797
_t2 = asyncio.create_task(start_nextcloud_tasks_polling()) # noqa
9898
yield
@@ -285,16 +285,20 @@ def poll_tasks(nc: NextcloudApp, basic_auth: httpx.BasicAuth, webhook_url: str,
285285
if not reply_from_nc:
286286
return False
287287
task_info = reply_from_nc["task"]
288+
data = {
289+
"prompt": task_info["input"]["input"],
290+
"batch_size": min(task_info["input"]["numberOfImages"], 4),
291+
"webhook_url": webhook_url + f"/{task_info['id']}",
292+
"webhook_headers": webhook_headers,
293+
}
294+
flow_name = reply_from_nc["provider"]["name"].removeprefix("v_")
295+
if flow_name in ("flux1_dev", "flux1_schnell"):
296+
data["diffusion_precision"] = "fp8_e4m3fn"
288297
with httpx.Client(base_url=f"{SERVICE_URL}/vapi") as client:
289298
vix_task = client.put(
290-
url=f"/tasks/create/{reply_from_nc['provider']['name'].removeprefix('v_')}",
299+
url=f"/tasks/create/{flow_name}",
291300
auth=basic_auth,
292-
data={
293-
"prompt": task_info["input"]["input"],
294-
"batch_size": min(task_info["input"]["numberOfImages"], 4),
295-
"webhook_url": webhook_url + f"/{task_info['id']}",
296-
"webhook_headers": webhook_headers,
297-
},
301+
data=data,
298302
)
299303
LOGGER.debug("task passed to visionatrix, return code: %s", vix_task.status_code)
300304
return True
@@ -349,36 +353,48 @@ async def start_nextcloud_provider_registration():
349353
await asyncio.to_thread(background_provider_registration)
350354

351355

352-
def generate_random_string(length=10):
353-
letters = string.ascii_letters + string.digits # You can include other characters if needed
354-
return "".join(random.choice(letters) for i in range(length)) # noqa
355-
356-
357-
def venv_run(command: str) -> None:
358-
command = f". /Visionatrix/venv/bin/activate && {command}"
359-
try:
360-
print(f"executing(pwf={os.getcwd()}): {command}", flush=True)
361-
subprocess.check_call(command, shell=True)
362-
except subprocess.CalledProcessError as e:
363-
print("An error occurred while executing command in venv:", str(e), flush=True)
364-
raise
365-
356+
def start_visionatrix() -> None:
357+
if os.environ.get("NC_DEV_SKIP_RUN") != "1":
358+
visionatrix_python = "/Visionatrix/venv/bin/python"
359+
if os.environ.get("DISABLE_WORKER") != "1":
360+
# Run server in background and redirect output to server.log
361+
server_log = open("server.log", "wb")
362+
subprocess.Popen(
363+
[visionatrix_python, "-m", "visionatrix", "run", "--mode=SERVER"],
364+
stdout=server_log,
365+
stderr=subprocess.STDOUT,
366+
)
367+
print("[DEBUG]: Launched Visionatrix server in background", flush=True)
368+
# Wait a bit to let the server start up
369+
sleep(15)
370+
# Run worker in background and redirect output to worker.log
371+
worker_log = open("worker.log", "wb")
372+
subprocess.Popen(
373+
[visionatrix_python, "-m", "visionatrix", "run", "--mode=WORKER", "--disable-smart-memory"],
374+
stdout=worker_log,
375+
stderr=subprocess.STDOUT,
376+
)
377+
print("[DEBUG]: Launched Visionatrix worker in background", flush=True)
378+
else:
379+
# Only run server when worker is disabled
380+
server_log = open("server.log", "wb")
381+
subprocess.Popen(
382+
[visionatrix_python, "-m", "visionatrix", "run", "--mode=SERVER"],
383+
stdout=server_log,
384+
stderr=subprocess.STDOUT,
385+
)
386+
print("[DEBUG]: Launched Visionatrix server (worker disabled)", flush=True)
366387

367-
def initialize_visionatrix() -> None:
368388
while True: # Let's wait until Visionatrix opens the port.
369389
with contextlib.suppress(httpx.ReadError, httpx.ConnectError, httpx.RemoteProtocolError):
370390
r = httpx.get(SERVICE_URL)
371391
if r.status_code in (200, 204, 401, 403):
372392
break
373393
sleep(5)
374-
if not SUPERUSER_PASSWORD_PATH.exists():
375-
password = generate_random_string()
376-
# password = "12345" # uncomment this line and comment next for the developing with local Visionatrix version.
377-
venv_run(f"python3 -m visionatrix create-user --name {SUPERUSER_NAME} --password {password}")
378-
Path(SUPERUSER_PASSWORD_PATH).write_text(password)
379394

380395

381396
if __name__ == "__main__":
382-
initialize_visionatrix()
397+
os.environ["ADMIN_OVERRIDE"] = f"{SUPERUSER_NAME}:{SUPERUSER_PASSWORD}"
398+
start_visionatrix()
383399
os.chdir(Path(__file__).parent)
384400
run_app("main:APP", log_level="trace")

ex_app/lib/supported_flows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"juggernaut_lite",
44
"playground_2_5_aesthetic",
55
"stable_cascade",
6-
"flux1_dev_8bit",
7-
"flux1_schnell_8bit",
6+
"flux1_dev",
7+
"flux1_schnell",
88
"hunyuan_dit",
99
]

ex_app_scripts/run_visionatrix.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ preview = true
66
[tool.ruff]
77
line-length = 120
88
target-version = "py310"
9-
select = ["A", "B", "C", "E", "F", "G", "I", "S", "SIM", "PIE", "Q", "RET", "RUF", "UP" , "W"]
10-
extend-ignore = ["I001", "RUF100", "D400", "D415", "S602"]
9+
lint.select = ["A", "B", "C", "E", "F", "G", "I", "S", "SIM", "PIE", "Q", "RET", "RUF", "UP" , "W"]
10+
lint.extend-ignore = ["I001", "RUF100", "D400", "D415", "S602", "S603", "SIM115"]
1111

1212
[tool.isort]
1313
profile = "black"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
nc-py-api[app]>=0.16.0
1+
nc-py-api[app]>=0.19.1
22
anyio==4.6.2

0 commit comments

Comments
 (0)