Skip to content

Commit 6c2ede8

Browse files
committed
AppAPI 2.0 support
1 parent 122123f commit 6c2ede8

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,42 @@ help:
2424
.PHONY: build-push
2525
build-push:
2626
docker login ghcr.io
27-
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/ai_image_generator_bot:1.0.0 --tag ghcr.io/cloud-py-api/ai_image_generator_bot:latest .
27+
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/ai_image_generator_bot:2.0.0 --tag ghcr.io/cloud-py-api/ai_image_generator_bot:latest .
2828

2929
.PHONY: deploy
3030
deploy:
3131
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister ai_image_generator_bot --silent --force || true
32-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy ai_image_generator_bot docker_dev \
32+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy ai_image_generator_bot \
3333
--info-xml https://raw.githubusercontent.com/cloud-py-api/ai_image_generator_bot/main/appinfo/info.xml
3434

3535
.PHONY: deploy27
3636
deploy27:
3737
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister ai_image_generator_bot --silent --force || true
38-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:deploy ai_image_generator_bot docker_dev \
38+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:deploy ai_image_generator_bot \
3939
--info-xml https://raw.githubusercontent.com/cloud-py-api/ai_image_generator_bot/main/appinfo/info.xml
4040

4141
.PHONY: run
4242
run:
4343
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister ai_image_generator_bot --silent --force || true
44-
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register ai_image_generator_bot docker_dev --force-scopes \
44+
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register ai_image_generator_bot --force-scopes \
4545
--info-xml https://raw.githubusercontent.com/cloud-py-api/ai_image_generator_bot/main/appinfo/info.xml
4646

4747
.PHONY: run27
4848
run27:
4949
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister ai_image_generator_bot --silent --force || true
50-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register ai_image_generator_bot docker_dev --force-scopes \
50+
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register ai_image_generator_bot --force-scopes \
5151
--info-xml https://raw.githubusercontent.com/cloud-py-api/ai_image_generator_bot/main/appinfo/info.xml
5252

5353
.PHONY: register
5454
register:
5555
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister ai_image_generator_bot --silent --force || true
5656
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register ai_image_generator_bot manual_install --json-info \
57-
"{\"appid\":\"ai_image_generator_bot\",\"name\":\"AIImageGeneratorBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"host\":\"host.docker.internal\",\"port\":9080,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\", \"FILES\", \"FILES_SHARING\"],\"optional\":[]},\"protocol\":\"http\",\"system_app\":1}" \
57+
"{\"appid\":\"ai_image_generator_bot\",\"name\":\"AIImageGeneratorBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9080,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\", \"FILES\", \"FILES_SHARING\"],\"optional\":[]},\"system_app\":1}" \
5858
--force-scopes --wait-finish
5959

6060
.PHONY: register27
6161
register27:
6262
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister ai_image_generator_bot --silent --force || true
6363
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register ai_image_generator_bot manual_install --json-info \
64-
"{\"appid\":\"ai_image_generator_bot\",\"name\":\"AIImageGeneratorBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"host\":\"host.docker.internal\",\"port\":9080,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\", \"FILES\", \"FILES_SHARING\"],\"optional\":[]},\"protocol\":\"http\",\"system_app\":1}" \
64+
"{\"appid\":\"ai_image_generator_bot\",\"name\":\"AIImageGeneratorBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9080,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\", \"FILES\", \"FILES_SHARING\"],\"optional\":[]},\"system_app\":1}" \
6565
--force-scopes --wait-finish

appinfo/info.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This is not an example, this is a ready-to-use application, just enable the bot
1919
2020
`@image cinematic portrait of fluffy cat with black eyes`
2121
]]></description>
22-
<version>1.0.1</version>
22+
<version>2.0.0</version>
2323
<licence>MIT</licence>
2424
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
2525
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
@@ -41,7 +41,7 @@ This is not an example, this is a ready-to-use application, just enable the bot
4141
<docker-install>
4242
<registry>ghcr.io</registry>
4343
<image>cloud-py-api/ai_image_generator_bot</image>
44-
<image-tag>1.0.0</image-tag>
44+
<image-tag>2.0.0</image-tag>
4545
</docker-install>
4646
<scopes>
4747
<required>

lib/main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
from nc_py_api import AsyncNextcloudApp, NextcloudApp
1717
from nc_py_api.ex_app import (
1818
LogLvl,
19-
atalk_bot_app,
19+
anc_app,
20+
atalk_bot_msg,
2021
persistent_storage,
2122
run_app,
2223
set_handlers,
@@ -126,7 +127,8 @@ async def stable_diffusion_process_request(message: TalkBotMessage):
126127

127128
@APP.post("/stable_diffusion")
128129
async def stable_diffusion(
129-
message: Annotated[TalkBotMessage, Depends(atalk_bot_app)],
130+
message: Annotated[TalkBotMessage, Depends(atalk_bot_msg)],
131+
_nc: Annotated[AsyncNextcloudApp, Depends(anc_app)],
130132
background_tasks: BackgroundTasks,
131133
):
132134
if message.object_name == "message" and message.actor_id.startswith("users/"):

requirements.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
nc_py_api[app]>=0.7.0
1+
nc_py_api[app]>=0.9.0
22
diffusers>=0.23.1
33
transformers>=4.36.1
44
accelerate
55
huggingface_hub
66
torch
77
torchvision
8-
torchaudio

0 commit comments

Comments
 (0)