Skip to content
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

poc of use js front end to get loras list #156

Merged
merged 3 commits into from
Sep 28, 2024

Conversation

doombeaker
Copy link
Collaborator

No description provided.

const shareid_widget = this.widgets.find(widget => widget.name === "share_id");

if (shareid_widget) {
shareid_widget.callback = onTextChange;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前端的主要作用,是通过设置 shareid 那个文本框的回调,监控文本改变事件。

然后在文本改变的事件里,像后端发请求,得到 loras list

showcase.py Outdated

share_id = data.get("share_id")
print(f"use {share_id} to get the loras_list...")
loras_list = ["flux/lora1.safetensors", "flux/lora2.safetensors"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 loras_list 应该来自网络请求。 loras_list 建议放上一个默认的美甲模型,使得 loras_list 的长度一定是 >=1 的,这样前端的逻辑就完全不用改了

showcase.py Outdated
@@ -119,3 +119,23 @@ async def get_file_content(request):
status=500,
content_type="application/json",
)


@PromptServer.instance.routes.post("/bizyair/shareloras")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段添加后端的代码,是临时放在这的。请根据需要挪到合适的地方。

@ccssu ccssu merged commit 2320d9f into add_shared_lora_loader_node Sep 28, 2024
1 check passed
@ccssu ccssu deleted the support_get_loras_in_js_end branch September 28, 2024 14:11
ccssu added a commit that referenced this pull request Sep 29, 2024
* Add SharedLoraLoader node

* poc of use js front end to get loras list (#156)

* poc

* refine

* refine

---------

Co-authored-by: FengWen <[email protected]>

* fix SharedLoraLoader

* Remove unused comments

---------

Co-authored-by: Yao Chi <[email protected]>
doombeaker added a commit that referenced this pull request Sep 29, 2024
* share model

* fix

* Add SharedLoraLoader node (#154)

* Add SharedLoraLoader node

* poc of use js front end to get loras list (#156)

* poc

* refine

* refine

---------

Co-authored-by: FengWen <[email protected]>

* fix SharedLoraLoader

* Remove unused comments

---------

Co-authored-by: Yao Chi <[email protected]>

* refine message and add docs

---------

Co-authored-by: dantegarden <[email protected]>
Co-authored-by: FengWen <[email protected]>
Co-authored-by: Yao Chi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants