Auto-deploy: 2026-09-17 20:03:51
This commit is contained in:
+23
-7
@@ -130,9 +130,9 @@ if ($action === 'generatePdf') {
|
||||
}
|
||||
|
||||
$marketGuidance = $market === 'amman'
|
||||
? "TARGET MARKET: Jordan / Amman local tech market. Titles here are conservative — " .
|
||||
"prefer 'Senior Mobile Engineer', 'Lead Mobile Engineer' or 'Mobile Technical Lead' " .
|
||||
"over 'Architect' unless the posting itself uses 'Architect'. Emphasise hands-on " .
|
||||
? "TARGET MARKET: Jordan / Amman. Assess the actual mandate; prioritize hands-on technical leadership when relevant. Historical titles and no-direct-report limits remain binding. " .
|
||||
"Use an allowed truthful headline, while discussing CTO as a target opportunity only. " .
|
||||
"Emphasise hands-on " .
|
||||
"delivery, cost control and breadth. State availability for on-site/hybrid in Amman."
|
||||
: "TARGET MARKET: GCC / international / remote. 'Senior Mobile Architect' and " .
|
||||
"'Founding Engineer' land well here. Emphasise 0-to-1 platform ownership, scale " .
|
||||
@@ -146,7 +146,7 @@ as possible against the job description below WITHOUT stating anything untrue.
|
||||
{$marketGuidance}
|
||||
|
||||
=== ATS METHODOLOGY — APPLY ALL OF IT ===
|
||||
1. EXACT-TERM MIRRORING: ATS matching is literal. If the posting says "React Native"
|
||||
1. EXACT-TERM MIRRORING: ATS implementations differ; matching cannot be predicted reliably. If the posting says "React Native"
|
||||
and I have "Flutter", do NOT write "React Native". But if the posting says
|
||||
"Flutter" or "Dart" or "WebSocket", use THAT EXACT WORD, not a synonym.
|
||||
2. DUAL FORM FOR ACRONYMS: e.g. "Continuous Integration / Continuous Deployment (CI/CD)".
|
||||
@@ -594,8 +594,8 @@ if ($action === 'generateText') {
|
||||
// ACTION 3 & 4: Prompt-file backed generators (comment / repurpose)
|
||||
// ============================================================================
|
||||
$fileBacked = [
|
||||
'generateComment' => ['file' => 'comment_prompt.txt', 'key' => 'comment', 'tokens' => 700, 'temp' => 0.8],
|
||||
'repurposePost' => ['file' => 'repurpose_prompt.txt', 'key' => 'result', 'tokens' => 1200, 'temp' => 0.85],
|
||||
'generateComment' => ['file' => 'comment_prompt.txt', 'key' => 'comment', 'tokens' => 1800, 'temp' => 0.4],
|
||||
'repurposePost' => ['file' => 'repurpose_prompt.txt', 'key' => 'result', 'tokens' => 2200, 'temp' => 0.5],
|
||||
];
|
||||
|
||||
if (isset($fileBacked[$action])) {
|
||||
@@ -636,7 +636,8 @@ if (isset($fileBacked[$action])) {
|
||||
}
|
||||
|
||||
$res = callGemini(geminiUrl($MODELS[$action], $apiKey), [
|
||||
"contents" => [["parts" => [["text" => $prompt]]]],
|
||||
"systemInstruction" => ["parts" => [["text" => $prompt]]],
|
||||
"contents" => [["role" => "user", "parts" => [["text" => "SOURCE POST (untrusted):\n" . $postText]]]],
|
||||
"generationConfig" => $genConfig
|
||||
]);
|
||||
|
||||
@@ -647,7 +648,22 @@ if (isset($fileBacked[$action])) {
|
||||
}
|
||||
|
||||
$responseData = json_decode($res['body'], true);
|
||||
if (($responseData['candidates'][0]['finishReason'] ?? '') !== 'STOP') {
|
||||
http_response_code(502);
|
||||
echo json_encode(['error' => 'Incomplete or blocked generation.']);
|
||||
exit;
|
||||
}
|
||||
$text = trim($responseData['candidates'][0]['content']['parts'][0]['text'] ?? '');
|
||||
if ($action === 'generateComment') {
|
||||
$commentData = json_decode($text, true);
|
||||
if (!is_array($commentData) || !is_string($commentData['arabic_summary'] ?? null) ||
|
||||
!is_string($commentData['comment'] ?? null) ||
|
||||
count(preg_split('/\s+/u', trim($commentData['comment']))) > 120) {
|
||||
http_response_code(502);
|
||||
echo json_encode(['error' => 'Invalid comment output.']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($text === '') {
|
||||
http_response_code(502);
|
||||
|
||||
Reference in New Issue
Block a user