fix: preserve complete consultation replies and recover retained history

This commit is contained in:
鲨鱼辣椒
2026-09-28 17:38:31 +08:00
parent dda2f0a3be
commit d530abe580
14 changed files with 643 additions and 38 deletions

View File

@@ -62,12 +62,12 @@ export function teacherHistoryMessages(history: TeacherRequest[]): TeacherSource
id: 'teacher:' + request.id + ':user', role: 'user' as const,
text: [...request.references.map(ref => '明确引用:\n' + ref.text), request.text].join('\n\n'),
}]),
{
...(request.replyIncomplete ? [] : [{
id: 'teacher:' + request.id + ':assistant', role: 'assistant' as const,
text: [request.response, ...(request.suggestedQuestions?.length
? ['可以接着聊的问题:\n' + request.suggestedQuestions.map(text => '- ' + text).join('\n')]
: [])].join('\n\n'),
},
}]),
]);
}
// A bounded text estimate for the native model path, not an exact tokenizer or