Auto-deploy: 2026-05-18 00:18:20

This commit is contained in:
Hamza-Ayed
2026-05-18 00:18:20 +03:00
parent 0267dc698c
commit f3b04c1c4c
2 changed files with 8 additions and 8 deletions

View File

@@ -24,18 +24,18 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText
throw new Error('Daily limit reached (1,000 requests). Resets at midnight PT.');
}
// Truncate text
const maxChars = 6000;
// Truncate text — 12k chars to fit list_analysis prompts
const maxChars = 12000;
const trimmedPrompt = prompt && prompt.length > maxChars
? prompt.substring(0, maxChars) + '\n\n[Truncated]'
: prompt;
const MAX_RETRIES = 3;
const RETRY_DELAYS = [2000, 20000, 30000];
const RETRY_DELAYS = [0, 15000, 30000]; // No delay on first attempt
let lastError = '';
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
await delay(RETRY_DELAYS[attempt]);
if (RETRY_DELAYS[attempt] > 0) await delay(RETRY_DELAYS[attempt]);
try {
const response = await fetch('https://cv.intaleqapp.com/cv/server/generate_cv.php', {
@@ -60,7 +60,8 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText
} else {
const text = data.candidates?.[0]?.content?.parts?.[0]?.text;
if (!text) {
lastError = 'Empty response from API.';
console.error('[LJA-BG] Empty text. Full response:', JSON.stringify(data).substring(0, 500));
lastError = 'Empty response from API. Server returned: ' + JSON.stringify(data).substring(0, 200);
continue;
}
await incrementUsage();

View File

@@ -48,9 +48,8 @@ if (empty($apiKey)) {
exit;
}
// $model = "gemini-flash-lite-latest";
$model = "gemini-flash-lite-latest";
// $model = "gemini-2.5-flash";
// gemini-2.5-flash is required for reliable structured JSON output (list_analysis)
$model = "gemini-2.5-flash";
$geminiUrl = "https://generativelanguage.googleapis.com/v1beta/models/{$model}:generateContent?key=" . $apiKey;
// ==========================================