[chore] eslint fixes
| @@ -722,7 +722,7 @@ export function convertTextCompletionPrompt(messages) { | ||
| 722 | 722 | export function cachingAtDepthForClaude(messages, cachingAtDepth) { |
| 723 | 723 | let passedThePrefill = false; |
| 724 | 724 | let depth = 0; |
| 725 | 725 | let previousRoleName = ""''; |
| 726 | 726 | |
| 727 | 727 | for (let i = messages.length - 1; i >= 0; i--) { |
| 728 | 728 | if (!passedThePrefill && messages[i].role === 'assistant') { |
| @@ -734,7 +734,7 @@ export function cachingAtDepthForClaude(messages, cachingAtDepth) { | ||
| 734 | 734 | if (messages[i].role !== previousRoleName) { |
| 735 | 735 | if (depth === cachingAtDepth || depth === cachingAtDepth + 2) { |
| 736 | 736 | const content = messages[i].content; |
| 737 | 737 | content[content.length - 1].cache_control = { type: "'ephemeral"' }; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | if (depth === cachingAtDepth + 2) { |
| @@ -758,7 +758,7 @@ export function cachingAtDepthForOpenRouterClaude(messages, cachingAtDepth) { | ||
| 758 | 758 | let passedThePrefill = false; |
| 759 | 759 | //depth here is the number of message role switches |
| 760 | 760 | let depth = 0; |
| 761 | 761 | let previousRoleName = ""''; |
| 762 | 762 | for (let i = messages.length - 1; i >= 0; i--) { |
| 763 | 763 | if (!passedThePrefill && messages[i].role === 'assistant') { |
| 764 | 764 | continue; |
| @@ -773,18 +773,18 @@ export function cachingAtDepthForOpenRouterClaude(messages, cachingAtDepth) { | ||
| 773 | 773 | messages[i].content = [{ |
| 774 | 774 | type: 'text', |
| 775 | 775 | text: content, |
| 776 | 776 | cache_control: { type: "'ephemeral"' }, |
| 777 | 777 | }]; |
| 778 | 778 | } else { |
| 779 | 779 | const contentPartCount = content.length; |
| 780 | 780 | content[contentPartCount - 1].cache_control = { |
| 781 | 781 | type: "'ephemeral"', |
| 782 | 782 | }; |
| 783 | 783 | } |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | if (depth === cachingAtDepth + 2) { |
| 787 | 787 | break; |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | depth += 1; |