Auto-deploy: 2026-05-18 01:49:47

This commit is contained in:
Hamza-Ayed
2026-05-18 01:49:47 +03:00
parent 6c5fd21be6
commit 42aec81504
6 changed files with 548 additions and 11 deletions

View File

@@ -17,7 +17,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
// ─── Core API call ───────────────────────────────────────────────────────────
async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText', jobDescription = '', jobTitle = '' }) {
async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText', jobDescription = '', jobTitle = '', postText = '' }) {
// Rate limit check
const canProceed = await checkRateLimit();
if (!canProceed) {
@@ -46,7 +46,8 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText
apiKey: apiKey,
prompt: trimmedPrompt,
jobDescription: jobDescription,
jobTitle: jobTitle
jobTitle: jobTitle,
postText: postText
})
});
@@ -57,6 +58,15 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText
if (!data.pdf) throw new Error('Empty PDF response from server.');
await incrementUsage();
return { pdf: data.pdf, filename: data.filename, fromCache: false };
} else if (action === 'generateComment') {
const comment = data.comment;
if (!comment) {
console.error('[LJA-BG] Empty comment. Full response:', JSON.stringify(data).substring(0, 300));
lastError = 'Empty comment from server.';
continue;
}
await incrementUsage();
return { comment, fromCache: false };
} else {
const text = data.candidates?.[0]?.content?.parts?.[0]?.text;
if (!text) {