We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e477b4a commit a05dcbdCopy full SHA for a05dcbd
common/src/util/messages.ts
@@ -236,14 +236,17 @@ export function convertCbToModelMessages({
236
// - The message right before the three tagged messages
237
// - Last message
238
for (const tag of [
239
+ 'LAST_ASSISTANT_MESSAGE',
240
'USER_PROMPT',
- 'INSTRUCTIONS_PROMPT',
241
'STEP_PROMPT',
242
undefined, // Last message
243
] as const) {
244
- let index = tag
245
- ? aggregated.findLastIndex((m) => m.tags?.includes(tag))
246
- : aggregated.length
+ let index =
+ tag === 'LAST_ASSISTANT_MESSAGE'
+ ? aggregated.findLastIndex((m) => m.role === 'assistant')
247
+ : tag
248
+ ? aggregated.findLastIndex((m) => m.tags?.includes(tag))
249
+ : aggregated.length
250
if (index <= 0) {
251
continue
252
}
0 commit comments