Skip to content

Commit a05dcbd

Browse files
committed
Cache from before last assistant index instead of instructions prompt
1 parent e477b4a commit a05dcbd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

common/src/util/messages.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,17 @@ export function convertCbToModelMessages({
236236
// - The message right before the three tagged messages
237237
// - Last message
238238
for (const tag of [
239+
'LAST_ASSISTANT_MESSAGE',
239240
'USER_PROMPT',
240-
'INSTRUCTIONS_PROMPT',
241241
'STEP_PROMPT',
242242
undefined, // Last message
243243
] as const) {
244-
let index = tag
245-
? aggregated.findLastIndex((m) => m.tags?.includes(tag))
246-
: aggregated.length
244+
let index =
245+
tag === 'LAST_ASSISTANT_MESSAGE'
246+
? aggregated.findLastIndex((m) => m.role === 'assistant')
247+
: tag
248+
? aggregated.findLastIndex((m) => m.tags?.includes(tag))
249+
: aggregated.length
247250
if (index <= 0) {
248251
continue
249252
}

0 commit comments

Comments
 (0)