File size: 584 Bytes
68d7816
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { renderPrompt } from '#/_base/utils/render-prompt';

import compactionInstructionTemplate from './compaction-instruction.md?raw';

export interface CompactionInstructionInput {
  readonly customInstruction?: string;
}

export function renderCompactionInstruction(input: CompactionInstructionInput): string {
  const customInstruction = input.customInstruction?.trim() ?? '';
  return renderPrompt(compactionInstructionTemplate, {
    custom_instruction_block:
      customInstruction.length > 0 ? `\nOptional user instruction:\n${customInstruction}\n` : '',
  }).trimEnd();
}