11using BotSharp . Abstraction . Files ;
2+ using BotSharp . Abstraction . Realtime ;
23using BotSharp . Abstraction . Routing ;
34using BotSharp . Core . Infrastructures ;
45using BotSharp . Plugin . Twilio . Interfaces ;
@@ -110,7 +111,7 @@ private async Task ProcessUserMessageAsync(CallerMessage message)
110111 reply . SpeechFileName = await GetReplySpeechFileName ( message . ConversationId , reply , sp ) ;
111112 }
112113
113- reply . Hints = GetHints ( reply ) ;
114+ reply . Hints = GetHints ( agentId , reply , sp ) ;
114115 await sessionManager . SetAssistantReplyAsync ( message . ConversationId , message . SeqNumber , reply ) ;
115116 }
116117
@@ -151,8 +152,13 @@ private static async Task<string> GetReplySpeechFileName(string conversationId,
151152 return fileName ;
152153 }
153154
154- private static string GetHints ( AssistantMessage reply )
155+ private static string GetHints ( string agentId , AssistantMessage reply , IServiceProvider sp )
155156 {
157+ var agentService = sp . GetRequiredService < IAgentService > ( ) ;
158+ var agent = agentService . GetAgent ( agentId ) . Result ;
159+ var extraWords = new List < string > ( ) ;
160+ HookEmitter . Emit < IRealtimeHook > ( sp , hook => extraWords . AddRange ( hook . OnModelTranscriptPrompt ( agent ) ) ) ;
161+
156162 var phrases = reply . Content . Split ( ',' , StringSplitOptions . RemoveEmptyEntries ) ;
157163 int capcity = 100 ;
158164 var hints = new List < string > ( capcity ) ;
@@ -174,6 +180,7 @@ private static string GetHints(AssistantMessage reply)
174180 }
175181 // add frequency short words
176182 hints . AddRange ( [ "yes" , "no" , "correct" , "right" ] ) ;
183+ hints . AddRange ( extraWords ) ;
177184 return string . Join ( ", " , hints . Select ( x => x . ToLower ( ) ) . Distinct ( ) . Reverse ( ) ) ;
178185 }
179186
0 commit comments