apply gemini safety settings as extra_body in OpenRouter requests (#4256) * apply gemini safety settings as extra_body in OpenRouter requests * revert adding new gemini safety category * Make it actually work --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>

71a3ad0edb6b5da40926126061a476c7a53381ca

Frédéric Bolvin <frederic@bol.vin>

Signed
1 files changed, +5 -0Ignore whitespace
src/endpoints/backends/chat-completions.js+5 -0
@@ -1486,6 +1486,11 @@ router.post('/generate', function (request, response) {
1486 if (Number.isInteger(cachingAtDepth) && cachingAtDepth >= 0 && isClaude3or4) {1486 if (Number.isInteger(cachingAtDepth) && cachingAtDepth >= 0 && isClaude3or4) {
1487 cachingAtDepthForOpenRouterClaude(request.body.messages, cachingAtDepth, cacheTTL);1487 cachingAtDepthForOpenRouterClaude(request.body.messages, cachingAtDepth, cacheTTL);
1488 }1488 }
1489
1490 const isGemini = /google\/gemini/.test(request.body.model);
1491 if (isGemini) {
1492 bodyParams['safety_settings'] = GEMINI_SAFETY;
1493 }
1489 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.CUSTOM) {1494 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.CUSTOM) {
1490 apiUrl = request.body.custom_url;1495 apiUrl = request.body.custom_url;
1491 apiKey = readSecret(request.user.directories, SECRET_KEYS.CUSTOM);1496 apiKey = readSecret(request.user.directories, SECRET_KEYS.CUSTOM);