Fix OpenRouter caching at depth with null model selection

This commit is contained in:
Cohee
2024-12-17 21:40:33 +02:00
parent 79e3dda1df
commit dbc78c1c42

View File

@@ -891,7 +891,7 @@ router.post('/generate', jsonParser, function (request, response) {
}
let cachingAtDepth = getConfigValue('claude.cachingAtDepth', -1);
if (Number.isInteger(cachingAtDepth) && cachingAtDepth >= 0 && request.body.model.startsWith('anthropic/claude-3')) {
if (Number.isInteger(cachingAtDepth) && cachingAtDepth >= 0 && request.body.model?.startsWith('anthropic/claude-3')) {
cachingAtDepthForOpenRouterClaude(request.body.messages, cachingAtDepth);
}
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.CUSTOM) {