|
1383 | 1383 | </div> |
1384 | 1384 | </section> |
1385 | 1385 |
|
| 1386 | + <section id="subjectInputSection" class="md-section md-stack-md md-hidden"> |
| 1387 | + <div class="md-form-grid md-form-grid-2"> |
| 1388 | + <lht-text-field-help |
| 1389 | + field-id="subjectInput" |
| 1390 | + label="subject" |
| 1391 | + required |
| 1392 | + placeholder="例: a small fox" |
| 1393 | + help-text="プロンプト内の [subject] に差し込む対象を入力します。英語でも日本語でも構いません。"> |
| 1394 | + </lht-text-field-help> |
| 1395 | + </div> |
| 1396 | + </section> |
| 1397 | + |
1386 | 1398 | <section id="promptOutputSection" class="md-section md-stack-md md-hidden"> |
1387 | 1399 | <div class="md-output-header"> |
1388 | 1400 | <p id="promptOutputTitle" class="md-output-title">生成結果</p> |
|
4156 | 4168 | ちなみに、この楽譜編集アプリの頑張りポイントは、MusicXML を極力壊さずに編集するという点です。DOMツリーまま おそるおそる内容を変更するという編集仕草をチャッピー (ChatGPT)に徹底的に頑張って作ってもらいました。 |
4157 | 4169 | \`\`\`` |
4158 | 4170 | }, |
| 4171 | + { |
| 4172 | + id: "washi-collage-whisper-request", |
| 4173 | + label: "852: 和紙切絵作品", |
| 4174 | + keywords: ["washi collage whisper", "washi collage", "torn paper collage", "paper collage", "kozo paper", "handmade paper", "cute illustration", "image prompt", "illustration prompt", "和紙", "和紙コラージュ", "ちぎり絵", "手漉き和紙", "楮紙", "かわいいイラスト", "画像生成", "画像プロンプト", "いらすと", "わし", "ちぎりえ", "てすきわし"], |
| 4175 | + requiresCommitId: false, |
| 4176 | + requiresSubject: true, |
| 4177 | + buildBody: (_commitId, subject) => { |
| 4178 | + const normalizedSubject = String(subject || "").trim(); |
| 4179 | + if (!normalizedSubject) { |
| 4180 | + return ""; |
| 4181 | + } |
| 4182 | + return `# Washi Collage Whisper v20250501a |
| 4183 | + |
| 4184 | +A simplified cute illustration of ${normalizedSubject}, created by assembling a minimal number of large torn pieces of rich, muted pastel-colored handmade hand-scooped kozo paper (traditional Japanese mulberry paper). Each piece is separated by bold, rough torn edges with thick, visible, randomly oriented white fibers. The edges are soft, fuzzy, and deeply frayed, showing natural irregularities. Fibers vary in thickness-from very fine to slightly coarse-and in density and direction, creating an organic, handcrafted feel; some areas display extra-frayed, protruding fibers. Fiber color subtly shifts from pure white to off-white and warm beige. |
| 4185 | +The paper pieces are tinted in deep, smoky pastel tones-darker and thicker than ordinary pastels-avoiding vivid hues yet holding enough chroma to stay vibrant and prevent washed-out effects against the translucent handmade paper. |
| 4186 | +The overall texture is soft and fibrous, with bleeding fiber patterns radiating irregularly from the torn edges. Rendered in a flat 2-D style inspired by traditional Japanese torn-paper collage art, it features expansive colour fields, natural irregular edges, a warm and friendly mood, a simple unobtrusive background, and absolutely no strong shadows or dramatic lighting.`; |
| 4187 | + } |
| 4188 | + }, |
4159 | 4189 | { |
4160 | 4190 | id: "chat-partner-mikuku-request", |
4161 | 4191 | label: "801: 会話相手: みくく", |
|
6666 | 6696 | const promptSearch = document.getElementById("promptSearch"); |
6667 | 6697 | const promptCandidateArea = document.getElementById("promptCandidateArea"); |
6668 | 6698 | const commitInputSection = document.getElementById("commitInputSection"); |
| 6699 | + const subjectInputSection = document.getElementById("subjectInputSection"); |
6669 | 6700 | const promptOutputSection = document.getElementById("promptOutputSection"); |
6670 | 6701 | const promptOutputTitle = document.getElementById("promptOutputTitle"); |
6671 | 6702 | const promptOutputHelp = document.getElementById("promptOutputHelp"); |
6672 | 6703 | const commitIdInput = document.getElementById("commitId"); |
| 6704 | + const subjectInput = document.getElementById("subjectInput"); |
6673 | 6705 | const includeLabelPrefix = document.getElementById("includeLabelPrefix"); |
6674 | 6706 | const promptOutput = document.getElementById("promptOutput"); |
6675 | | - if (!promptSearch || !commitIdInput || !includeLabelPrefix || !promptOutput || !promptCandidateArea || !commitInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) { |
| 6707 | + if (!promptSearch || !commitIdInput || !subjectInput || !includeLabelPrefix || !promptOutput || !promptCandidateArea || !commitInputSection || !subjectInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) { |
6676 | 6708 | return; |
6677 | 6709 | } |
6678 | 6710 | function loadSeriesVisibilitySettings() { |
|
6736 | 6768 | } |
6737 | 6769 | applyLatinInputHints(promptSearch, "search"); |
6738 | 6770 | applyLatinInputHints(commitIdInput, "done"); |
| 6771 | + const MAX_EMBED_INPUT_LENGTH = 1024; |
| 6772 | + function sanitizePromptVariableInput(value) { |
| 6773 | + const normalizedWhitespace = String(value || "") |
| 6774 | + .replace(/[\u0000-\u001F\u007F-\u009F]/g, " ") |
| 6775 | + .replace(/[\u200B-\u200D\u2060\uFEFF]/g, " "); |
| 6776 | + const trimmedValue = normalizedWhitespace.trim(); |
| 6777 | + if (!trimmedValue) { |
| 6778 | + return ""; |
| 6779 | + } |
| 6780 | + const truncatedValue = trimmedValue.slice(0, MAX_EMBED_INPUT_LENGTH); |
| 6781 | + const normalizedQuotes = truncatedValue.replace(/`/g, "'"); |
| 6782 | + return `\`${normalizedQuotes}\``; |
| 6783 | + } |
| 6784 | + function syncInputSections(selectedDefinition) { |
| 6785 | + if (selectedDefinition === null || selectedDefinition === void 0 ? void 0 : selectedDefinition.requiresCommitId) { |
| 6786 | + commitInputSection.classList.remove("md-hidden"); |
| 6787 | + } |
| 6788 | + else { |
| 6789 | + commitInputSection.classList.add("md-hidden"); |
| 6790 | + } |
| 6791 | + if (selectedDefinition === null || selectedDefinition === void 0 ? void 0 : selectedDefinition.requiresSubject) { |
| 6792 | + subjectInputSection.classList.remove("md-hidden"); |
| 6793 | + } |
| 6794 | + else { |
| 6795 | + subjectInputSection.classList.add("md-hidden"); |
| 6796 | + } |
| 6797 | + } |
6739 | 6798 | let selectedPrompt = ""; |
6740 | 6799 | let lastSearchQuery = ""; |
6741 | 6800 | const kanaToRomajiMap = new Map([ |
|
7109 | 7168 | promptCandidateArea.innerHTML = ""; |
7110 | 7169 | if (queryChanged) { |
7111 | 7170 | selectedPrompt = ""; |
7112 | | - commitInputSection.classList.add("md-hidden"); |
| 7171 | + syncInputSections(null); |
7113 | 7172 | promptOutputSection.classList.add("md-hidden"); |
7114 | 7173 | commitIdInput.value = ""; |
| 7174 | + subjectInput.value = ""; |
7115 | 7175 | promptOutput.textContent = ""; |
7116 | 7176 | } |
7117 | 7177 | const { matchedDefinitions, prioritizedSingleDefinition } = searchPromptDefinitions(query, promptSearchIndexes, promptSearchIndexById); |
|
7141 | 7201 | if (prioritizedSingleDefinition && selectedPrompt === prioritizedSingleDefinition.id) { |
7142 | 7202 | const selectedDefinition = prioritizedSingleDefinition; |
7143 | 7203 | if (selectedDefinition.requiresCommitId) { |
7144 | | - commitInputSection.classList.remove("md-hidden"); |
| 7204 | + syncInputSections(selectedDefinition); |
| 7205 | + } |
| 7206 | + else if (selectedDefinition.requiresSubject) { |
| 7207 | + syncInputSections(selectedDefinition); |
7145 | 7208 | } |
7146 | 7209 | else { |
7147 | | - commitInputSection.classList.add("md-hidden"); |
| 7210 | + syncInputSections(selectedDefinition); |
7148 | 7211 | } |
7149 | 7212 | revealOutputSection({ |
7150 | 7213 | scrollIntoView: queryChanged && query.length > 0 |
|
7160 | 7223 | button.classList.add("is-active"); |
7161 | 7224 | revealOutputSection({ scrollIntoView: true }); |
7162 | 7225 | const selectedDefinition = visiblePromptDefinitions.find((definition) => definition.id === id); |
| 7226 | + syncInputSections(selectedDefinition || null); |
7163 | 7227 | if (selectedDefinition === null || selectedDefinition === void 0 ? void 0 : selectedDefinition.requiresCommitId) { |
7164 | | - commitInputSection.classList.remove("md-hidden"); |
7165 | 7228 | commitIdInput.focus(); |
7166 | 7229 | } |
7167 | | - else { |
7168 | | - commitInputSection.classList.add("md-hidden"); |
| 7230 | + else if (selectedDefinition === null || selectedDefinition === void 0 ? void 0 : selectedDefinition.requiresSubject) { |
| 7231 | + subjectInput.focus(); |
7169 | 7232 | } |
7170 | 7233 | updateOutput(); |
7171 | | - if ((options === null || options === void 0 ? void 0 : options.autoCopy) && selectedDefinition && !selectedDefinition.requiresCommitId) { |
| 7234 | + if ((options === null || options === void 0 ? void 0 : options.autoCopy) && selectedDefinition && !selectedDefinition.requiresCommitId && !selectedDefinition.requiresSubject) { |
7172 | 7235 | await copyText(promptOutput.textContent || ""); |
7173 | 7236 | } |
7174 | 7237 | } |
|
7178 | 7241 | return ""; |
7179 | 7242 | } |
7180 | 7243 | const label = selectedDefinition ? selectedDefinition.label : ""; |
7181 | | - const commitId = (commitIdInput.value || "").trim(); |
7182 | | - const body = selectedDefinition ? selectedDefinition.buildBody(commitId) : ""; |
| 7244 | + const commitId = sanitizePromptVariableInput(commitIdInput.value || ""); |
| 7245 | + const subject = sanitizePromptVariableInput(subjectInput.value || ""); |
| 7246 | + const body = selectedDefinition ? selectedDefinition.buildBody(commitId, subject) : ""; |
7183 | 7247 | if (!body || !label) { |
7184 | 7248 | return ""; |
7185 | 7249 | } |
|
7257 | 7321 | } |
7258 | 7322 | promptSearch.addEventListener("input", renderCandidates); |
7259 | 7323 | commitIdInput.addEventListener("input", updateOutput); |
| 7324 | + subjectInput.addEventListener("input", updateOutput); |
7260 | 7325 | includeLabelPrefix.addEventListener("change", updateOutput); |
7261 | 7326 | createSeriesVisibilityMenu(); |
7262 | 7327 | renderCandidates(); |
|
0 commit comments