@@ -521,18 +521,6 @@ function resolveHistoryStartIndex(
521521
522522export function buildChatItems ( props : BuildChatItemsProps ) : Array < ChatItem | MessageGroup > {
523523 let items : ChatItem [ ] = [ ] ;
524- const debugItems = typeof ( globalThis as any ) . window !== "undefined" ;
525- if ( debugItems ) {
526- console . warn (
527- "[DEDUPE] buildChatItems input" ,
528- JSON . stringify ( {
529- msgCount : ( Array . isArray ( props . messages ) ? props . messages : [ ] ) . length ,
530- streamIsNull : props . stream === null ,
531- streamLen : typeof props . stream === "string" ? props . stream . length : 0 ,
532- segCount : ( props . streamSegments ?? [ ] ) . length ,
533- } ) ,
534- ) ;
535- }
536524 const historyRenderLimit = resolveHistoryRenderLimit ( props . historyRenderLimit ) ;
537525 const history = ( Array . isArray ( props . messages ) ? props . messages : [ ] ) . filter (
538526 ( message ) => ! isAssistantHeartbeatAckForDisplay ( message ) ,
@@ -706,25 +694,6 @@ export function buildChatItems(props: BuildChatItemsProps): Array<ChatItem | Mes
706694 const result = groupMessages (
707695 collapseSequentialDuplicateMessages ( sortChatItemsByVisibleTime ( items ) ) ,
708696 ) ;
709- if ( debugItems ) {
710- const previews = result . map ( ( item ) => {
711- if ( item . kind === "stream" ) {
712- return `stream[${ item . text . slice ( 0 , 30 ) } ]` ;
713- }
714- if ( item . kind === "group" ) {
715- const texts = item . messages . map ( ( m ) => {
716- const msg = m . message as Record < string , unknown > ;
717- const role = typeof msg . role === "string" ? msg . role : "?" ;
718- const content = Array . isArray ( msg . content ) ? msg . content : [ ] ;
719- const textBlocks = content . filter ( ( b : any ) => b ?. type === "text" ) ;
720- const text = textBlocks . map ( ( b : any ) => String ( b . text ?? "" ) . slice ( 0 , 30 ) ) . join ( "|" ) ;
721- return `${ role } :"${ text } "` ;
722- } ) ;
723- return `group[${ texts . join ( "; " ) } ]` ;
724- }
725- return item . kind ;
726- } ) ;
727- }
728697 return result ;
729698}
730699
0 commit comments