Auto-deploy: 2026-05-17 23:17:07

This commit is contained in:
Hamza-Ayed
2026-05-17 23:17:07 +03:00
parent a7a782c422
commit 3ac8260c1d
2 changed files with 24 additions and 15 deletions

View File

@@ -638,6 +638,17 @@
</div> </div>
`; `;
// Attach inline copy button listeners
if (tab === 'qa') {
pane.querySelectorAll('.lja-qa-copy-btn').forEach(btn => {
btn.addEventListener('click', function() {
navigator.clipboard.writeText(this.getAttribute('data-answer'));
this.textContent = '✅';
setTimeout(() => this.textContent = '📋', 1200);
});
});
}
copyBtn.style.display = 'block'; copyBtn.style.display = 'block';
// Show auto-fill button for Q&A tab // Show auto-fill button for Q&A tab
@@ -810,12 +821,7 @@ Brief honest assessment of this opportunity for my profile`
<div style="font-weight: 600; font-size: 12px; color: #aaa; margin-bottom: 4px;">❓ ${q}</div> <div style="font-weight: 600; font-size: 12px; color: #aaa; margin-bottom: 4px;">❓ ${q}</div>
<div style="display: flex; align-items: center; gap: 8px;"> <div style="display: flex; align-items: center; gap: 8px;">
<div style="color: #4caf50; font-size: 14px; font-weight: 500; flex: 1;" id="lja-qa-answer-${idx}">💡 ${a}</div> <div style="color: #4caf50; font-size: 14px; font-weight: 500; flex: 1;" id="lja-qa-answer-${idx}">💡 ${a}</div>
<button onclick=" <button class="lja-qa-copy-btn" data-answer="${safeAnswer}" style="background: rgba(108,99,255,0.2); border: none; border-radius: 4px; padding: 4px 8px; cursor: pointer; color: #b0b0ff; font-size: 14px; flex-shrink: 0;" title="Copy answer">📋</button>
const text = document.getElementById('lja-qa-answer-${idx}').textContent.replace('💡 ', '');
navigator.clipboard.writeText(text);
this.textContent = '✅';
setTimeout(() => this.textContent = '📋', 1200);
" style="background: rgba(108,99,255,0.2); border: none; border-radius: 4px; padding: 4px 8px; cursor: pointer; color: #b0b0ff; font-size: 14px; flex-shrink: 0;" title="Copy answer">📋</button>
</div> </div>
</div>`; </div>`;
}); });
@@ -1056,7 +1062,12 @@ Brief honest assessment of this opportunity for my profile`
let results; let results;
try { try {
results = JSON.parse(resultText); const match = resultText.match(/\[[\s\S]*\]/);
if (match) {
results = JSON.parse(match[0]);
} else {
results = JSON.parse(resultText);
}
} catch(e) { } catch(e) {
console.error(resultText); console.error(resultText);
throw new Error('Failed to parse AI response'); throw new Error('Failed to parse AI response');

View File

@@ -2,10 +2,8 @@
// LANGUAGE RULES: Analysis = match job language. Everything else = ENGLISH ALWAYS. // LANGUAGE RULES: Analysis = match job language. Everything else = ENGLISH ALWAYS.
function buildPromptV2(tab, job, userProfile, language) { function buildPromptV2(tab, job, userProfile, language) {
// Only analysis follows job language; rest is always English // Force Arabic for the analysis tab to ensure full comprehension
const analysisLang = language === 'arabic' ? 'Respond entirely in Arabic.' const analysisLang = 'Respond ENTIRELY in Arabic. All headings, explanations, and bullets MUST be in Arabic. and RTL';
: language === 'english' ? 'Respond entirely in English.'
: 'Respond in the same language as the job posting.';
const ctx = [ const ctx = [
'Job Title: ' + (job.jobTitle || 'Not specified'), 'Job Title: ' + (job.jobTitle || 'Not specified'),
@@ -139,10 +137,10 @@ ${ctx}
QUESTIONS TO ANSWER: QUESTIONS TO ANSWER:
${dynamicQuestions} ${dynamicQuestions}
RESPOND WITH ONLY THIS FORMAT (raw JSON, no wrapping): RESPOND WITH ONLY THIS FORMAT (raw JSON, no wrapping, answering ONLY the questions listed above):
{ {
"exact question text here": "concise answer", "question 1 text here": "concise answer",
"another question": "answer" "question 2 text here": "concise answer"
}`; }`;
P.benefits = `You are a career analyst specializing in tech compensation in MENA. P.benefits = `You are a career analyst specializing in tech compensation in MENA.