Auto-deploy: 2026-05-18 01:49:47
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user