(options: BuildCompactionMessageTextOptions)
| 18 | * so prompt wording stays consistent regardless of where compaction starts. |
| 19 | */ |
| 20 | export function buildCompactionMessageText(options: BuildCompactionMessageTextOptions): string { |
| 21 | const targetWords = options.maxOutputTokens |
| 22 | ? Math.round(options.maxOutputTokens / WORDS_TO_TOKENS_RATIO) |
| 23 | : DEFAULT_COMPACTION_WORD_TARGET; |
| 24 | |
| 25 | let messageText = buildCompactionPrompt(targetWords); |
| 26 | |
| 27 | if (options.followUpContent && !isDefaultSourceContent(options.followUpContent)) { |
| 28 | messageText += `\n\nThe user wants to continue with: ${options.followUpContent.text}`; |
| 29 | } |
| 30 | |
| 31 | return messageText; |
| 32 | } |
no test coverage detected