Enhance DuplexPipeline to track assistant activity and improve presence probe logic. Introduce a method to update assistant activity timestamp and modify presence probe conditions to consider both user and assistant activity. Update tests to validate new behavior and ensure contextual prompts are generated correctly.

This commit is contained in:
Xin Wang
2026-02-28 16:09:05 +08:00
parent 8f1317860f
commit 20abf72ded
3 changed files with 100 additions and 9 deletions

View File

@@ -3815,8 +3815,15 @@ export const DebugDrawer: React.FC<{
if (!finalText) return prev;
const last = prev[prev.length - 1];
if (last?.role === 'model') {
if (last.text === finalText) return prev;
if (finalText.startsWith(last.text) || last.text.startsWith(finalText)) {
const sameResponse = Boolean(
responseId
&& last.responseId
&& responseId === last.responseId
);
const bothWithoutResponseId = !responseId && !last.responseId;
const canMergeTail = sameResponse || bothWithoutResponseId;
if (canMergeTail && last.text === finalText) return prev;
if (canMergeTail && (finalText.startsWith(last.text) || last.text.startsWith(finalText))) {
const next = [...prev];
next[next.length - 1] = { ...last, text: finalText };
return next;