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

Function getPrompts

ui/media/js/main.js:1522–1557  ·  view source on GitHub ↗
(prompts)

Source from the content-addressed store, hash-verified

1520}
1521
1522function getPrompts(prompts) {
1523 if (typeof prompts === "undefined") {
1524 prompts = promptField.value
1525 }
1526 if (prompts.trim() === "" && activeTags.length === 0) {
1527 return [""]
1528 }
1529
1530 let promptsToMake = []
1531 if (prompts.trim() !== "") {
1532 prompts = prompts.split("\n")
1533 prompts = prompts.map((prompt) => prompt.trim())
1534 prompts = prompts.filter((prompt) => prompt !== "")
1535
1536 promptsToMake = applyPermuteOperator(prompts)
1537 promptsToMake = applySetOperator(promptsToMake)
1538 }
1539 const newTags = activeTags.filter((tag) => tag.inactive === undefined || tag.inactive === false)
1540 if (newTags.length > 0) {
1541 const promptTags = newTags.map((x) => x.name).join(", ")
1542 if (promptsToMake.length > 0) {
1543 promptsToMake = promptsToMake.map((prompt) => `${prompt}, ${promptTags}`)
1544 } else {
1545 promptsToMake.push(promptTags)
1546 }
1547 }
1548
1549 promptsToMake = applyPermuteOperator(promptsToMake)
1550 promptsToMake = applySetOperator(promptsToMake)
1551
1552 PLUGINS["GET_PROMPTS_HOOK"].forEach((fn) => {
1553 promptsToMake = fn(promptsToMake)
1554 })
1555
1556 return promptsToMake
1557}
1558
1559function getPromptsNumber(prompts) {
1560 if (typeof prompts === "undefined") {

Callers 1

makeImageFunction · 0.85

Calls 4

applyPermuteOperatorFunction · 0.85
applySetOperatorFunction · 0.85
pushMethod · 0.80
fnFunction · 0.70

Tested by

no test coverage detected