mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-10 00:50:43 +01:00
cache_control positioning fix
This commit is contained in:
parent
73dabd8905
commit
ac33e4d668
@ -146,11 +146,13 @@ async function sendClaudeRequest(request, response) {
|
||||
cachingAtDepth += convertedPrompt.messages[messageCount - 1].role === 'assistant' ? 1 : 0;
|
||||
|
||||
if (messageCount - 1 - cachingAtDepth >= 0) {
|
||||
convertedPrompt.messages[messageCount - 1 - cachingAtDepth]['cache_control'] = { type: 'ephemeral' };
|
||||
const contentCount = convertedPrompt.messages[messageCount - 1 - cachingAtDepth].content.length;
|
||||
convertedPrompt.messages[messageCount - 1 - cachingAtDepth].content[contentCount - 1]['cache_control'] = { type: 'ephemeral' };
|
||||
}
|
||||
|
||||
if (messageCount - 1 - cachingAtDepth - 2 >= 0) {
|
||||
convertedPrompt.messages[messageCount - 1 - cachingAtDepth - 2]['cache_control'] = { type: 'ephemeral' };
|
||||
const contentCount = convertedPrompt.messages[messageCount - 1 - cachingAtDepth].content.length;
|
||||
convertedPrompt.messages[messageCount - 1 - cachingAtDepth - 2].content[contentCount - 1]['cache_control'] = { type: 'ephemeral' };
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user