File tree Expand file tree Collapse file tree
client-react/src/conversation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import {
3838 TranscriptData ,
3939 TransportState ,
4040 UICancelJobGroupData ,
41+ UserLLMTextData ,
4142 UICommandData ,
4243 UIEventData ,
4344 UIJobGroupData ,
@@ -150,6 +151,7 @@ export type RTVIEventCallbacks = Partial<{
150151 onUserMuteStarted : ( ) => void ;
151152 onUserMuteStopped : ( ) => void ;
152153 onUserTranscript : ( data : TranscriptData ) => void ;
154+ onUserLlmText : ( data : UserLLMTextData ) => void ;
153155 onBotOutput : ( data : BotOutputData ) => void ;
154156 /** @deprecated Use onBotOutput instead */
155157 onBotTranscript : ( data : BotLLMTextData ) => void ;
@@ -1173,6 +1175,12 @@ export class PipecatClient extends RTVIEventEmitter {
11731175 this . _options . callbacks ?. onUserTranscript ?.( TranscriptData ) ;
11741176 break ;
11751177 }
1178+ case RTVIMessageType . USER_LLM_TEXT : {
1179+ const llmTextData = ev . data as UserLLMTextData ;
1180+ this . _options . callbacks ?. onUserLlmText ?.( llmTextData ) ;
1181+ this . emit ( RTVIEvent . UserLlmText , llmTextData ) ;
1182+ break ;
1183+ }
11761184 case RTVIMessageType . BOT_OUTPUT : {
11771185 this . _options . callbacks ?. onBotOutput ?.( ev . data as BotOutputData ) ;
11781186 break ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 TranscriptData ,
2222 UICommandData ,
2323 UIJobGroupData ,
24+ UserLLMTextData ,
2425} from "./messages" ;
2526
2627export enum RTVIEvent {
@@ -65,6 +66,7 @@ export enum RTVIEvent {
6566 BotTranscript = "botTranscript" ,
6667
6768 // llm events
69+ UserLlmText = "userLlmText" ,
6870 BotLlmText = "botLlmText" ,
6971 BotLlmStarted = "botLlmStarted" ,
7072 BotLlmStopped = "botLlmStopped" ,
@@ -151,6 +153,7 @@ export type RTVIEvents = Partial<{
151153 botTranscript : ( data : BotLLMTextData ) => void ;
152154
153155 // llm events
156+ userLlmText : ( data : UserLLMTextData ) => void ;
154157 botLlmText : ( data : BotLLMTextData ) => void ;
155158 botLlmStarted : ( ) => void ;
156159 botLlmStopped : ( ) => void ;
Original file line number Diff line number Diff line change @@ -153,6 +153,10 @@ export type BotLLMTextData = {
153153 text : string ;
154154} ;
155155
156+ export type UserLLMTextData = {
157+ text : string ;
158+ } ;
159+
156160export type BotTTSTextData = {
157161 text : string ;
158162} ;
Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ export const mergeMessages = (
130130 lastMerged . role === currentMessage . role &&
131131 currentMessage . role !== "system" &&
132132 currentMessage . role !== "function_call" &&
133+ ! lastMerged . final &&
133134 timeDiff < MERGE_WINDOW_MS ;
134135
135136 if ( shouldMerge ) {
You can’t perform that action at this time.
0 commit comments