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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user