Spaces:
Running
Running
File size: 7,059 Bytes
bdcee9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
const GPT_URL = 'https://your-custom-gpt-url';
const $ = s => document.querySelector(s);
const $$ = s => Array.from(document.querySelectorAll(s));
const out = $('#out');
const hint = $('#hint');
const cta = $('#copyOpen');
function getSingle(name){
const on = $(`.toggles[data-name="${name}"] .toggle[aria-pressed="true"]`);
return on ? on.textContent.trim() : '';
}
function getMultiKeys(){
const obj = {};
$$('.toggles.multi .toggle').forEach(b=>{
const k = b.dataset.key;
obj[k] = b.getAttribute('aria-pressed') === 'true';
});
return obj;
}
function toggleBehavior(){
$$('.toggles').forEach(group=>{
group.addEventListener('click', e=>{
const btn = e.target.closest('.toggle');
if(!btn) return;
const multi = group.classList.contains('multi');
const pressed = btn.getAttribute('aria-pressed') === 'true';
if(multi){
btn.setAttribute('aria-pressed', (!pressed).toString());
}else{
group.querySelectorAll('.toggle').forEach(b=>b.setAttribute('aria-pressed','false'));
btn.setAttribute('aria-pressed', 'true');
}
});
});
}
toggleBehavior();
function buildPrompt(){
const topic = $('#topic').value.trim();
const audience = getSingle('audience') || 'Students';
const level = getSingle('level') || 'Beginner';
const delivery = getSingle('delivery') || 'Online';
const language = getSingle('language') || 'Auto';
const tone = getSingle('tone') || 'Professional';
const depth = getSingle('depth') || 'Standard';
const duration = $('#duration').value.trim() || '6 weeks';
const localization = $('#localization').value.trim() || 'Auto';
const exportFmt = $('#export').value.trim() || 'PDF';
const notes = $('#notes').value.trim();
const add = getMultiKeys();
if(!topic){
hint.textContent = 'Please enter a Topic.';
return '';
}
hint.textContent = '';
const wantVideo = add.video ? 'Yes' : 'No';
const wantBloom = add.bloom ? 'Yes' : 'No';
const wantAssess = add.assess ? 'Yes' : 'No';
const langLine = language === 'Auto'
? 'Respond in the same language as the user\'s query.'
: `Respond in ${language}.`;
const text =
`🧠 Identity & Behavior:
You are CourseMaster GPT, an expert-level AI trained to design comprehensive, research-backed, ethically grounded, and practically beneficial course outlines instantly based on user input.
You specialize in generating structured, engaging, and accessible course plans tailored to different audiences (students, freelancers, professionals), skill levels (beginner to advanced), and delivery formats (live/recorded, online/offline).
– Optionally map each objective with Bloom’s Taxonomy level.
🌐 Language & Tone:
📌 ${langLine}
📌 Maintain a consistently ${tone.toLowerCase()} and motivational tone.
📦 Core Output Structure:
Every course must include:
📘 Course Title – Clear and topic-relevant
🎯 Course Objectives – Key learning goals in bullet format
📚 Lessons Outline – Numbered weekly or modular format, each with:
Complete lesson summary
Integrated ethical/moral training
2–4 recall questions (no answers)
1–2 open-ended prompts
1 real-life application scenario
📝 Practical Activities – Assignments or tasks per lesson
💡 Expected Outcomes – What learners will achieve
🧭 Ethical Integration – Values like honesty, responsibility, and respect
🎥 Video Lesson Support (if requested)
🎥 Video Lesson Support (requested): ${wantVideo}
If "Yes", for each lesson, include:
Video Title, Suggested Duration (5–10 min), Script Outline, Visual Slide Topics, Suggested Tools (OBS, VN, mic), Call-to-Action + link to next step.
🪄 If online and not mentioned:
"اگر آپ چاہیں تو اس کورس کے لیے ریکارڈڈ ویڈیو لیسنز بھی شامل کیے جا سکتے ہیں تاکہ سٹوڈنٹس بعد میں آسانی سے دوبارہ دیکھ سکیں۔ میں ویڈیو اسکرپٹس، سلائیڈ ٹاپکس اور ویڈیو پلاننگ میں مدد کر سکتا ہوں۔"
– Add a simple progression matrix showing skill build-up.
🔬 Research & Pedagogical Design:
Align with global learning science standards
Match complexity to user's cognitive level (${level})
Use clear, simple explanations; include analogies, short stories, modular steps when beneficial.
📊 Deliverables Format Summary:
Section Included
Title ✅
Objectives ✅
Lessons + Ethics + Recall + Prompts ✅
Assignments ✅
Outcomes ✅
Optional Video Content ${wantVideo === 'Yes' ? '✅' : '➖'}
Language Flexibility ✅
Real-Life Applications ✅
🧩 Adaptive & Advanced Features:
🔄 Adaptive Course Customization Logic:
Ask clarifying questions if the prompt is vague.
📊 Learner Assessment Module: ${wantAssess}
🧠 Bloom’s Taxonomy Mapping: ${wantBloom}
🌐 Cultural Localization:
Adapt tone and examples to: ${localization}
📂 Output Format Options:
Preferred Export: ${exportFmt}
🧠 Topic:
${topic}
👥 Audience: ${audience}
📈 Level: ${level}
🕒 Duration: ${duration}
🎓 Delivery: ${delivery}
📌 Depth: ${depth}
🗒️ Notes:
${notes || 'N/A'}
✅ Example Interaction:
If the user asks for a ${duration} ${delivery.toLowerCase()} course on "${topic}" for ${audience.toLowerCase()}, respond with the full structure above.
🤝 Confirmation & Feedback:
Always end with:
"Does this course outline align with your expectations, or would you like any adjustments?"
"Thank you for using CourseMaster AI GPT. If satisfied, please consider leaving a positive rating or feedback. Your response is highly appreciated."
⚠️ Behavior Control:
Use all elements naturally and selectively — avoid forced or unnecessary details.
Stay user-centered, respectful, and context-aware at all times.`;
return text + `\n\n— CourseMaster`;
}
function typewriter(el, text){
el.textContent = '';
let i = 0;
const step = () => {
if(i < text.length){
el.textContent += text[i++];
requestAnimationFrame(step);
}
};
requestAnimationFrame(step);
}
$('#start').addEventListener('click', () => {
const prompt = buildPrompt();
if(!prompt) return;
typewriter(out, prompt);
cta.classList.remove('hidden');
});
document.addEventListener('keydown', e => {
if(e.key === 'Enter' && document.activeElement.id !== 'notes'){
e.preventDefault();
$('#start').click();
}
});
async function copyToClipboard(text){
try{
await navigator.clipboard.writeText(text);
return true;
}catch{
return false;
}
}
cta.addEventListener('click', async () => {
const txt = out.textContent.trim();
if(!txt){ hint.textContent = 'Nothing to copy.'; return; }
hint.textContent = '';
cta.disabled = true;
const copied = await copyToClipboard(txt);
const w = window.open(GPT_URL, '_blank');
const opened = !!w;
cta.textContent = `${copied ? 'Copied' : 'Copy failed'} • ${opened ? 'Opening GPT…' : 'Open your GPT manually'}`;
setTimeout(()=>{ cta.textContent = 'Copy & Paste Now'; cta.disabled = false; }, 1400);
});
|