unknown
ai-prompt
.ai-tool-buttons{ display:flex; align-items:center; gap:.5rem; margin:.5rem 0; } .ai-tool-btn{ font:inherit; font-size:.5rem; font-weight:600; cursor:pointer; border-radius:999px; border:1px solid var(--border); padding:.4rem; background:var(--accent); color:#fff; box-shadow:var(--shadow-sm); transition: background .18s ease, box-shadow .18s ease, transform .18s ease; } .ai-tool-btn:hover{ background:var(--accent-strong); box-shadow:var(--shadow-md); transform:translateY(-1px); } .ai-tool-btn.help{ flex:0 0 auto; width:1.75rem; height:1.75rem; padding:0; display:inline-flex; align-items:center; justify-content:center; background:var(--surface); color:var(--accent); font-weight:700; } .ai-tool-btn.help:hover{ background:var(--accent-soft); color:var(--accent-strong); transform:translateY(-1px); } ================================================== function showAiHelpPromptHelp(){ message({text:tag("ai-help-prompt-help").innerHTML, title:"Copy Prompt"}) } function getAiHelpPrompt(){ const choice = tag("ai-prompt-select").value bookInfo.promptTypeRequested=choice if(choice==="general"){ const text=["I'm currently a student studying this book:"] text.push(JSON.stringify(bookInfo.chapters)) text.push(`I'm currently studying chapter ${bookInfo.currentChapter}.`) text.push("as we interact, this gives you a sense for what I've learned and what is coming in my course of study, so you can give me appropriate help. I'll favor responses that rely heavily on the content I've already covered, but if you do need to refer to something I have not year learned, I prefer that you use ideas that are coming in this course of study. Only refer to content outside of this course of study when absolutely necessary to provide a reasonable answer. Anytime you are using concepts that I have not already learned, be sure to give me the option for a more detailed explanation.") navigator.clipboard.writeText(text.join("\n")) .then(() =>console.log("Copied!")) .catch(err =>console.error("Failed:", err)); showToast("AI Prompt Copied") }else{ // assuming all other types are chapter reviews const url=`https://${bookInfo.blogUrl}/feeds/posts/default/-/${bookInfo.currentChapter}?alt=json-in-script&max-results=1&callback=buildChapterPrompt` loadCrossOrigin(url) } } function buildChapterPrompt(x){ let prompt="" if(bookInfo.promptTypeRequested==="quiz"){ prompt="Create a quiz to help me study the this content." }else if(bookInfo.promptTypeRequested==="examples"){ prompt="Help me review by discussing the content with different examples." } const chapterContent=getMarkDown(x.feed.entry[0].content.$t) navigator.clipboard.writeText("Here is a chapter I'm studying: \n\n" + chapterContent + "\n\n" + prompt) .then(() =>{ console.log("Copied!") showToast("AI Prompt Copied") }).catch(err =>{ console.error("Failed:", err) showToast("Something went wrong. Details in console.") }); function getMarkDown(html){ const turndownService = new TurndownService(); return turndownService.turndown(html); } } ==================================================Copy a prompt for your AI to: