Auto-deploy: 2026-05-17 01:59:57
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 = '' }) {
|
||||
async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText', jobDescription = '', jobTitle = '' }) {
|
||||
// Rate limit check
|
||||
const canProceed = await checkRateLimit();
|
||||
if (!canProceed) {
|
||||
@@ -45,7 +45,8 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText
|
||||
action: action,
|
||||
apiKey: apiKey,
|
||||
prompt: trimmedPrompt,
|
||||
jobDescription: jobDescription
|
||||
jobDescription: jobDescription,
|
||||
jobTitle: jobTitle
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -501,6 +501,7 @@
|
||||
payload: {
|
||||
apiKey: settings.apiKey,
|
||||
jobDescription: jobData.description,
|
||||
jobTitle: jobData.jobTitle || 'Job',
|
||||
action: 'generatePdf'
|
||||
}
|
||||
}, resolve);
|
||||
|
||||
@@ -112,10 +112,15 @@ Job Description:
|
||||
$dompdf->render();
|
||||
|
||||
$pdfOutput = $dompdf->output();
|
||||
$rawJobTitle = $data['jobTitle'] ?? 'Job';
|
||||
$safeJobTitle = preg_replace('/[^a-zA-Z0-9\-_]/', '_', $rawJobTitle);
|
||||
$safeJobTitle = trim($safeJobTitle, '_');
|
||||
$fileName = "Hamza_Ayed - {$safeJobTitle}.pdf";
|
||||
|
||||
echo json_encode([
|
||||
"success" => true,
|
||||
"pdf" => base64_encode($pdfOutput),
|
||||
"filename" => "Tailored_CV.pdf"
|
||||
"filename" => $fileName
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
@@ -132,7 +137,7 @@ if ($action === 'generateText') {
|
||||
|
||||
$payload = json_encode([
|
||||
"contents" => [["parts" => [["text" => $prompt]]]],
|
||||
"generationConfig" => ["temperature" => 0.7, "maxOutputTokens" => 2048]
|
||||
"generationConfig" => ["temperature" => 0.7, "maxOutputTokens" => 8192]
|
||||
]);
|
||||
|
||||
$ch = curl_init($geminiUrl);
|
||||
|
||||
Reference in New Issue
Block a user