chore: auto-merge develop → main

Triggered by: 5462879 fix: chat response truncated at 'Ingredienti:' (MAX_TOKENS)
This commit is contained in:
github-actions[bot]
2026-05-10 14:21:24 +00:00
+6 -12
View File
@@ -2848,18 +2848,9 @@ REGOLE:
PROMPT;
// Build conversation for Gemini
// systemInstruction is passed separately in the payload; contents only contains the actual chat turns.
$contents = [];
// System instruction as first user+model turn
$contents[] = [
'role' => 'user',
'parts' => [['text' => $systemPrompt]]
];
$contents[] = [
'role' => 'model',
'parts' => [['text' => 'Ciao! Sono il tuo assistente cucina. Conosco tutto quello che hai in dispensa e sono pronto ad aiutarti. Cosa ti va di preparare? 😊']]
];
// Add conversation history
foreach ($history as $msg) {
$role = ($msg['role'] === 'user') ? 'user' : 'model';
@@ -2877,13 +2868,16 @@ PROMPT;
$payload = [
'contents' => $contents,
'systemInstruction' => [
'parts' => [['text' => $systemPrompt]]
],
'generationConfig' => [
'temperature' => 0.8,
'maxOutputTokens' => 1500
'maxOutputTokens' => 4096
]
];
$result = callGeminiWithFallback($apiKey, $payload, 60);
$result = callGeminiWithFallback($apiKey, $payload, 90);
$httpCode = $result['http_code'];
if ($httpCode !== 200) {