Spaces:
Running on Zero
Running on Zero
Download coach.js from leeennn009/LABEQ: direct link, hf CLI and curl.
- Browser
- Download file 2.83 kB
-
https://huggingface.co/spaces/leeennn009/LABEQ/resolve/main/coach.js
- Command line
-
hf download hf://spaces/leeennn009/LABEQ/coach.js
-
curl -L -o coach.js https://huggingface.co/spaces/leeennn009/LABEQ/resolve/main/coach.js
2.83 kB
| /* LABEQ V16 - context-grounded coaching only. | |
| * No hard-coded situation quotes. The coaching text is generated by Qwen base, | |
| * never represented as Faisal's own rationale or as external validation. */ | |
| (()=>{ | |
| ; | |
| const id=(key)=>document.getElementById(key); | |
| const clean=(s)=>typeof s==='string'?s.trim():''; | |
| const styles={polite:'لبق',firm:'حازم',diplomatic:'دبلوماسي',apology:'اعتذار',clarify:'طلب توضيح'}; | |
| function compareCard(item,label){ | |
| const card=document.createElement('div'); | |
| card.className='coach-comparison-card'; | |
| const title=document.createElement('strong'); | |
| title.textContent=label+' · '+(styles[item.style]||'أسلوب الرد'); | |
| const reply=document.createElement('p'); | |
| reply.textContent=item.reply; | |
| card.append(title,reply); | |
| return card; | |
| } | |
| function syncResult({coaching,isDemo,comparison}){ | |
| const box=id('coachLearning');if(!box)return; | |
| const c=coaching||{}; | |
| const strategy=clean(c.strategy), core=clean(c.core), risk=clean(c.risk); | |
| if(isDemo||(!strategy&&!core&&!risk)) {box.hidden=true;return;} | |
| box.hidden=false; | |
| id('coachGlimpse').textContent=strategy||core; | |
| id('coachWhy').textContent=core||clean(c.objective)||'لم يكتمل تحليل الموقف.'; | |
| id('coachWatch').textContent=risk||'راجعي المعنى قبل الإرسال، خاصة أي تفاصيل لم تذكريها.'; | |
| const compare=id('coachCompareCards');compare.replaceChildren(); | |
| if(comparison){ | |
| compare.append(compareCard(comparison.before,'الرد الأول'),compareCard(comparison.after,'الرد الثاني')); | |
| } | |
| const p=document.createElement('p');p.className='contextual-comparison-help'; | |
| p.textContent='الاختلاف الحقيقي بين الأسلوبين يبان في ردّين مولّدين لنفس الموقف؛ جرّبي أسلوبًا ثانيًا للمقارنة بدل أمثلة عامة.'; | |
| if(!comparison)compare.append(p); | |
| const b=document.createElement('button');b.type='button';b.className='action-button';b.textContent='جرّبي أسلوبًا ثانيًا'; | |
| b.addEventListener('click',()=>{ | |
| const opts=id('replyOptions');if(opts)opts.open=true; | |
| const btn=id('changeStyleBtn');if(btn)btn.click(); | |
| opts?.scrollIntoView?.({behavior:'smooth',block:'center'}); | |
| });compare.append(b); | |
| const note=box.querySelector('.coach-disclaimer'); | |
| if(note)note.textContent='الشرح ناتج عن خطوة تخطيط آلية باستخدام Qwen الأساسي، وليس تفسيرًا داخليًا لقرار فيصل أو تقييمًا بشريًا.'; | |
| } | |
| function clearResult(){const box=id('coachLearning');if(box)box.hidden=true;for(const key of ['coachInsight','coachCompare']){const el=id(key);if(el)el.open=false;}} | |
| window.labeqCoach={syncResult,clearResult,reset:clearResult}; | |
| })(); | |