MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / importFromCivitai

Function importFromCivitai

ui/plugins/ui/model-tools.plugin.js:711–735  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

709 },
710
711 importFromCivitai() {
712 document.body.style["cursor"] = "progress"
713 fetch("/sha256/lora/" + LoraUI.modelField.value)
714 .then((result) => result.json())
715 .then((json) => fetch("https://civitai.com/api/v1/model-versions/by-hash/" + json.digest))
716 .then((result) => result.json())
717 .then((json) => {
718 document.body.style["cursor"] = "default"
719 if (json == null) {
720 return
721 }
722 if ("trainedWords" in json) {
723 LoraUI.keywordsField.value = json["trainedWords"].join("\n")
724 } else {
725 showToast("No keyword info found.")
726 }
727 if ("modelId" in json) {
728 LoraUI.showCivitaiLink("https://civitai.com/models/" + json.modelId)
729 } else {
730 LoraUI.hideCivitaiLink()
731 }
732
733 LoraUI.saveInfos()
734 })
735 },
736
737 showCivitaiLink(href) {
738 LoraUI.civitaiSection.classList.remove("displayNone")

Callers

nothing calls this directly

Calls 2

showToastFunction · 0.85
jsonMethod · 0.45

Tested by

no test coverage detected