-
Notifications
You must be signed in to change notification settings - Fork 16
feat(TaskProcessing): Allow defining custom task types #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: provokateurin <kate@provokateurin.de>
andrey18106
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't test, but LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptually, I would say the new task type should be independent from the provider. E.g. one app could register multiple providers for the same custom task type. Also, one app could want to register only a task type for a task to be provided by other apps.
Will this implementation be enough at this stage? |
import contextlib
from os import environ
from pathlib import Path
import nc_py_api
environ["APP_ID"] = "nc_py_api"
environ["APP_VERSION"] = "1.0.0"
environ["APP_SECRET"] = "12345"
if __name__ == "__main__":
nc = nc_py_api.NextcloudApp(nextcloud_url="http://nextcloud.local")
nc.set_user("admin")
nc.providers.task_processing.register(
"visionatrix",
"SDXL Lighting",
"visionatrix:sdxl_lighting",
{
"id": "visionatrix:sdxl_lighting",
"name": "SDXL Lighting",
"description": "Fast Image Generation",
"input_shape": {
"prompt": {
"name": "prompt",
"description": "Prompt",
"type": 1, # Text
}
},
"output_shape": {
"image": {
"name": "image",
"description": "Image",
"type": 2, # Image
}
}
}
)
s1 = nc.ocs(
"POST",
"/ocs/v2.php/taskprocessing/schedule",
json={
"input": {"prompt": "Star"},
"type": "visionatrix:sdxl_lighting",
"appId": "nc_py_api",
}
)
print(s1)
my_task = nc.providers.task_processing.next_task(["visionatrix"], ["visionatrix:sdxl_lighting"])
print(my_task)Description of idea(that is in this PR): if one ExApp provides multiple custom_task_types for each custom task_type it calls "Register Provider" (as anyway "Optional Shapes" are binded to Provider struct) I am still in process of reviewing and learning how to use our new API.. |
bigcat88
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is fine for me, but I can't make it work with the Assistant app.
No further actions is needed(until someone want to help find to which repo the problem belongs), current idea is to take a much deeper look at this at Monday/Tuesday and find the reason.
bigcat88
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it was a bug in the Assistant app - it was fixed 20 minutes ago thanks to Julien for fast reacting.
Counter part for nextcloud/app_api#324 --------- Signed-off-by: provokateurin <kate@provokateurin.de>
I'm uncertain on this. think the goal of ExApps was to have stable APIs. Having this one in a half baked state does not contribute to that goal. On the other hand it may be possible to extend this implementation in the future. But then I don't see when we would do that. IMO it would be good to have this implemented properly, but I defer to @julien-nc |
No description provided.